Awesome, let's get started.
Each of the exercises today will be built on a data structure called an append-only log. An append-only log is like an list that you are only ever allowed to add entries to the end of, but can read from it at any index. Each entry is indexed from 0,1,2,3.. like an array. This number is called a sequence number. Combined with cryptographically signing each entry, these logs are very useful when building peer-to-peer applications as they are easy to share between multiple computers in a secure and efficient way.
The append-only log we will be using for today's workshop exercises is called hypercore. Hypercore was written to be the main component of the Dat project but as a completely independent data structure. A hypercore is also referred to as a feed. Each hypercore has a cryptographic feed key.
You can read a lot more about Hypercore at https://github.com/mafintosh/hypercore or talk to one of the mentors.
It's a good idea to keep the hypercore README open in a browser tab for the rest of the workshop.
First to get started clone our gist that has a package.json with all the dependencies you will need for the workshop, including hypercore. In a terminal window, write
git clone https://gist.github.com/mafintosh/a642bf514cb6aa583fa8b1a6b1782f19 kappa-workshop
Then move your terminal into the kappa-workshop
folder with cd kappa-workshop
.
To install the dependencies run npm install
which should install all of the modules specified in the package.json required for this workshop.
To test that everything installed succesfully make a new file called hypercore.js with the content:
var hypercore = require('hypercore')
Try running that file to see that it can load the installed Hypercore module. If no errors appear, then you have everything installed correctly!
Once you solve this exercise continue to exercise 3