Author: Tony Li, Trung Le, Vivien Yan.
Practice working with linked structures by developing our simple implementation of blockchains.
Hash
class is a wrapper class that wraps up a byte array along with some operations we would like to perform on it.Block
class contained each node of the blockchain.BlockChain
is a class of linked structure consisit of all block.BlockChaindriver
allows us to interact with our BlockChain.
The main
method creates a blockchain with the initial dollar amount and then repeatedly:
- Prints out the contents of the blockchain.
- Reads in a command from the user.
- Executes that command, potentially updating the blockchain and reporting back to the user.
valid command include:
mine
: discovers the nonce for a given transactionappend
: appends a new block onto the end of the chainremove
: removes the last block from the end of the chaincheck
: checks that the block chain is validreport
: reports the balances of Alexis and Blakehelp
: prints this list of commandsquit
: quits the program
Acknowlegment: lab on doubliy linked list, eboards, Danny Wen.