Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

What is your national origin/ethnicity/ancestry?

Answered: 1 week ago

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago