A gym tool Holochain Gym Concepts Developers Core Concepts Toggle darkmode Glossary of Terms Give us Feedback!

Intermediate: Anchors

A good way to think about the public DHT holochain data is like a graph: entries are nodes, and links are the edges that connect the entries.

A link has 3 basic properties:

  • A base entry
  • A target entry
  • A tag with arbitrary content

Try it!

To get a better sense of links, try creating a link between two entries:

  1. Create an entry with some content with the create_entry function.
  2. Create a different entry with the same function (remember, if you create an entry with the same content, it won't be a different entry).
  3. Switch to the create_link function.
  4. Click one of the entries from the graph. Copy the "Entry Hash" you see in "Entry Detail" and paste it in the base field.
  5. Click on the other entry, and copy its hash to the target field.
  6. If you want, input some example tag.
  7. Click execute!

Now you should see the two entries linked together.

Great! Now you might be thinking: what do we do with links? Links are useful to attach metadata to entries, without having to change its content (and if we don't change the content, the hash doesn't change either).

Here we have some posts created, with a link from the author public key to all the posts they have created.

Try creating some posts and see how the entries behave, and try to do a get_links with the public key of the author to get the links to all the posts that that agent has created. You can get the public key of the author by clicking on the Agent entry and copying the hash of that entry. All agents create an initial Agent entry when they join the network, in order to be identified by other peers in that DHT.

Relevant HDK documentation:


If you get stuck implementing this exercise, you can always look at its solution.