class Block:
def __init__(self, data, previous_hash):
self.data = data
self.previous_hash = previous_hash
self.hash = self.calculate_hash()
def calculate_hash(self):
# Use a cryptographic hash function to generate a unique hash for the block
pass
class Blockchain:
def __init__(self):
self.chain = [self.create_genesis_block()]
def create_genesis_block(self):
# Create the first block in the blockchain
pass
def add_block(self, data):
# Add a new block to the blockchain with the given data
pass
# Create a new blockchain
blockchain = Blockchain()
# Add a few blocks to the blockchain
blockchain.add_block("Block 1")
blockchain.add_block("Block 2")
blockchain.add_block("Block 3")
# Print the contents of the blockchain
for block in blockchain.chain:
print(block.data)