How tathack-tathva/blockchain-simulation works
Blockchain App is a Python peer node for signed transactions, replicated chains, selectable consensus, contracts, and file references stored through IPFS. The user-facing workflow is to start a peer, connect and exchange chain/peer information, submit transactions or contract operations, and have peers validate and add blocks under PoW, PoS, or PoA. The README also documents persistent node data and malicious-node testing. The supplied source excerpts are partial; links for unsampled persistence and contract subsystems are therefore limited to documented capabilities.
Main entry points: pow/p2p.py PoW peer · pos/p2p.py PoS peer · poa/p2p.py PoA peer · ipfs.py IPFS wrapper
Components 18
Peer node
- Peer launcher
start_peer.py
Consensus modes
- PoW peer
consensus/pow/p2p.py - PoS peer
consensus/pos/p2p.py - PoA peer
consensus/poa/p2p.py - PoW structures
consensus/pow/blockchain_structures.py - PoS structures
consensus/pos/blockchain_structures.py - PoA structures
consensus/poa/blockchain_structures.py - Shared structures
shared_blockchain_structures.py
Smart contracts
- Contract database
smart_contract/contracts_db.py - Contract runtime
smart_contract/smart_contract.py - Secure executor
smart_contract/secure_executor.py - Sandbox runner
smart_contract/sandbox_runner.py - Gas meter
smart_contract/gas_meter.py
External storage
- IPFS wrapper
ipfs/ipfs.py - IPFS network
- Node persistence
storage/storage_manager.py
Other components
- User
- Other peers
Connections 21
- User → Peer launcher: starts peer
- User → PoW peer: uses PoW
- User → PoS peer: uses PoS
- User → PoA peer: uses PoA
- PoW peer → PoW structures: uses structures
- PoS peer → PoS structures: uses structures
- PoA peer → PoA structures: uses structures
- PoW structures → Shared structures: inherits common model
- PoS structures → Shared structures: inherits common model
- PoA structures → Shared structures: inherits common model
- PoW peer → Other peers: exchanges messages
- PoS peer → Other peers: exchanges messages
- PoA peer → Other peers: exchanges messages
- PoW peer → IPFS wrapper: calls file operations
- PoS peer → IPFS wrapper: calls file operations
- PoA peer → IPFS wrapper: calls file operations
- IPFS wrapper → IPFS network: adds or fetches files
- PoW peer → Contract database: imports database
- PoS peer → Contract database: imports database
- Contract runtime → Gas meter: measures execution
- Secure executor → Sandbox runner: runs in process