Setup & Installation
This guide will help you download, build, and run The Beaconator REST API service.
Install Rust
If you don't have Rust installed:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shInstall the nightly toolchain:
rustup toolchain install nightly
rustup default nightlyVerify installation:
rustc --version
cargo --versionDownload The Beaconator
Clone the repository:
git clone https://github.com/StrobeLabs/the-beaconator
cd the-beaconatorConfigure Environment
Copy the example environment file:
cp env.example .envEdit .env with your settings. See the Environment Variables section below for the full reference.
Minimum required variables:
# RPC endpoint
RPC_URL=https://mainnet.base.org
# Funding wallet private key (without 0x prefix)
# Used for guest wallet funding and ECDSA signing
PRIVATE_KEY=your_private_key_here
# Wallet pool private keys (comma-separated, without 0x prefix)
# These wallets are used for sending transactions
WALLET_PRIVATE_KEYS=key1,key2,key3
# Environment type
ENV=mainnet # or testnet/localnet
# API authentication
BEACONATOR_ACCESS_TOKEN=your_secret_token
# Redis URL for wallet pool coordination
REDIS_URL=redis://127.0.0.1:6379
# Contract addresses (Base mainnet)
BEACON_FACTORY_ADDRESS=0x...
PERPCITY_REGISTRY_ADDRESS=0x...
PERP_MANAGER_ADDRESS=0x...
USDC_ADDRESS=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
MULTICALL3_ADDRESS=0xcA11bde05977b3631167028862bE2a173976CA11
# Perp module addresses
FEES_MODULE_ADDRESS=0x...
MARGIN_RATIOS_MODULE_ADDRESS=0x...
LOCKUP_PERIOD_MODULE_ADDRESS=0x...
SQRT_PRICE_IMPACT_LIMIT_MODULE_ADDRESS=0x...Never commit your .env file to version control. It contains your private key and API tokens.
Build The Project
Build in development mode:
make buildFor optimized production build:
make build-releaseBuild times:
- First build: 5-10 minutes (downloads dependencies)
- Subsequent builds: 1-2 minutes (with caching)
Run The Server
Start the development server:
make devThe server will start on http://localhost:8000
You should see output like:
🚀 Rocket has launched from http://0.0.0.0:8000Verify Installation
Test the API is running:
curl http://localhost:8000/You should see the welcome page with API documentation.
Run Tests
Run unit tests:
make test-unitRun integration tests (requires Anvil):
# Install Foundry first
curl -L https://foundry.paradigm.xyz | bash
foundryup
# Run integration tests
make test-integrationRun all tests:
make testUnit tests run in parallel, but integration tests run single-threaded to avoid conflicts with Anvil (local blockchain).
Available Make Commands
View all available commands:
make helpCommon commands:
make build- Build in development modemake build-release- Build optimized releasemake dev- Run development servermake test- Run all testsmake test-unit- Run unit tests onlymake test-integration- Run integration testsmake quality- Run quality checksmake lint- Run linter
Docker Deployment
Build Docker image:
docker build -t beaconator .Run with Docker:
docker run -p 8000:8000 --env-file .env beaconatorThe Dockerfile is optimized for Railway deployment with:
- Cargo build caching
- Dependency caching
- Optimized build times
Troubleshooting
Build Errors
If you encounter build errors:
- Update Rust:
rustup update nightly - Clean build:
cargo clean && make build - Check Rust version: Ensure you're on nightly
Anvil Issues (Integration Tests)
If integration tests fail:
# Kill any existing Anvil instances
pkill -9 anvil
# Run cleanup script
./scripts/cleanup_anvil.sh
# Try tests again
make test-integrationRPC Connection Errors
If you see RPC errors:
- Check RPC_URL: Ensure it's a valid Base RPC endpoint
- Test connection:
curl $RPC_URL -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' - Try alternative RPC: Use Alchemy, Infura, or QuickNode
Port Already in Use
If port 8000 is already in use:
# Find and kill process on port 8000
lsof -ti:8000 | xargs kill -9
# Or change port in Rocket.tomlEnvironment Variables
Complete reference for all configuration options.
Required Variables
| Variable | Description |
|---|---|
RPC_URL | Base chain RPC endpoint (e.g. https://sepolia.base.org) |
PRIVATE_KEY | Wallet private key without 0x prefix |
ENV | mainnet (chain 8453), testnet (chain 84532), or localnet (chain 84532) |
BEACONATOR_ACCESS_TOKEN | Bearer token for API authentication |
BEACON_FACTORY_ADDRESS | Beacon factory contract address |
PERPCITY_REGISTRY_ADDRESS | PerpCity registry contract address |
PERP_MANAGER_ADDRESS | Perp manager contract address |
USDC_ADDRESS | USDC token address |
REDIS_URL | Redis URL for wallet pool coordination |
WALLET_PRIVATE_KEYS | Comma-separated wallet private keys for transaction pool |
Optional Variables
| Variable | Default | Description |
|---|---|---|
MULTICALL3_ADDRESS | 0xcA11bde05977b3631167028862bE2a173976CA11 | Multicall3 contract for batch operations |
USDC_TRANSFER_LIMIT | 1000000000 (1000 USDC) | Max USDC per guest wallet transfer |
ETH_TRANSFER_LIMIT | 10000000000000000 (0.01 ETH) | Max ETH per guest wallet transfer |
FEES_MODULE_ADDRESS | (none) | Fees configuration module address |
MARGIN_RATIOS_MODULE_ADDRESS | (none) | Margin ratios module address |
LOCKUP_PERIOD_MODULE_ADDRESS | (none) | Lockup period module address |
SQRT_PRICE_IMPACT_LIMIT_MODULE_ADDRESS | (none) | Price impact limit module address |
BEACONATOR_INSTANCE_ID | auto-generated UUID | Instance ID for distributed wallet locking |
SENTRY_DSN | (none) | Sentry DSN for error tracking |