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
To get a better sense of links, try creating a link between two entries:
- Create an entry with some content with the
- 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).
- Switch to the
- Click one of the entries from the graph. Copy the "Entry Hash" you see in "Entry Detail" and paste it in the
- Click on the other entry, and copy its hash to the
- If you want, input some example tag.
- 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.
If you get stuck implementing this exercise, you can always look at its solution.