Skip to main content

Overview

This guide demonstrates how to transfer USDC from Ethereum Sepolia testnet to Avalanche Fuji testnet using Circle’s Cross-Chain Transfer Protocol (CCTP).

Prerequisites

  • Node.js installed
  • Web3.js library
  • Private keys for source and destination addresses
  • USDC on the source chain (Sepolia testnet)

Testnet Contract Addresses

Ethereum Sepolia

Avalanche Fuji

Setup

1

Install Dependencies

2

Configure Environment

Create a .env file with the following variables:

Transfer Process

The cross-chain transfer involves 5 main steps:

Step 1: Approve Token Messenger

Approve the TokenMessenger contract to withdraw USDC from your Ethereum address:

Step 2: Burn USDC on Source Chain

Call depositForBurn on the TokenMessenger contract:

Step 3: Retrieve Message Bytes

Extract the messageBytes from the MessageSent event:

Step 4: Poll for Attestation

Request attestation from Circle’s attestation service:
The attestation service is rate-limited. Please limit your requests to less than 1 per second.

Step 5: Receive Message on Destination Chain

Call receiveMessage on the destination chain’s MessageTransmitter:

Complete Example

Here’s the complete transfer script:

Running the Script

Domain IDs

Troubleshooting

Approval Fails

  • Check that you have sufficient USDC balance
  • Verify the token messenger contract address
  • Ensure your wallet has enough ETH for gas

Burn Transaction Fails

  • Verify approval was successful
  • Check that amount is within burn limits
  • Ensure destination domain is valid

Attestation Not Available

  • Wait longer (attestations typically take 10-20 seconds)
  • Verify the message hash is correct
  • Check that the burn transaction was successful

Receive Message Fails

  • Ensure attestation is complete
  • Verify message hasn’t already been received (check nonce)
  • Check that destination contract address is correct

Next Steps