This program is where we put everything together. There are three data files of transactions, Data1.txt, etc. You will create three files in a blockchain, Block1.txt, Block2.txt and Block3.txt.
The format of the block file (everything is in text so that it’s human readable)
Line1: Hash of the whole block (previous block has plus root of the Merkle Tree).Line 2: The nonce.Line 3: Merkle tree contents on one line separated by tabs.Line 4: Previous block hash (for block 1, the previous has is 0xabcdef89).The rest of the file is the data read from the data file.
For example, here’s Block1.txt:
You have all the pieces you need to do this from your previous homework assignments. Text I/O is discussed in the textbook, pp 475-486. You may find slides 2 and 3 from Bitcoin lecture #4 helpful.
Name your file HW5_<YourName>.java. You may find it useful to define a Block class. Do this at the end of your main java file so that you have only one file to turn in. Post only your single .java file to Blackboard. Do not post your results, zipped files or project folders.