Skip to content

Latest commit

Β 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧱 Blockchain Simulation in Python

Screenshot 2025-06-01 at 9 10 36 p m

This project simulates a simplified blockchain system using Python and Streamlit. It includes the main components of a blockchain: users with wallets, transactions, UTXO handling, mining with Proof of Work (PoW), block creation, and an interactive interface.


πŸš€ Implemented Features

πŸ’³ Wallets and Keys

  • Each user has a private/public key pair (ECDSA over secp256k1).
  • The address is generated as the SHA-256 hash of the public key.

πŸ“€ Transactions and UTXO

  • UTXO-based model to track balances and transfers.
  • Digital signatures to authorize transactions.
  • Support for mining fees.

πŸ”— Blocks and Blockchain

  • Each block contains valid transactions, the previous hash, timestamp, and nonce.

⛏️ Genesis Block and Mining

  • The genesis block delivers 1000 coins to the first user.
  • Simplified proof of work: the hash must start with a certain number of zeros.
  • Block rewards + fees are granted to the miner through a coinbase transaction.

πŸ’» Streamlit Interface

  • Create a new system or load an existing one
  • View system summary
  • Create new wallets
  • Send transactions
  • Mine blocks
  • Visualize the blockchain
  • View user balances
  • Save the system

πŸ“‚ Project Structure

README.md
└── src
    β”œβ”€β”€ Block.py                     # Block definition and hashing
    β”œβ”€β”€ BlockchainSimulation.py      # Streamlit interface logic
    β”œβ”€β”€ System.py                    # System controller (users, transactions, mining)
    β”œβ”€β”€ Transaction.py               # Transaction logic, signatures, and validation
    β”œβ”€β”€ UTXO.py                      # Unspent Transaction Output (UTXO) model
    └── User.py                      # Wallet and key management

πŸ“š Technologies Used

  • Python 3.11
  • Streamlit
  • ECDSA (Elliptic Curve Cryptography)
  • SHA-256 hashing
  • Pandas (for data visualization)

πŸŽ₯ System Demo

Click here to watch the demo video

About

Simulation of the complete flow of a blockchain.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages