CID - Content Identifier. An unique address for a block of data in IPFS that is derived from its content.
DAG - Directed Acyclic Graph. Blocks in IPFS form a graph as they can point to other blocks by their CID. These links can only point one direction (directed) and across the whole graph there are no loops or cycles (acyclic).
One important feature of Directed Acyclic Graphs (DAGs) is the ability to link them together.
The way you express links in the IPFS DAG store is with the CID
of
another node.
For example, one node might have a link called foo
pointed
to another CID instance previously saved as barCid
, like so:
{
foo: barCid
}
When we give a field a name and make its value a link to a CID, as shown above, we call this a named link.
We can add named links to IPFS in the same way we add any other data:
await ipfs.dag.put({ foo: barCid })
Create a named link called bar
that points to the node we created in the first lesson. Put it into IPFS and return its CID.
The editor is pre-populated with the code to create the node we're linking to.