18.104.22.168 Lab – Blockchain Demo 2.0 (Instructor Version)
Instructor Note: Red font color or gray highlights indicate text that appears in the instructor copy only.
- Complete the Blockchain Demo 2.0
- Complete Reflection Questions
Background / Scenario
Blockchain is the technology behind the cryptocurrency, bitcoin. It uses a distributed database to cryptographically secure transaction. Blockchain transactions are immutable.
In this lab, you will complete the Blockchain Demo 2.0 created by freeCodeCamp and answer some questions about this technological innovation.
Instructor Note: Students should still be able to complete this lab if the website link is broken or no longer available.
- A computer with Internet access
Complete the Blockchain Demo 2.0
Go to either of the following websites to learn more about blockchain:
Alternatively, you can answer the reflection questions by researching them on your own.
1. What is the name of the first block created in a blockchain and what is its index value?
The first block is called the genesis block and its index value is 0.
2. List the six pieces of information stored in a block.
Each block includes the following information: index, timestamp, hash, previous hash, data, and nonce.
3. What is the purpose of the timestamp?
The timestamp is used to order the blockchain transactions.
4. Describe the properties of the hash used in a blockchain.
Hash values have a fixed number of hexadecimal values. The same hash will always convert to the same data. The hash is easy to compute but infeasible for a threat actor to convert to data. A small change the data results in a big change in the hash.
5. Assume that f = hash function. Write the formula used to calculate the hash for the following block:
index = 5
previous hash = 000dc75a315c7…
timestamp = 1529514000
data = $1000.00
nonce = 714
f(5 + 000dc75a315c7 + 1529514000 + “$1000.00” + 714) = new hash
6. What is the purpose of the nonce?
The nonce is the number used to calculate a valid hash. This is the part of the hash function that consumes the most processing power.
7. What are the four requirements a new block must meet in order to be valid?
The four requirements for a valid block are as follows:
• The index value must be one greater than last block’s index.
• The previous hash value must be equal to last block’s hash.
• The block must meet the difficulty requirement.
• The block’s hash must be calculated correctly.
8. What type of global network does blockchain use?
Blockchain uses a peer-to-peer network.
9. How does a peer determine who has the most up-to-date blockchain?
The peer with the longest valid chain of blocks takes precedent over all other peers.
10. How does a peer make sure all other peers have the latest and longest blockchain?
The peer broadcasts its latest blocks to all its peers. The timestamp determines who has the latest block.
11. Why is blockchain considered immutable?
As more blocks are added to the blockchain, early blocks become harder to hack. The hacker would have to mine faster than the rest of the network, which would take massive processing power. In addition, the hacker would have to own 51% or more of the peers.