cctp.receive

Documentation for eth_defi.cctp.receive Python module.

Circle CCTP V2 message receiving.

Complete cross-chain USDC transfers by relaying attestation to the destination chain’s MessageTransmitterV2.

After obtaining the attestation from eth_defi.cctp.attestation, call receiveMessage() on the destination chain to mint USDC.

Example:

from eth_defi.cctp.receive import prepare_receive_message

receive_fn = prepare_receive_message(
    web3_destination,
    message=attestation.message,
    attestation=attestation.attestation,
)
tx_hash = receive_fn.transact({"from": relayer})

Functions

prepare_receive_message(web3, message, ...)

Build a bound receiveMessage() call on MessageTransmitterV2.

prepare_receive_message(web3, message, attestation)

Build a bound receiveMessage() call on MessageTransmitterV2.

This relays the attestation to the destination chain, causing USDC to be minted to the recipient specified in the original depositForBurn() call.

Anyone can call this function (unless destinationCaller was set in the original burn). No special permissions are required.

Parameters
  • web3 (web3.main.Web3) – Web3 connection to the destination chain

  • message (bytes) – The CCTP message bytes from the attestation service

  • attestation (bytes) – The signed attestation bytes from the attestation service

Returns

Bound contract function ready to be transacted

Return type

web3.contract.contract.ContractFunction