4 - Poking at the data

When you append data to the hypercore what happens behind the scenes is that hypercore produces a bunch of cryptographic hashes to build something called a Merkle tree (ask a mentor or read the DAT Protocol Book if you are interested in learning more about the internal details of DAT). This is all needed so data can be shared securely in a p2p fashion so that no one can tamper with the data without us knowing it.

In the end, the data is actually just stored in normal files. You can actually just cat out the data file to see the data you appended:

# print the data in the hypercore
cat single-chat-feed/data

If you want to start over and reset your database, all you need to do is remove the folder you are passing to the hypercore constructor – nice and simple :)

Exercise

Try catting the data file in the hypercore to see the actual data on disk.

Try resetting the hypercore and re-running the solution from the previous exercise to see that the data gets rewritten.

Once you solve this exercise continue to exercise 5