BlockSimPy

A discrete event simulator for blockchain networks that models mining competition, block propagation, difficulty adjustment, and economic incentives. The simulator enables controlled experimentation with blockchain protocols without operating live cryptocurrency nodes. Configurations for Bitcoin, Bitcoin Cash, Litecoin, and Dogecoin are provided.
Installation
pip install blocksimpy
Quick Start
Run a Bitcoin simulation for 100 blocks:
blocksimpy --chain btc --blocks 100
or
bsim --chain btc --blocks 100
Run a custom blockchain:
blocksimpy --blocktime 30 --blocks 50 --miners 5
See all options:
blocksimpy --help
Testing
Validate the simulator works correctly:
python tests/test_validation.py
This runs simulations for Bitcoin, Litecoin, Dogecoin, and Bitcoin Cash, validating that metrics match expected values.
Documentation
Architecture
Configuration guide
License
Apache License 2.0 - see LICENSE for details.