BCT 1a
BCT 1a
BCT 1a
Objective: Understand the core concepts of how a blockchain works. Task: Write code
in Python or JavaScript to simulate a simple blockchain. Implement features like
block creation, adding transactions, proof-of-work (PoW), and validating the chain.
Test your blockchain by adding transactions and creating blocks. Deliverables: The
code of the blockchain. A report explaining the functionality of the blockchain.
CODE:
import hashlib
import time
5. Mining Reward
When a block is successfully mined, the miner is rewarded with a fixed amount of
cryptocurrency. The reward transaction is added as the first transaction in the next
block.
Testing the Blockchain
In the test section, two blocks are mined, each with a set of transactions. After mining,
the blockchain is validated to check its integrity.