This assignment was about finding the nonce. It contains two files:
- minCrypto.js: It uses
crypto
module to calculate the nonce, the smallest number, which, when appended to our data, produces a hash lesser than a given target. - mining.js: It is for the same purpose, but uses
node-forge
module.
This assignment was about verifying signatures.
It contains three .js
files:
- generatePair.js for generating a pair of public and private keys
- sign.js for signing with private key
- verify.js for verifying the signature with the corresponding public key.
This assignment was about converting transaction data into binary format and storing it in a .dat
file.
trData.js is the only file.
This assignment was the opposite of the previous assignment. It takes input in binary format and prints the details of transaction data.
readBinData.js is the only file.
This assignment calculates the block header for a given block body by asking for index of the block, hash of the parent block, target (corresponding to which a nonce is calculated), and lastly, the path to file containing the block. It also uses the timestamp of the moment when a nonce value is used. The directory contains a file that can be used to run the code with. Some sample outputs are also included.
nonce.js is the only .js
file.
This assignment has code for a web server, which listens on port 8787. On POSTing a JSON
containing some data to /hash
, it returns a JSON
containing the SHA-256 hash of the data.
hashserver.js is the only .js
file.