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 a list that you are only ever allowed to add entries to the end of, but which you can read from it at any index. Each entry is indexed from 0, 1, 2, 3… like an array. This number is called the 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 it also exists 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.
To get started, create a package.json with all the dependencies you will need for the workshop, including hypercore. In a terminal window, enter:
git clone https://github.com/kappa-db/workshop.git kappa-workshop
Then, use your terminal to change the current working directory to the kappa-workshop
:
cd kappa-workshop
To install the dependencies, run:
npm install
This should install all of the modules specified in the package.json required for this workshop.
To test that everything is installed successfully, make a new file called hypercore.js with the following content:
const 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!
You can run the file in your terminal by entering:
node hypercore.js
Once you solve this exercise continue to exercise 3