Circle Internet Financial
Circle Internet Financial Logo

Sep 12, 2024

July 11, 2024

Scaling Your App for High Volume USDC Transactions with CCTP

what you’ll learn

We walk through Programmable Wallets; a groundbreaking innovation that allows developers to offer powerful Web3 wallets with the UX of a Web2 app

Scaling Your App for High Volume USDC Transactions with CCTP

This is where Circle’s Cross-Chain Transfer Protocol (CCTP) comes in. CCTP is a permissionless on-chain utility that enables USDC to move securely between supported blockchains via native burning and minting for 1:1 capital efficiency. With CCTP, developers can move USDC from Ethereum to multiple L2 blockchains, sidechains, and non-EVM blockchains seamlessly. All transfers on CCTP are validated by Circle’s automated attestative service, enabling developers to extend their app’s scalability and usability to multiple networks—without compromising security.

In this article, we’ll learn more about how L2s and faster, cheaper L1s have significantly widened the design space of what developers can build on the blockchain, and how CCTP can make it safer and easier for developers to realize these benefits.

How Blockchains are Solving for Scalability

L2 blockchains like Arbitrum enable Ethereum to scale by executing transactions in a separate execution environment, thereby allowing more transactions per second with lower fees. These L2 blockchains “roll up” several transactions into a single batch which is published on the Ethereum blockchain to benefit from its security properties.

Another option, Polygon PoS, is an L1 blockchain which is also compatible with the Ethereum Virtual Machine (EVM). With EVM-compatibility, developers who have built on Ethereum can readily port their apps to Polygon PoS. As its own L1, Polygon PoS effectively runs independent of Ethereum and is designed to settle transactions in seconds at a fraction of the cost.

Solana, an L1 blockchain, is designed to scale natively with its own Solana Virtual Machine (SVM) architecture, without the need for L2 blockchains or other scaling solutions like sharding. A key aspect of Solana's architecture is parallel transaction processing. By allowing multiple transactions to be executed simultaneously, the network's efficiency and throughput are enhanced, making Solana an attractive option for fast and near-zero cost USDC transactions.

Ultimately, these blockchains avoid the block space congestion issues that plague Ethereum, and can deliver significant cost savings to developers and their users.

Improving the User Experience Even Further with CCTP

Even with their speed and cost savings, L2s and next-gen L1 blockchains still have room for improvement. One major impediment to an even better developer experience across these blockchains is the lack of built-in interoperability.

For example, if you hold USDC on Ethereum, but want the better experience of transacting using a blockchain like Arbitrum, Polygon PoS, or Solana, you’ll need to figure out how to move that USDC across blockchains securely. Current solutions, such as lock-and-mint bridges, can be cumbersome, slow, and expensive for users. The bridging process can even involve the concept of “wrapping” USDC into a different asset, which can incur a security risk.

Fortunately, there’s a better way with CCTP. CCTP enables developers to move USDC securely between supported blockchains in just one hop (for example, USDC on Ethereum - USDC on Solana). You don't need to use or build wrapping or escrow smart contracts, because CCTP uses a seamless burn-and-mint method to facilitate USDC transfers across blockchains.

image1

How does CCTP work?

Below, we walk through the 3 steps that are involved in a CCTP transaction—burn, attest, and mint. We’ll also show sample code for each step of moving USDC from Ethereum to a fast L1 like Avalanche. (See this example for a fully working project.)

Step 1 - Burn: The app (through APIs) sends a request to CCTP to burn a requested amount of USDC on the source blockchain (Ethereum) from the source wallet. Then, USDC is burnt.

When invoking the depositForBurn method, it is necessary to pass in:

  • amount - the amount of tokens to burn
  • destination domain - the domain ID of the destination domain
  • mint recipient - the address of the mint recipient on the destination domain
  • contract address - the address of the burned token on the source domain
//STEP 1: Burn USDC - call the depositForBurn method that deposits the tokens to be burnt 

const burnTx = await ethTokenMessengerContract.methods.depositForBurn(amount, DESTINATION_DOMAIN, mintRecipient, USDC_CONTRACT_ADDRESS).send({ gas: burnTxGas }); 

const burnTxReceipt = await waitForTransaction(web3, burnTx.transactionHash);

Step 2 - Attest: The app retrieves a signed attestation from Circle’s attestation service that says the specified amount of USDC was indeed burned successfully.

We call Circle’s attestation service API to get the attestation, passing in a hash of the “bytes” field from burnTxReceipt above.

//STEP 2: Fetch attestation signature 

let attestationResponse = {status: 'pending'}; 

while(attestationResponse.status != 'complete') { 

//Fetch the attestation status using circle’s APIs 

const response = await fetch(`https://iris-api-sandbox.circle.com/attestations/${messageHash}`); 

attestationResponse = await response.json() await new Promise(r => setTimeout(r, 2000)); 

} 

const attestationSignature = attestationResponse.attestation;

Step 3 - Mint: With this attestation, the app can now ask CCTP to mint the same amount of USDC on the destination blockchain (Avalanche) by submitting the attestation. Then, USDC is minted and sent to the destination wallet.

When calling the receiveMessage method, it is required to pass in:

  • messageBytes - the value that was hashed to obtain the messageHash in step 2
  • attestationSignature - the attestation signature from step 2
//STEP 3: Using the message bytes and signature receive the funds on destination chain and address 

const receiveTx = await avaxMessageTransmitterContract.methods.receiveMessage(messageBytes, attestationSignature).send({gas: receiveTxGas}); 

const receiveTxReceipt = await waitForTransaction(web3, receiveTx.transactionHash);

Use Cases of CCTP

CCTP makes USDC natively interoperable across 8 blockchains, enabling 56 routes that developers can build cross-chain user experiences. Let’s look at a few examples.

Cross-Chain Onboarding

For developers working on decentralized finance (DeFi) apps, CCTP can be used to build a feature within their app that allows end-users to transfer their USDC from Ethereum directly to their app hosted on another blockchain like Polygon PoS or Solana. This helps developers to streamline the onboarding process of new users to their apps and deliver a faster, cheaper UX.

Cross-Chain USDC Transfers

Developers can use CCTP to enhance digital wallet UX. Digital wallets that offer support for multiple blockchains run into the issue of how to enable users to securely transfer USDC from one blockchain to another depending on the app or service they want to use. With CCTP, the wallet can embed this automated feature directly in their wallet UI to empower users to transact on the blockchain of their choice.

Cross-Chain USDC Rebalancing

CCTP empowers digital asset exchanges to securely and easily rebalance their USDC holdings across different blockchains at lower costs. With automated treasury rebalancing, exchanges can better meet withdrawal demand for USDC on various blockchains. This is also useful for market making services that need to securely move large amounts of USDC to different ecosystems to capitalize on market opportunities.

Conclusion

L2 blockchains and next-gen L1s like Solana offer faster and cheaper architectures than Ethereum, and CCTP solves the challenge of blockchain interoperability. With CCTP, developers can build secure and scalable apps with USDC for mass adoption.

Learn more about CCTP.As a developer, you know the scalability issues of using the Ethereum blockchain for high throughput use cases. Slower transaction settlement and prohibitively high gas fees hinder its adoption as a viable network to facilitate payments and commerce. The emergence of Layer 2 (L2) blockchains like Arbitrum and next-gen Layer 1 (L1) blockchains like Polygon PoS and Solana help to address this problem, providing a fast and efficient way to transfer USDC at enterprise scale with near-zero transaction costs.However, many developers have already built apps on Ethereum, where the majority of their internal treasury operations are built around USDC on Ethereum. The challenge remains: how can developers securely and efficiently migrate their USDC holdings from Ethereum to faster, cheaper blockchains?

Related posts

Web3 Services: November 2024 Updates

Web3 Services: November 2024 Updates

December 4, 2024
Circle Announces 3rd Cohort of USDC Grant Program Recipients

Circle Announces 3rd Cohort of USDC Grant Program Recipients

November 27, 2024
USDC and CCTP are coming to Aptos

USDC and CCTP are coming to Aptos

November 21, 2024
Blog
Scaling Your App for High Volume USDC Transactions with CCTP
scaling-your-app-for-high-volume-usdc-transactions-with-cctp
July 11, 2024
We walk through Programmable Wallets; a groundbreaking innovation that allows developers to offer powerful Web3 wallets with the UX of a Web2 app
Developer
Stablecoins
USDC
CCTP