What This Example Demonstrates
- Getting available chains for mainnet or testnet
- Creating an Iris client for attestation polling
- Polling for attestations using a burn transaction hash
- Basic error handling
Complete Code Example
This is the exact example from the SDK README showing the fundamental usage:Breaking Down the Example
Get Available Chains
Use The
GetChains(false) to retrieve all mainnet chains. Pass true for testnet chains:chains slice contains all supported CCTP chains with their configuration including RPC endpoints, contract addresses, and domain IDs.Create an Iris Client
The IrisClient is used to fetch attestations from Circle’s Iris API:For testnet, use:
https://iris-api-sandbox.circle.comPoll for Attestation
Use the The method will automatically retry with exponential backoff until the attestation is ready.
PollForAttestation method to wait for an attestation to be ready:The progress callback parameter is optional. See Attestation Polling for an example with progress tracking.
Chain Domains
Common domain IDs you’ll use:| Chain | Domain |
|---|---|
| Ethereum | 0 |
| Avalanche | 1 |
| OP Mainnet | 2 |
| Arbitrum | 3 |
| Base | 6 |
| Polygon PoS | 7 |
Related Examples
- Custom RPC Endpoints - Override default RPC endpoints
- Attestation Polling - Advanced polling with progress tracking
- CLI Usage - Using the CLI tool
Next Steps
Chain Configuration
Learn about chain configurations and helper functions
Iris Client
Explore the Iris client for attestation management