Documentation Index
Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The auto-claim service automates the claiming of bridge transactions on the destination chain. It polls the Bridge Hub API for transactions inREADY_TO_CLAIM status, fetches Merkle proofs, and submits claim transactions. It handles both ASSET and MESSAGE claim types and filters out zero-amount MESSAGE transactions.
How it works
The auto-claim service runs a continuous polling loop on a 30-second interval. Each cycle follows this sequence:- Poll the Bridge Hub API for transactions with
READY_TO_CLAIMstatus. - Filter the returned transactions by source network and claim type.
- For each transaction: fetch the Merkle proof, compute the global index, submit the claim transaction, and wait for on-chain confirmation.
- Sleep for 30 seconds, then repeat.
Claims are processed sequentially to avoid nonce conflicts. One auto-claim instance should run per destination network.
Configuration
The auto-claim service is configured through environment variables.| 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 submitting claims |
RPC_CONFIG | Yes | {"2442":"https://..."} | RPC endpoints (JSON object) |
SENTRY_DSN | No | https://...@sentry.io/... | Error tracking DSN |
Deployment
Deploy one auto-claim instance for each destination network you want to auto-claim for.Docker Compose
Add the following service to yourdocker-compose.yml:
Direct execution with Bun
You can also run the service directly:Security
Claims are atomic: they either succeed or revert entirely. The blockchain enforces uniqueness, so a transaction cannot be claimed twice even if the service processes it again after a restart.Troubleshooting
| Problem | Solution |
|---|---|
Transactions stuck in READY_TO_CLAIM | Check that the claiming wallet has sufficient gas on the destination chain. |
| ”API unreachable” errors | Verify BRIDGE_HUB_API_URL is correct and accessible from the auto-claim service. |
| Nonce conflicts | Ensure only one auto-claim instance runs per destination network. |
| Claims failing | Check RPC endpoint connectivity. Verify the BRIDGE_CONTRACT address is correct for the destination network. |