Mach 2
  • Getting Started
    • What is Mach?
    • Mach 2
      • Optimistic Settlement
      • Intents
      • Order Matching
      • Stables & RWAs
    • Trade Lifecycle
  • Navigation
    • Users
      • FAQ
    • Market Makers
  • Protocol
    • Overview
      • Cross-Chain Swap
      • Challenge Process
    • CCTP
    • LayerZero
    • API
      • Integration
    • Staging
    • Deployed Contracts
    • Supported Assets
    • Security
  • Whitepaper
  • Audits
  • Github
Powered by GitBook
On this page
  • CCTP Transaction
  • CCTP in Mach
  • Recieving CCTP Transaction on Server
  • To successfully receive a CCTP transaction on the server, follow these steps:
  1. Protocol

CCTP

PreviousChallenge ProcessNextLayerZero

Last updated 12 months ago

CCTP Transaction

The Circle Cross-Chain Transfer Protocol (CCTP) is a solution designed by Circle to facilitate simple and secure transfers of USDC across different blockchain networks. This eliminates the need for multiple versions of USDC, since the protocol operates as a decentralized bridge, utilizing a burn-and-mint process.

When a user initiates a transfer, USDC is burned on the source chain and an equivalent amount is minted on the destination chain, maintaining a consistent total supply. CCTP ensures secure and efficient transfers through a decentralized validation mechanism, optimizing transaction speeds and reducing costs.

CCTP in Mach

In the case of a CCTP transaction through Mach, the process is delegated to the market maker, adopting an optimistic approach by fronting the capital for users. This is secured through CCTP's mint and burn functionality. As a result, rather than waiting over 20 minutes for a large-scale transaction to be processed, the transaction can be processed immediately, provided there is sufficient liquidity.

Furthermore, Mach incorporates certain novel CCTP routing solution, that enables the system to settle transactions at a faster speed than most competitors.

Recieving CCTP Transaction on Server

To successfully receive a CCTP transaction on the server, follow these steps:

Step 1: Burn USDC on the Source Chain

Before submitting a POST request to receive CCTP on the server, you must first burn USDC on the source chain (src_chain). This burn transaction is referred to internally as the burn_tx.

Important:

  • Ensure that the public destination address is [TREVOR NEEDS TO FILL THIS].

Step 2: Send Transaction to Circle CCTP Token Messenger Contract

Send a transaction on the src_chain to the Circle CCTP Token Messenger Contract by calling the depositForBurn function. Use our wallet's public address as the destination address.

The depositForBurn function facilitates these cross-chain token transactions, ensuring that the specified amount of tokens is burned. The transaction is directed to the appropriate destination domain, and the minted tokens are sent to the correct recipient address. This method helps in reducing transaction speeds and costs while retaining optimal security by managing the funds through smart contracts.

// Function to call depositForBurn on the tokenMessenger contract
function CCTP_Trade(
    uint256 amount,
    uint32 destinationDomain,
    bytes32 mintRecipient,
    address sell_token
) 
    external 
    payable 
    returns (uint64 nonce)
{
    // Send in
    transferFrom(sell_token, msg.sender, amount);
    
    // Calling depositForBurn function of the tokenMessenger contract
    nonce = tokenMessenger.depositForBurn(apply_fee(amount), destinationDomain, mintRecipient, sell_token);
    
    transfer(sell_token, owner(), owner_fee(amount));
    
    emit CCTPTrade(msg.sender, amount, sell_token, destinationDomain);
    
    payable(owner()).transfer(msg.value);
}

Important:

  • Our wallet’s public address is: [I NEED TO ASK TREVOR FOR THIS].

Step 3: Obtain the Message Hex

After making the burn transaction, you need to obtain its message hex. There are two ways to do this:

Manually:

pythonCopy codetx_receipt = await asyncio.to_thread(web3.eth.wait_for_transaction_receipt, burn_tx)
log = arb_token_messenger_contract.events.MessageSent().process_receipt(tx_receipt)[0]
message_bytes = log.args.message
message_hex = message_bytes.hex()

Using the Endpoint:

Step 4: Make a POST Request to Receive CCTP

You can call the /get_message_hex_from_burn_tx endpoint by providing the src_chain and the burn transaction hash (burn_tx). More details can be found .

Once you have the message_hex, make a POST request to the /receive_cctp endpoint. Provide the message_hex from the previous step and the destination chain name (dst_chain_name). Refer to the endpoint documentation .

here
here
Find a more direct example here.
Cross-Chain Transfer ProtocolStablecoins
Logo
EVM Smart ContractsStablecoins
Logo
CCTP - Burning and Minting