jito-bundle
Standalone Rust library for submitting Jito Bundles on Solana.
Submit up to 5 transactions that execute atomically and in order — the library handles tip calculation, bundle construction, simulation, endpoint retry, and on-chain confirmation.
Features
- Atomic bundle construction — compile-time max-5 enforcement via
[Option<Vec<Instruction>>; 5] - Automatic tipping — fetches tip floor from Jito API, picks a random tip account, places the tip instruction correctly
- Endpoint retry — tries all 5 Jito geographic endpoints (mainnet, Amsterdam, Frankfurt, New York, Tokyo)
- Helius simulation — optional atomic
simulateBundlebefore sending real SOL - Frontrun protection — optional jitodontfront pubkey support
- Typed errors — 15
thiserrorvariants, no string matching required - Strict lints — clippy pedantic + deny on
unwrap/expect/panicin library code
Requirements
- Rust 1.85+ (edition 2024)
- Solana keypair with SOL for tips
Usage
Via JitoBundler facade (recommended)
use ;
use JitoConfig;
// 1. Configure
let config = new
.with_helius_rpc_url
.with_uuid;
let bundler = new?;
// 2. Fetch current tip floor
let tip_lamports = bundler.fetch_tip.await?;
// 3. Build bundle
let blockhash = bundler.rpc_client.get_latest_blockhash.await?;
let bundle = bundler.build_bundle?;
// 4. Simulate + send + confirm
let result = bundler.send_and_confirm.await?;
println!;
Direct Bundle construction
use ;
let bundle = new.build?;
// bundle.versioned_transaction is ready to encode and send
Configuration
JitoConfig uses a builder pattern:
| Method | Description |
|---|---|
new(rpc_url) |
Required — Solana RPC URL |
.with_network(Network) |
Mainnet (default) or Custom { block_engine_url, tip_floor_url } |
.with_helius_rpc_url(url) |
Enable Helius atomic simulation before sending |
.with_uuid(uuid) |
Jito authentication UUID |
.with_tip_strategy(TipStrategy) |
Fixed(u64), FetchFloor, FetchFloorWithCap { min, max } (default: floor with cap 100k..10M lamports) |
.with_confirm_policy(ConfirmPolicy) |
Polling config (default: 30 attempts, 2s interval) |
.with_jitodontfront(pubkey) |
Enable frontrun protection |
.with_compute_unit_limit(u32) |
Per-tx compute budget (default: 3M) |
Bundle Rules
- Max 5 transactions per bundle
- jitodontfront goes into first tx's
remaining_accounts(non-signer, non-writable) - Tip instruction is always last instruction of last transaction
- If bundle < 5 txs: tip is a separate transaction compiled without LUTs
- If bundle == 5 txs: tip appended inline to last transaction
- LUT validation: rejects bundles where any LUT contains the tip account
- Compute budget instruction prepended to every transaction
Error Handling
All operations return Result<T, JitoError>. Match on specific variants:
use JitoError;
match result
Testing
# Unit tests (16 tests, no network required)
# Integration tests (requires .env with live credentials)
Integration tests need a .env file:
# Required
KEYPAIR_PATH=/path/to/keypair.json
RPC_URL=https://api.mainnet-beta.solana.com
# Optional
HELIUS_RPC_URL=https://mainnet.helius-rpc.com/?api-key=...
JITO_BLOCK_ENGINE_URL=https://mainnet.block-engine.jito.wtf
JITO_UUID=your-uuid
TIP_LAMPORTS=100000
License
MIT