Prerequisites
Infrastructure requirements
Each Bridge Hub component has specific compute requirements:| Component | CPU | RAM | Notes |
|---|---|---|---|
| API | 2+ vCPU | 4 GB | Per instance |
| Consumer | 2+ vCPU | 4 GB | Per network |
| Auto-Claim | 1+ vCPU | 2 GB | Per destination |
Software requirements
- Bun >= 1.0.0
- MongoDB >= 4.4
- Docker (optional; for containerized deployment)
- Kubernetes (optional; for orchestrated deployment)
External services
- Bridge Service API access for each network you plan to index.
- Blockchain RPC endpoints from a reliable provider.
- Sentry account (optional) for error tracking.
Build
From the repository root, install dependencies and create production builds:packages/api/dist/, packages/consumer/dist/, and packages/auto-claim/dist/.
Docker deployment
The repository includes production-ready Dockerfiles for each service:Dockerfile.api:API service (exposes port 3001)Dockerfile.consumer:Consumer serviceDockerfile.autoclaim:Auto-Claim service
oven/bun:1.2-alpine with multi-stage builds and runs as a non-root user (bunuser).
Build images
Docker Compose
Create adocker-compose.yml in the repository root:
Adding consumer instances for additional networks
To index more than one network, duplicate theconsumer-net1 block with a unique service name and network-specific environment variables. For example:
Common Docker Compose commands
Kubernetes deployment
Namespace and ConfigMap
API Deployment
Apply and manage resources
Configuration reference
API package
| Variable | Required | Example | Description |
|---|---|---|---|
MONGODB_CONNECTION_URI | Yes | mongodb://user:pass@host:27017 | MongoDB connection string |
MONGODB_DB_NAME | Yes | bridge_hub | Database name |
RPC_CONFIG | Yes | {"mainnet":{"1":"https://..."}} | RPC endpoints by network |
PROOF_CONFIG | Yes | {"mainnet":{"1":"https://..."}} | Proof generation endpoints |
PORT | No | 3000 | HTTP port (default: 3000) |
NODE_ENV | No | production | Environment mode |
SENTRY_DSN | No | https://...@sentry.io/... | Error tracking DSN |
Consumer package
| Variable | Required | Example | Description |
|---|---|---|---|
NETWORK_ID | Yes | 1 | Network identifier |
NETWORK | Yes | mainnet | Network name (mainnet/testnet/devnet) |
BRIDGE_SERVICE_URL | Yes | https://bridge-api.polygon.technology | Bridge Service API URL |
BRIDGE_CONTRACT_ADDRESS | Yes | 0x... | Bridge contract address |
MONGODB_CONNECTION_URI | Yes | mongodb://user:pass@host:27017 | MongoDB connection string |
MONGODB_DB_NAME | Yes | bridge_hub | Database name |
ETROG_UPDATE_BLOCK_NUMBER | No | 0 | Starting block for indexing |
SENTRY_DSN | No | https://...@sentry.io/... | Error tracking DSN |
Auto-Claim package
| Variable | Required | Example | Description |
|---|---|---|---|
BRIDGE_HUB_API_URL | Yes | http://api:3000 | Bridge Hub API URL |
SOURCE_NETWORKS | Yes | [1,137] | Source network IDs (JSON array) |
DESTINATION_NETWORK | Yes | 2442 | Destination network ID |
DESTINATION_NETWORK_CHAINID | Yes | 2442 | Destination chain ID |
BRIDGE_CONTRACT | Yes | 0x... | Bridge contract address |
PRIVATE_KEY | Yes | 0x... | Wallet private key for gas funds |
RPC_CONFIG | Yes | {"2442":"https://..."} | RPC endpoints (JSON) |
SENTRY_DSN | No | https://...@sentry.io/... | Error tracking DSN |
Adding a new network
Deploy a consumer instance
Start a new consumer with the network’s configuration:In Docker Compose, add a new
consumer-net<id> service block. In Kubernetes, create a new Consumer Deployment manifest.Update API configuration
Add the new network’s RPC endpoint to
RPC_CONFIG and its proof endpoint to PROOF_CONFIG, then restart the API instances so they pick up the change.Update Auto-Claim configuration
Append the new network ID to the
SOURCE_NETWORKS JSON array, then restart Auto-Claim instances.Verify data flow
Confirm the pipeline is working end to end:
- Consumer indexing: Query the MongoDB metadata collection for the new network’s checkpoint.
- API serving data: Call
GET /transactions?sourceNetworkIds=42161and confirm results appear. - Auto-Claim detection: Monitor Auto-Claim logs to verify it picks up new transactions.
Troubleshooting
| Symptom | Likely cause | Solution |
|---|---|---|
| Services crash with MongoDB connection errors | MongoDB is unreachable or credentials are wrong | Verify MongoDB is running (mongosh $MONGODB_CONNECTION_URI). Check network connectivity with telnet mongo-host 27017. Review credentials in your environment variables. |
| API queries return no data | Consumer is not running or has not indexed yet | Confirm the Consumer process is active. Check that MongoDB contains documents (db.transactions.count()). Review API logs for errors and verify your query parameters. |
Transactions stuck in READY_TO_CLAIM | Auto-Claim cannot submit transactions | Check that the wallet has sufficient gas on the destination chain. Verify BRIDGE_HUB_API_URL is reachable from the Auto-Claim service. Test RPC endpoint connectivity. Confirm the private key is correct. |
| Excessive memory usage | Unbounded batch sizes or tight poll intervals | Review Consumer batch size settings and increase poll intervals. Add memory limits in Docker or Kubernetes resource specs. Check logs for memory leak indicators. |