Answered step by step
Verified Expert Solution
Question
1 Approved Answer
16 Task Five. Simplified Blockchain: Simulating Proof of Work (4 marks) In this assignment, your task is to write a simple program for simulating Proof-of-work.
16 Task Five. Simplified Blockchain: Simulating Proof of Work (4 marks) In this assignment, your task is to write a simple program for simulating Proof-of-work. The assumptions on the simulation program are as follows: 1. A blockchain node wants to compute a new block using proof-of-work. 2. SSHA1 (140 bits output) is used for hash. SSHA1 is the most significant 140 bits of the SHA1 algorithm. 3. The program simulate the Proof-of-Work is described below. The program for proof-of-work should perform the following: 1. The program takes at least two parameters as follows: (a) The condition of the hash value of a new valid block (The number of leading zeros). (b) The data newly added to the current block. 2. The program outputs a random nonce value for a new block and hashed value of the new block. 3. The program provides a function to validate the output. This function takes a random nonceand the data as inputs and outputs the hashed value to check the validity of the new block. For example, your program can be executed with the following command ./hashcash limit 4 data new_ledger.txt In the above: 1. limit parameter takes the limit of hashed value of a new block. For example, a blockchain system only accepts a block if the first four digits of hashed value of a new valid block are Os. 2. data parameter takes the name of a file. It contains data newly added to current block. It should be noted that the file (new ledger.txt) must include all necessary information to create a new block. For example, it should include at least transaction records and the hashed value of the last valid block. Note that transaction records can be artificial. This assignment does not mark the validity of the transaction records. 3. The output of the program must be human readable such as hexadecimal format. Also, itsatisfies the condition specified when the program executed. 16 Task Five. Simplified Blockchain: Simulating Proof of Work (4 marks) In this assignment, your task is to write a simple program for simulating Proof-of-work. The assumptions on the simulation program are as follows: 1. A blockchain node wants to compute a new block using proof-of-work. 2. SSHA1 (140 bits output) is used for hash. SSHA1 is the most significant 140 bits of the SHA1 algorithm. 3. The program simulate the Proof-of-Work is described below. The program for proof-of-work should perform the following: 1. The program takes at least two parameters as follows: (a) The condition of the hash value of a new valid block (The number of leading zeros). (b) The data newly added to the current block. 2. The program outputs a random nonce value for a new block and hashed value of the new block. 3. The program provides a function to validate the output. This function takes a random nonceand the data as inputs and outputs the hashed value to check the validity of the new block. For example, your program can be executed with the following command ./hashcash limit 4 data new_ledger.txt In the above: 1. limit parameter takes the limit of hashed value of a new block. For example, a blockchain system only accepts a block if the first four digits of hashed value of a new valid block are Os. 2. data parameter takes the name of a file. It contains data newly added to current block. It should be noted that the file (new ledger.txt) must include all necessary information to create a new block. For example, it should include at least transaction records and the hashed value of the last valid block. Note that transaction records can be artificial. This assignment does not mark the validity of the transaction records. 3. The output of the program must be human readable such as hexadecimal format. Also, itsatisfies the condition specified when the program executed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started