Overview
The auto-claim service automates the claiming of bridge transactions on the destination chain. It polls the Bridge Hub API for transactions in READY_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_CLAIM status.
- 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 onchain confirmation.
- Sleep for 30 seconds, then repeat.
Claims are processed sequentially to avoid nonce conflicts. One auto-claim instance should run per destination network.
Errors on one transaction do not affect others. The blockchain enforces claim uniqueness, so the service is safe to restart at any time without risk of double-claiming. Failed claim transactions are reverted onchain and do not result in lost funds.
Configuration
The auto-claim service is configured through environment variables.
Deployment
Deploy one auto-claim instance for each destination network you want to auto-claim for.
Docker Compose
Add the following service to your docker-compose.yml:
Direct execution with Bun
You can also run the service directly:
To auto-claim for multiple destination networks, run a separate instance for each:
Security
The auto-claim service requires a private key to submit onchain transactions. Follow these guidelines to protect it:
- Never log or expose private keys. Ensure your logging configuration does not capture environment variables.
- Load keys from a secret management system such as AWS Secrets Manager, HashiCorp Vault, or Kubernetes Secrets. Avoid hardcoding keys in configuration files.
- Use a dedicated wallet with minimal funding. The wallet only needs enough native tokens to cover gas on the destination chain.
- Monitor for unusual activity. Set up alerts for unexpected balance changes or transaction patterns on the claiming wallet.
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