A minimal transaction mempool with block production. Transactions are prioritized by fee and timestamp.
make buildmake run
# or with config
./bin/mempool start --port 8080 --max-gas 1000000 --max-tx-count 100 --block-interval 1./bin/mempool tx add \
--sender "sender123" \
--recipient "recipient123" \
--payload "data" \
--fee 100 \
--gas 21000./bin/mempool tx list./bin/mempool query statusAll client commands support a --server flag to connect to a remote server:
./bin/mempool tx list --server http://remote-server:8080# Run unit tests
make test-unit
# Run performance tests (100K transactions)
make test-performance
# Run all tests
make test- Buffered mempool with pre-sorted block buffer
- Interval-based block production
- Fee-based priority ordering (timestamp tiebreaker)
- Gas and transaction count validation
- REST API for transaction and block management
The codebase is organized into:
- Mempool: Maintains transactions in a map with a pre-sorted buffer for the next block
- Block Builder: Selects transactions from the buffer respecting gas and count limits
- Block Producer: Automatically produces blocks at configured intervals
- Basic Validator: Validates transactions and blocks before inclusion
Not included:
- Persistent storage
- Network consensus
- Advanced transaction validation
- Fee estimation
- Transaction replacement policies
- Priority queue optimizations for very large mempools