#Block Chain Dev
- index
- hash
- prev hash
- timeStamp
- ledger
hashes the block
generates new block- takes in previous block, builds last and current hash, passes them in to new Block()
checks the index of the most recent block, the hash of the previous block against the stored hash of the previous block, and rehashes the newest block and ensures it matches the stored hash. Also checks that newest block contains all required properties.
- Root
pushes the entire chain to temp storage in everyones server for length comparisons
checks the geneseis block, calls the isValidBlock function on all the other blocks
Stores an array of all met servers
the most current longest chain that has been approved by the collection of servers. All new blocks are built onto this.
chains that are competing for longest chain get stored here and compared with each other. Once a majority of servers accept one chain as both the first and the longest chain, that chain becomes the Stable Chains
- made to socket list
whenever a server connects- it requests the longest chain
when a server generates a new block- it sends it to the other servers
copies another peers sockets
adds sockets to peers
adds sockets to peers