Kabu is a backrunning bot, currently under heavy development. It continues the journey of loom. Since then many breaking changes have been made to revm, reth and alloy. The goal here is to make everything work again and modernize the codebase. Currently, Kabu is a work in progress and not yet ready for production use.
For everyone that does not like to reinvent the wheel all the time. Have foundation to work with, extend it, rewrite it or use it as playground to learn about MEV and backrunning.
- Kabu will only support exex and json-rpc.
- We reuse as much as possible from reth, alloy and revm
- We keep as close as possible to the architecture of reth
- Remove
KabuDataTypes - Remove
Actormodel and use trait based components like in reth - Remove topology and simplify the config / codebase
- Refactor the extra db pool cache layer to make it optional
- Have components that can be replaced with custom implementations
Find the Kabu contract here.
In Japanese, kabu (株) means "stock" — both in the financial sense and as a metaphor for growth.
- Rust
- Optional: PostgreSQL (for database)
- Optional: InfluxDB (for metrics)
- RPC node (e.g. your own node)
-
Clone the repository:
git clone https://github.com/cakevm/kabu.git cd kabu -
Build the project:
# Development build make # Release build (optimized) make release # Maximum performance build make maxperf
-
Create configuration file:
cp config.example.toml config.toml
-
Edit
config.toml:[clients.local] url = "ws://localhost:8545" # Your node endpoint [database] url = "postgresql://kabu:kabu@localhost/kabu" [actors.signers] # Add your signer configuration [actors.broadcaster] flashbots_signer = "0x..." # Your flashbots signer
-
Set up environment variables:
# .env file DATABASE_URL=postgresql://kabu:kabu@localhost/kabu MAINNET_WS=wss://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY DATA=your_encrypted_private_key # Optional: for signing
-
Create the database and user:
sudo -u postgres psql CREATE DATABASE kabu; CREATE USER kabu WITH PASSWORD 'kabu'; \c kabu; CREATE SCHEMA kabu AUTHORIZATION kabu; GRANT ALL PRIVILEGES ON DATABASE kabu TO kabu; ALTER ROLE kabu SET search_path TO kabu, public; \q
-
Set environment variables:
# Create .env file echo "DATABASE_URL=postgresql://kabu:kabu@localhost/kabu" >> .env
-
Run migrations:
# Migrations will run automatically on first startup # Or manually run: diesel migration run --database-url postgresql://kabu:kabu@localhost/kabu
# Run with remote node
cargo run --bin kabu -- remote --kabu-config config.toml
# Run with local Reth node
cargo run --bin kabu -- node --kabu-config config.toml# Start Reth with Kabu ExEx
reth node \
--chain mainnet \
--datadir ./reth-data \
--kabu-config config.toml# Run specific test
cargo run --bin kabu-backtest-runner -- \
--config ./testing/backtest-runner/test_18567709.toml
# Run all tests
make swap-test-all-
Format code:
make fmt
-
Run linter:
make clippy
-
Run tests:
make test -
Pre-release checks:
make pre-release
-
Clean unused dependencies:
make udeps
-
Build the book:
make book
-
Test book examples:
make test-book
-
Serve book locally:
make serve-book # Opens at http://localhost:3000 -
Build API documentation:
make doc
Many thanks to dexloom! This project is a hard-fork from loom, based on this branch. The flashbots crate is fork of ethers-flashbots. The uniswap-v3-math crate is a fork of uniswap-v3-math. Additionally, some code for the Uniswap V3 pools is derived from amms-rs. Last but not least, a big shoutout to Paradigm — without their work, this project would not have been possible.
This project is licensed under the Apache 2.0 or MIT.
