Question: Q4. Mining (18 points] The hash target is used in mining. It is a number that a block hash must be below for the block

 Q4. Mining (18 points] The hash target is used in mining.

Q4. Mining (18 points] The hash target is used in mining. It is a number that a block hash must be below for the block to be valid in order for it to be added on to the blockchain. Assume that the hash target is 256=243. In other words, each block hash has to start with 8 zeros (as the most significant bits). To hash a block, the fields are concatenated in the same order. For example, the "Current Block Hash" for the block with ID=1 is the hash of the value "1002262Ahmad". a. [6 points) Fill replace "???" by appropriate values to make the blockchain a valid one. Head Hash: Head Pointer: ??? 4 Prex ID Prex Hash Nonce Data Current Block Hash 2 ??? ??? Hessa ??? 001ecdf2e0b2b7b7c51701385d99d58eaeccbabea16061a0ef2cfb91f0308336 ID Prex ID Prex Hash Nonce Data Current Block Hash ??? $$Name$$ ??? 0 A null Prex ID Prex Hash Nonce Data Current Block Hash 0 2261 Ahmad 001ecdf2e0b2b7b7c51701385d99d58eaeccbabea16061 a0ef2cfb91fb308336 b. [6 points] Find the average time for mining a block for each of the following hash targets. Measure the time in terms of both the number of hash computations as well as in seconds on your machine. Report your results as an average for mining 10 different blocks. Fill the table below. 1. Hash target = 28 2. Hash target = 212 3. Hash target = 216 Hash Target Average number of hash computations to mine a block (average over 10 blocks) Average time in seconds to mine a block (average over 10 blocks) 28 = 256 212= 4,096 216= 65,536 c. [6 points) Show the source code of a full program to mine one block. The block follows the format of the blocks shown in part (a) of this question. In the program, you initialize the values of the fields ID Prev ID Prev Hash Data It computes and prints the Nonce and the Current Block Hash values. You can use a programming language of your choice. Q4. Mining (18 points] The hash target is used in mining. It is a number that a block hash must be below for the block to be valid in order for it to be added on to the blockchain. Assume that the hash target is 256=243. In other words, each block hash has to start with 8 zeros (as the most significant bits). To hash a block, the fields are concatenated in the same order. For example, the "Current Block Hash" for the block with ID=1 is the hash of the value "1002262Ahmad". a. [6 points) Fill replace "???" by appropriate values to make the blockchain a valid one. Head Hash: Head Pointer: ??? 4 Prex ID Prex Hash Nonce Data Current Block Hash 2 ??? ??? Hessa ??? 001ecdf2e0b2b7b7c51701385d99d58eaeccbabea16061a0ef2cfb91f0308336 ID Prex ID Prex Hash Nonce Data Current Block Hash ??? $$Name$$ ??? 0 A null Prex ID Prex Hash Nonce Data Current Block Hash 0 2261 Ahmad 001ecdf2e0b2b7b7c51701385d99d58eaeccbabea16061 a0ef2cfb91fb308336 b. [6 points] Find the average time for mining a block for each of the following hash targets. Measure the time in terms of both the number of hash computations as well as in seconds on your machine. Report your results as an average for mining 10 different blocks. Fill the table below. 1. Hash target = 28 2. Hash target = 212 3. Hash target = 216 Hash Target Average number of hash computations to mine a block (average over 10 blocks) Average time in seconds to mine a block (average over 10 blocks) 28 = 256 212= 4,096 216= 65,536 c. [6 points) Show the source code of a full program to mine one block. The block follows the format of the blocks shown in part (a) of this question. In the program, you initialize the values of the fields ID Prev ID Prev Hash Data It computes and prints the Nonce and the Current Block Hash values. You can use a programming language of your choice

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!