This is a basic block. You can see it has been tested in the terminal used "dev-test": "nodemon dev-test". In the package.json
algorithm SHA-256 secure S, hash H, algorithm A, 256 bits for the hash or 32 bytes or characters generated to represent the hash
makes a unique has value (32-byte for each block )
Its a one way hash from the direction of the data to the hash makes it easy to check blocks see if data has been tampered with
npm i crypto-js --save
check to make sure installed cat package.json
const SHA256 = require ('crypto-js/sha256'); is a function that generates a unique hash based of data
note const hash = 'todo-hash';
changed to const hash = Block.hash(timestamp, lastHash, data); ####
This is installed to automate testing of the blocks
Created block chain test file to make sure genesis block was reproducing next block correctly
1. validate a valid chain
2. invalidate a chain with corrupt genesis block
3. invalidate any corrupt block in the chain
1. Chain is replaced if a given chain is valid.
2. Chain is not replaced if <= to the length of the current chain
3. Chain is replaced if passes validation test