Skip to content

mojtaba-esk/mempool-mini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mempool Mini

A minimal transaction mempool with block production. Transactions are prioritized by fee and timestamp.

Quick Start

Build

make build

Run Server

make run
# or with config
./bin/mempool start --port 8080 --max-gas 1000000 --max-tx-count 100 --block-interval 1

Transaction Commands

Add Transaction

./bin/mempool tx add \
    --sender "sender123" \
    --recipient "recipient123" \
    --payload "data" \
    --fee 100 \
    --gas 21000

List Transactions

./bin/mempool tx list

Query Commands

Status

./bin/mempool query status

All client commands support a --server flag to connect to a remote server:

./bin/mempool tx list --server http://remote-server:8080

Testing

# Run unit tests
make test-unit

# Run performance tests (100K transactions)
make test-performance

# Run all tests
make test

Features

  • 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

Architecture

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

Limitations

Not included:

  • Persistent storage
  • Network consensus
  • Advanced transaction validation
  • Fee estimation
  • Transaction replacement policies
  • Priority queue optimizations for very large mempools

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages