Home
Projects
elviromercic23-cmyk
codespaces-react
elviromercic23-cmyk/codespaces-react
0
stars
0
forks
0
watchers
JavaScript
MIT License
View on GitHub
1 Open Issue Need Help
Last updated: Sep 16, 2025
Open Issues Need Help
View All on GitHub
from block import Block # Create the genesis block (first block in the chain) genesis_block = Block(index=0, previous_hash="0", data="Genesis Block") # Initialize the blockchain with the genesis block blockchain = [genesis_block] # Function to add a new block to the chain def add_block(data): previous_block = blockchain[-1] new_index = previous_block.index + 1 new_block = Block(index=new_index, previous_hash=previous_block.hash, data=data) blockchain.append(new_block) # Add a few blocks add_block("Second block data") add_block("Third block data") add_block("Fourth block data") # Print the blockchain for block in blockchain: print(f"Index: {block.index}") print(f"Timestamp: {block.timestamp}") print(f"Data: {block.data}") print(f"Previous Hash: {block.previous_hash}") print(f"Hash: {block.hash}") print("-" * 40)
about 2 months ago
bug
documentation
duplicate
enhancement
help wanted
good first issue
question
elviromercic23-cmyk/codespaces-react
0
JavaScript