| Crates.io | azoth-balancer |
| lib.rs | azoth-balancer |
| version | 0.3.1 |
| created_at | 2025-09-24 09:56:23.859394+00 |
| updated_at | 2025-09-30 07:39:53.134027+00 |
| description | Rust-based high-performance RPC load balancer offering intelligent 3-tier endpoint routing, failover, rate limiting, and monitoring for reliable, low-latency blockchain operations. |
| homepage | https://github.com/AzothSolver/azoth-balancer |
| repository | https://github.com/AzothSolver/azoth-balancer |
| max_upload_size | |
| id | 1852882 |
| size | 449,015 |
.env files/reload endpoint with configurable IP restrictions
⚠️ Experimental Software / Security Notice
AzothBalancer is open-source and usable today, but it is still early-stage software.
- Expect breaking changes, incomplete features.
- Do not expose the service publicly. Run only on localhost or within a private network.
- Keep server ports behind a firewall or bound to
127.0.0.1to avoid external access.- Reload endpoint now has IP whitelisting via
RELOAD_ALLOWED_IPenvironment variable- No TLS/HTTPS or authentication exists yet for the main RPC endpoint
Feedback and contributions are welcome — do not rely on this as your sole production RPC layer.
AzothBalancer is a Rust-based, high-performance JSON-RPC load balancer engineered for blockchain infrastructure. Built with a consistency-first architecture, it guarantees request integrity while fully leveraging Rust's performance for optimal throughput. It delivers the reliability and cost-efficiency required by demanding DeFi applications, featuring a token bucket rate limiter that ensures a seamless client experience. Currently stable at v0.3.1.
/reload endpoint updates endpoints without downtime.env files and environment variables/reload endpoint/metrics exposes health and performance stats with readable endpoint namesAzothBalancer implements a sophisticated 3-tier priority system for optimal endpoint selection:
Tier 1 (Local Nodes | Weight ≥ 100)
Tier 2 (Premium Services | Weight 50–99)
Tier 3 (Free/Public | Weight 1–49)
Key Features:
.env filesCore Infrastructure:
/metrics) with endpoint names/reload)Security & Configuration:
.env file support for environment variablesRELOAD_ALLOWED_IP environment variable for endpoint securityArc<RwLock<...>>)eth_sendRawTransaction) to secure endpoints (eg. MEV Blocker)eth_call, eth_getLogs) to reduce latencycargo install azoth-balancer
After installing, copy the example config and environment template:
curl -O https://raw.githubusercontent.com/AzothSolver/azoth-balancer/main/example.config.toml
curl -O https://raw.githubusercontent.com/AzothSolver/azoth-balancer/main/.env.example
cp .env.example .env
# Edit .env with your RPC endpoints and RELOAD_ALLOWED_IP
Then run:
azoth-balancer --config example.config.toml
Allows you to try AzothBalancer without cloning the repo or building manually.
git clone https://github.com/AzothSolver/azoth-balancer.git
cd azoth-balancer
cp example.config.toml config.toml # Then edit your config
cp .env.example .env # Set up your environment variables
cargo build --release
./target/release/azoth-balancer --config config.toml
Default server: 0.0.0.0:8549
curl -LO https://github.com/AzothSolver/azoth-balancer/releases/download/v0.3.1/azoth-balancer-v0.3.1-x86_64-unknown-linux-gnu.tar.gz
tar -xzvf azoth-balancer-v0.3.1-x86_64-unknown-linux-gnu.tar.gz
./azoth-balancer --config example.config.toml
Allows you to try AzothBalancer immediately without building or installing via Cargo.
You can now configure custom names for your endpoints or use automatic generation:
[[balancer.endpoints]]
name = "quicknode-premium" # Custom name for better observability
url = "${RPC_URL_QUICKNODE}"
rate_limit_per_sec = 25
weight = 100
[[balancer.endpoints]]
# No name specified - will auto-generate: "001_arbitrum_one_public_nodies_app"
url = "https://arbitrum-one-public.nodies.app"
rate_limit_per_sec = 10
weight = 50
Benefits of Endpoint Naming:
quicknode-premium instead of full URLsAzothBalancer supports environment variables for secure configuration management:
Set these in your .env file or environment:
# RPC Endpoint URLs
RPC_URL_QUICKNODE="https://your-quicknode-endpoint"
RPC_URL_ALCHEMY="https://your-alchemy-endpoint"
RPC_URL_INFURA="https://your-infura-endpoint"
# ... and other RPC_URL_* variables
# Security
RELOAD_ALLOWED_IP="127.0.0.1" # IP address allowed to access /reload endpoint
Reference environment variables in your config.toml:
[[balancer.endpoints]]
name = "alchemy-mainnet"
url = "${RPC_URL_ALCHEMY}" # Will be resolved from environment
rate_limit_per_sec = 25
weight = 100
The balancer automatically resolves ${VARIABLE_NAME} placeholders from:
.env file in current directoryThe /reload endpoint is protected by IP whitelisting. Set the allowed IP address:
export RELOAD_ALLOWED_IP="127.0.0.1" # Localhost only (recommended)
# or in your .env file:
# RELOAD_ALLOWED_IP="127.0.0.1"
Unauthorized reload attempts are logged and rejected with HTTP 403.
./target/release/azoth-balancer --config config.toml
# or
cargo run --release -- --config config.toml
config-eth.toml # Ethereum RPC endpoints
config-arbitrum.toml # Arbitrum RPC endpoints
config-solana.toml # Solana RPC endpoints
./target/release/azoth-balancer --config config-arbitrum.toml
Note: Each config must contain RPC endpoints from the same chain.
docker-compose.yml available:docker-compose up --build
AzothBalancer exposes comprehensive metrics at the /metrics endpoint with readable endpoint names. Here's how to set up monitoring:
Add this job to your prometheus.yml:
scrape_configs:
- job_name: "azoth-balancer"
static_configs:
- targets: ["127.0.0.1:8549"] # Adjust host/port if different
metrics_path: /metrics
scrape_interval: 15s
scrape_timeout: 10s
curl -O https://raw.githubusercontent.com/AzothSolver/azoth-balancer/main/grafana-dashboards/azoth-balancer-monitoring-dashboard-beta.json
Create docker-compose.monitoring.yml:
version: "3.8"
services:
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
restart: unless-stopped
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- grafana_data:/var/lib/grafana
- ./grafana-dashboards:/etc/grafana/provisioning/dashboards
restart: unless-stopped
depends_on:
- prometheus
volumes:
prometheus_data:
grafana_data:
And prometheus.yml:
global:
scrape_interval: 15s
scrape_configs:
- job_name: "azoth-balancer"
static_configs:
- targets: ["azoth-balancer:8549"]
metrics_path: /metrics
Run with:
docker-compose -f docker-compose.monitoring.yml up -d
The dashboard provides readable endpoint names in all metrics:
quicknode-premium instead of full URLsThe dashboard automatically detects your endpoints and provides tier-based analytics with the endpoint names you've configured.
Validate your AzothBalancer configuration under realistic conditions with our comprehensive load testing tool.
Features:
Quick Start:
cd load-test
./load-test.sh --help
See Load Testing Documentation for complete usage instructions and examples.
MIT or Apache 2.0
For questions, suggestions, or contributions, please open an issue on GitHub Issues.
.env file handling for secure configuration management/reload endpoint via RELOAD_ALLOWED_IP environment variablename field to endpoint configuration structureconfig.toml for better identification