Testing the genesis block

In the dev/test.js file, we will begin by importing our blockchain data structure or Blockchain constructor function, and then making a new instance of our blockchain as bitcoin. We're then going to log out of the bitcoin blockchain as follows:

const Blockchain = require ('./blockchain');const bitcoin = new Blockchain ();console.log(bitcoin);

Save this file and run the test by typing node dev/test.js into the terminal.  

After running the test, we can observe the genesis block, as shown in the following screenshot: 

In the preceding screenshot, for the chain array, you can see that we have one block inside of the ...

Get Learn Blockchain Programming with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.