What You’ll Build
In this quickstart, you’ll execute a cross-chain USDC transfer from Ethereum Sepolia testnet to Avalanche Fuji testnet using Circle’s Cross-Chain Transfer Protocol (CCTP). You’ll learn how to interact with the CCTP smart contracts to burn USDC on the source chain and mint it on the destination chain.Prerequisites
Before you begin, ensure you have:- Node.js installed on your system
- USDC tokens on Ethereum Sepolia testnet
- RPC endpoints for both Ethereum Sepolia and Avalanche Fuji
- Private keys for both source and destination addresses
- web3.js library installed (
npm install web3)
Contract Addresses
The CCTP contracts are deployed on testnet at the following addresses:- Ethereum Sepolia
- TokenMessenger:
0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5 - USDC:
0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238
- TokenMessenger:
- Avalanche Fuji
- MessageTransmitter:
0xa9fb1b3009dcb79e2fe346c16a604b8fa8ae0a79
- MessageTransmitter:
Setup Environment
Create a.env file with the following variables:
Approve USDC
First, approve the TokenMessenger contract to spend your USDC tokens on Ethereum Sepolia.
Call depositForBurn
Initiate the cross-chain transfer by calling
depositForBurn on the TokenMessenger contract. This burns USDC on Ethereum and emits a message for the destination chain.Retrieve Message Bytes from Logs
Extract the
messageBytes from the MessageSent event emitted during the burn transaction. Hash these bytes to prepare for attestation.Poll Attestation Service
Query Circle’s attestation service using the message hash. The service will return a signature once the attestation is complete.
The attestation service is rate-limited. Please limit requests to less than 1 per second.
Next Steps
Congratulations! You’ve successfully transferred USDC cross-chain using CCTP. Here are some things to explore next:- Try transferring between different chain pairs
- Explore the contract interfaces in detail
- Learn about the security model and attestation process
- Integrate CCTP into your own applications