Boltzmann is a REST API built with Rust, axum, and alloy-rs that provides insights into gas and fee costs for EVM blockchain transactions. Whether you're building a DeFi application, optimizing transaction timing, or simply want to understand gas dynamics, Boltzmann gives you the data you need to make informed decisions.
- Transaction Simulation: Simulate any EVM transaction (P2P transfers, ERC-20, NFTs, smart contract interactions, blob transactions)
- Multi-Speed Analysis: Compare costs across different confirmation speeds (slow, average, fast)
- EIP Support: Full compatibility with EIP-1559, EIP-3198, and EIP-4844
- Multi-Currency Pricing: Get costs in native ETH or fiat currencies (USD, EUR, CHF, etc.)
- Real-time Subscriptions: Monitor gas costs continuously with customizable intervals
- Historical Analytics: Track gas price trends and optimize transaction timing
- Multi-Chain Support: Works across all EVM-compatible networks
Boltzmann follows a domain-driven design with a modular Rust architecture:
boltzmann/
├── src/
│ ├── domains/ # Business logic domains
│ │ ├── crypto/ # Cryptocurrency price providers
│ │ │ ├── coingecko.rs # CoinGecko integration
│ │ │ ├── coinmarketcap.rs # CoinMarketCap integration
│ │ │ └── mod.rs # Core crypto types
│ │ └── gas/ # Gas price oracles
│ │ └── price/ # Gas price providers
│ │ ├── etherscan.rs # Etherscan gas oracle
│ │ ├── alloy.rs # Alloy RPC gas oracle
│ │ └── mod.rs # Gas oracle types
│ ├── api/ # HTTP layer
│ │ └── routes/ # API route handlers
│ │ ├── crypto.rs # Crypto price endpoints
│ │ ├── gas.rs # Gas price endpoints
│ │ └── mod.rs # Router setup
│ ├── core/ # Core application
│ │ ├── config.rs # Configuration management
│ │ ├── server.rs # Server initialization
│ │ └── mod.rs # Core module root
│ ├── main.rs # Application entry point
│ └── lib.rs # Library root
├── assets/ # Project assets
├── Dockerfile # Container configuration
├── docker-compose.yml # Container Compose setup
├── Cargo.toml # Package configuration
├── .env # Environment variables
└── README.md
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Client Apps │ │ Boltzmann │ │ External APIs │
│ │ │ API │ │ │
│ • Web Apps │◄──►│ │◄──►│ • CoinGecko │
│ • Mobile Apps │ │ • Gas Oracle │ │ • CoinMarketCap│
│ • DeFi Dapps │ │ • Simulator │ │ • RPC Nodes │
│ • Trading Bots │ │ • Subscriptions│ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Check if the API server is running.
Response:
Boltzmann API is running
Get current ETH prices from multiple providers.
Query Parameters:
amount(optional): Number of ETH tokens (default: 1)currency(optional): Target currency - USD, EUR, CHF, CNY, GBP, JPY, CAD, AUD (default: USD)
Example:
curl "http://localhost:3000/api/v1/price/prices?amount=5¤cy=EUR"Get current Ethereum gas price estimates.
Query Parameters:
provider(optional): Gas oracle provider - "etherscan" or "alloy" (default: etherscan)
Example:
curl "http://localhost:3000/api/v1/gas/prices?provider=alloy"The following advanced features are planned for future releases:
- Transaction Simulation:
POST /api/v1/simulate- Simulate EVM transactions - Batch Operations:
POST /api/v1/simulate/batch- Multiple transaction simulation - Subscriptions: Real-time monitoring with webhooks
- Historical Data: Gas price trends and analytics
- Multi-Chain: Support for Polygon, Arbitrum, and other EVM chains
- Podman & Podman Compose (recommended)
- OR Docker & Docker Compose (alternative)
- OR Rust 1.75+ for local development
# Clone the repository
git clone https://github.com/pxlvre/boltzmann.git
cd boltzmann
# Create environment file from template
cp .env.example .env
# Edit .env with your API keys (see Configuration section below)
vim .env
# Start with Podman Compose
podman-compose up -d
# Check if it's running
curl http://localhost:3000/api/v1/health# Clone the repository
git clone https://github.com/pxlvre/boltzmann.git
cd boltzmann
# Create environment file
cp .env.example .env
# Configure your environment variables (see below)
vim .env
# Build and run
cargo build --release
cargo run# Build the image
podman build -t boltzmann-api .
# Run with Podman Compose (recommended)
podman-compose up -d
# Run standalone container
podman run -p 3000:3000 \
-e COINMARKETCAP_API_KEY=your_key \
-e COINGECKO_API_KEY=your_key \
-e ETHERSCAN_API_KEY=your_key \
-e ETHEREUM_RPC_URL=your_rpc_url \
boltzmann-api
# View logs
podman-compose logs -f boltzmann-api
# Stop services
podman-compose down# Build the image
docker build -t boltzmann-api .
# Run with Docker Compose
docker-compose up -d
# Run standalone container
docker run -p 3000:3000 \
-e COINMARKETCAP_API_KEY=your_key \
-e COINGECKO_API_KEY=your_key \
-e ETHERSCAN_API_KEY=your_key \
-e ETHEREUM_RPC_URL=your_rpc_url \
boltzmann-api
# View logs
docker-compose logs -f boltzmann-api
# Stop services
docker-compose downCreate a .env file with the following environment variables:
# Server Configuration
HOST=127.0.0.1 # Use 0.0.0.0 for Docker
PORT=3000
# API Keys (at least one price provider required)
COINMARKETCAP_API_KEY=your-coinmarketcap-key # Get from: https://coinmarketcap.com/api/
COINGECKO_API_KEY=your-coingecko-key # Get from: https://www.coingecko.com/en/api
# Gas Price Providers
ETHERSCAN_API_KEY=your-etherscan-key # Optional - Get from: https://etherscan.io/apis
ETHEREUM_RPC_URL=your-rpc-url # Required - Get from Infura, Alchemy, etc.Required Configuration:
- At least one of
COINMARKETCAP_API_KEYorCOINGECKO_API_KEY ETHEREUM_RPC_URLfor gas price functionality
Getting API Keys:
- CoinMarketCap: https://coinmarketcap.com/api/ (free tier available)
- CoinGecko: https://www.coingecko.com/en/api (free tier available)
- Etherscan: https://etherscan.io/apis (optional, free tier available)
- Ethereum RPC: Infura, Alchemy, or any Ethereum JSON-RPC endpoint
curl http://localhost:3000/api/v1/health# Get 1 ETH price in USD (default)
curl http://localhost:3000/api/v1/price/prices
# Get 5 ETH price in EUR
curl "http://localhost:3000/api/v1/price/prices?amount=5¤cy=EUR"Response:
[
{
"coin": "ETH",
"currency": "USD",
"price": 4164.82,
"provider": "coinmarketcap",
"quote_per_amount": {
"amount": 1.0,
"total_price": 4164.82
},
"timestamp": "2025-10-27T15:30:00Z"
},
{
"coin": "ETH",
"currency": "USD",
"price": 4162.15,
"provider": "coingecko",
"quote_per_amount": {
"amount": 1.0,
"total_price": 4162.15
},
"timestamp": "2025-10-27T15:30:00Z"
}
]# Get gas prices from Etherscan (default)
curl http://localhost:3000/api/v1/gas/prices
# Get gas prices from Alloy RPC
curl "http://localhost:3000/api/v1/gas/prices?provider=alloy"Response:
{
"gas_price": {
"low": 2.361777,
"average": 2.402917,
"high": 2.798484,
"timestamp": "2025-10-27T15:30:00Z"
},
"provider": "etherscan"
}- USD - US Dollar
- EUR - Euro
- CHF - Swiss Franc
- CNY - Chinese Yuan
- GBP - British Pound
- JPY - Japanese Yen
- CAD - Canadian Dollar
- AUD - Australian Dollar
- etherscan - Etherscan Gas Tracker API (default)
- alloy - Direct Ethereum RPC via Alloy
The application is organized with modular components:
- Gas Price Oracle: Fetches current gas prices from multiple sources
- Transaction Simulation: Simulates transaction costs across different scenarios
- Fee Calculation: Implements EIP-1559, EIP-3198, and EIP-4844 fee structures
- Price Conversion: Integrates with CoinGecko/CoinMarketCap for fiat conversion
- REST API: Provides HTTP endpoints for all functionality
- Subscription System: Real-time monitoring and webhooks
cargo testcargo buildStart the server and visit http://localhost:8080/docs for interactive API documentation.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
- Ethereum Mainnet (Chain ID: 1)
More chains coming soon!
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.
The choice of AGPL-3.0 aligns with the principles outlined by Vitalik Buterin in his post "Why I used to prefer permissive licenses and now favor copyleft", ensuring that improvements and derivatives remain open and accessible to the community.
