Verifying the output of the test

Now, when we run this file, we should receive verification of a valid blockchain, because we didn't tamper with it and created it legitimately, using all of the correct methods. Let's verify whether or not the chainIsValid method works correctly:

  1. Head over to the Terminal and cancel the previous processes that were running by typing ^C in the Terminal. 
  2. Once the processes are cancelled, then in the Terminal, let's type node dev/test.js and press Enter. As we haven't tampered with the blockchain, we'll get the Valid: true response, as seen in the following screenshot: 

Now, let's tamper with the blockchain ...

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.