Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Scenario [Slide 34] Part 2: Do the Blockchain Activity [Slides 33-53] We are creating a blockchain to develop a distributed ledger to track the sales

Scenario [Slide 34]

Part 2: "Do" the Blockchain Activity

[Slides 33-53]

We are creating a blockchain to develop a distributed ledger to track the sales of a candy bar known as "CB1." Our company sells CB1 at various prices (in U.S. dollars). We want to create immutable record of the sales transactions (i.e., the transactions cannot be altered).

Key information for this activity includes:

We will be tracking the date, time, BuyerID, SellerID, asset type, and transaction amount.

We have three authorized users (Sally, John, and Caroline) with ID numbers of (001, 002, and 003) respectively.

We will be processing five transactions and linking the transactions into a distributed ledger based on blockchain concepts.

To correctly complete block in the blockchain, we must perform a hashing task for each transaction. This task consists of three steps: determine the hash input string, determine an appropriate nonce, and record the results.

Assumptions & Difficulty-Level Restriction [Slide 35]

Simplifying Assumptions

We will only be using the first 8 digits of the hash value in our blockchain

Different fields within a transaction are delimited by a "-"

We only have one transaction per block.

Difficulty-Level Restriction: Hash value results must start with one single leading "0".

For example, the hash vale "0abc1234" abides by restriction but the hash value "1234abc0" does not.

What nonce will work?

In cryptography, a nonce is an arbitrary number that can be used just once in a cryptographic communication.

It is often a random or pseudo-random number issued in an authentication protocol to ensure that old communications cannot be reused in replay attacks.

Transactions

In the following section, you will read each transaction's details and perform the hashing task previously described.

Transaction #1 [Slides 35-37]

Sally buys a CB1 bar from John for $1.25. This will be the first transaction in our blockchain.

Date

Time

Buyer ID

Seller ID

Asset

Amount

Transaction Format

6/18/2019

14:05:00

001

002

CB1

1.25

06182019-14:05:00-001-002-CB1-1.25

Step 1: Determine the Hash Input String

The hash input string consists of {the previous hash + the current transaction + the nonce value}. Note that the three parts of the hash input string (Previous Hash, Current Transaction, Nonce) are delineated by a "+" symbol.

Previous Hash

+

Current Transaction

+

Nonce

00000000

06182019-14:05:00-001-002-CB1-1.25

xxxx

Note: Use "00000000" (no quotes) for the "Previous Hash" field in the first block. This identifies a block as the "genesis" (i.e., first) block.

Corresponding Hash Input:

Step 2: Determine the nonce

Problem: What nonce will work for the "xxxx"? Go to a SHA-256 generator site, e.g.: https://www.xorbin.com/tools/sha256-hash-calculator

Task: Find the value of "xxxx" which will return a hashed value starting with a leading "0"

Hash the "transaction information + xxxx" with various values for "xxxx" until you find a nonce that will return a hashed value with a leading 0. In the table below, a nonce of "0000" returns a hash output with a leading "e." What does a nonce of "0001" and "0002" return? Complete the table below. Hint: Make sure your hash input does not have any extra characters at the end of it, such as a space or a new line. Otherwise, you will get a different hash output.

Hash Input

Hash Output

00000000+06182019-

14:05:00-001-002-

CB1-1.25+0000

00000000+06182019-

14:05:00-001-002-

CB1-1.25+0001

00000000+06182019-

14:05:00-001-002-

CB1-1.25+0002

Step 3: Record the Results

A nonce of "0002" will work in that it returns a hash output with one leading zero (0). Therefore, we will add the transaction to the list; the previous hash block is "00000000"; the current hash is "028848af" (the first 8 digits of the hash output); and the nonce is "0002" as illustrated below.

Record the information below.

A nonce of "0002" is just one of many possible solutions. For example, a nonce of "0007" would also return an output (hash) with a leading 0.

How do you know which nonce to use?

This is part of the proof of work. All of the nodes in the peer-to-peer network are competing to find a nonce. The first nonce that is found meeting the requirement (i.e. one leading zero) is announced to the network and that miner is awarded a "prize." The data associated with that nonce are then incorporated into the chain.

Transaction #2 [Slides 38-39]

The next day (6/19/2019), Sally buys another CB1 bar from John for $1.29.

Date

Time

Buyer ID

Seller ID

Asset

Amount

Transaction Format

6/19/2019

12:05:00

001

002

CB1

1.29

06192019-12:05:00-001-

002-CB1-1.29

Step 1: Determine the Hash Input String

What is the previous hash (the current hash in Block #1)?

What is the Transaction Format for Transaction #2?

What is the hash input string?

Step 2: Determine the nonce

What nonce will work for the "xxxx" to return a hash with one leading zero?

Hint: You can try various digits, but one nonce that will work is between 0030 and 0050.

Step 3: Record the Results

Once you have found a nonce, fill out the information for Block #2:

Transaction #3 [Slides 40-41]

The next day (6/20/2019), Sally buys another CB1 bar from John for $2.99.

Date

Time

Buyer ID

Seller ID

Asset

Amount

Transaction Format

6/20/2019

11:30:00

001

002

CB1

2.99

06202019-11:30:00-001-002- CB1-2.99

Step 1: Determine the Hash Input String What is the previous hash?

What is the Transaction Format for Transaction #3?

What is the hash input string?

Step 2: Determine the nonce

What nonce will work for the "xxxx" to return a hash with one leading zero? Hint: You can try various digits, but one nonce that will work is between 0000 and 0020.

Once you have found a nonce, fill out the information for Block #3: Step 3: Record the results

Rogue Transaction #2X [Slides 42 - 44]

Blockchains are immutable in that transactions cannot be altered. What if someone wants to change the blockchain?

Let's go back to Transaction #2 and attempt to modify the transaction.

ORIGINAL Transaction #2:

The next day (6/19/2019), Sally buys another CB1 bar from John for $1.29

MODIFIED Transaction #2X:

The next day (6/19/2019), Sally buys another CB1 bar from John for $11.29

How can we try to change Transaction #2?

The current blockchain looks like this, with Block #2 containing the price of $1.29. Verify that your values for blocks 1, 2, and 3 match the figure below (assuming you identified the same nonce values).

We now want to modify Block 2 to have a price of $11.29. In Block 2, this will impact the CURRENT HASH and the NONCE, as well as have implications for Block 3.

Step 1: Determine the Hash Input String What is the previous hash?

What is the Transaction Format for Transaction #2?

What is the hash input string?

Step 2: Determine the nonce

What nonce will work for the "xxxx" to return a hash with one leading zero? Hint: One nonce that will work is between 0000 and 0020.

Step 3: Record the results

Blockchain Resulting from Rogue Transaction #2X [Slides 45-46]

The blockchain now looks like the following, but there is a problem with the link between Block 2x and Block 3. The "Previous Block Hash" in Block 3 refers to the original Block 2 (not Block 2x).

What happens if we just try to replace the "Previous Block Hash" in block 3 (0a1b1079) with the "current hash" from Block 2x (0b394db6)?

Hash the following hash input string, which replaces the "Previous Block Hash" in block 3 with the current hash from Block 2X. Note that we are using the nonce of "0012" which is associated with block 3.

Hash Input:

Hash output:

What is the problem with this hash output?

Transaction #3X [Slides 47-48]

Modify Block 3 so that the blockchain will be valid, i.e. the blockchain will include Transaction #1, #2x, and the modified #3 (called #3x).

Block 3X

Step 1: Determine the Hash Input String What is the previous hash?

What is the Transaction Format for Transaction #3X? (Note: this will be the same as Transaction #3)?

What is the hash input string?

Step 2: Determine the nonce

What nonce will work? Hint:nonce will be between "0000" and "0020"

Step 3: Record the results

Two Blockchain Versions. Which Do We Use? [Slide 49]

At this point, there are 2 versions of the blockchain:

Version 1

Version 2

Which version is used?

Remember that each node in the peer-to-peer network contains a copy of the blockchain. All of the nodes contain Version 1 except for the rogue node which contains Version 2.

As only one node contains the rogue transaction, a consensus will be reached by the network that the rogue node is invalid. The nodes in the network will therefore continue using Version 1.

Transaction #4 [Slides 50-51]

For Transactions 4 and 5, use the valid version (Version 1) of the blockchain that does not contain the rogue transactions.

The next day (6/21/2019), Sally buys another CB1 bar from John for $0.99

Date

Time

Buyer ID

Seller ID

Asset

Amount

Transaction Format

6/21/2019

12:00:00

001

002

CB1

0.99

06212019-12:00:00-001-

002-CB1-0.99

Step1: Determine the hash input string What is the previous hash?

What is the Transaction Format for Transaction #4?

What is the hash input string?

Step 2: Determine the nonce

What nonce will work? Hint: A valid nonce will be between "0020" and "0039"

What is the hash output string for the working nonce?

Step 3: Record the results

Transaction #5 [Slides 52-53]

Caroline likes the 0.99 price and buys a CB1 bar from John for $0.99 (same day 6/21/2019, two minutes later)

Date

Time

Buyer ID

Seller ID

Asset

Amount

Transaction Format

6/21/2019

12:02:00

003

002

CB1

0.99

06212019-12:02:00-003-002- CB1-0.99

Step1: Determine the hash input string What is the previous hash?

What is the Transaction Format for Transaction #5?

What is the hash input string?

Step 2:Determine the nonce

Hint: a working nonce will be between "0001 to "0019" What nonce will work?

What is the hash output string for the working nonce?

Step 3: Record the results

Part 3a: "Reflect" and "Think" about the Activity

[Slides 54-59]1.Use the results from the exercise to fill in the table below. [Slides 55-56]

Block #1 has been completed for you.

Block #

Transaction List

Previous Block Hash

Current Hash

Nonce

1

06182019-14:05:00-001-002-CB1-1.25

00000000

028848af

0002

2

06192019-12:05:00-001-002-CB1-1.29

3

06202019-11:30:00-001-002-CB1-2.99

4

06212019-12:00:00-001-002-CB1-0.99

5

06212019-12:02:00-003-002-CB1-0.99

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Intermediate Accounting

Authors: Donald E. Kieso, Jerry J. Weygandt, Terry D. Warfield.

9th Canadian Edition, Volume 2

470964731, 978-0470964736, 978-0470161012

Students also viewed these Accounting questions