Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines Avalanche ICM. It covers the components and message flow so that readers without an engineering background can understand the overall architecture. It also explains the underlying mechanics in greater detail for engineers. The original figures are retained; some labels may remain in Japanese.
What is ICM?
Avalanche ICM (Interchain Messaging) enables L1 blockchains on Avalanche to send and receive messages. These messages can contain simple strings or data used to invoke functions, among other things. For example, an application can send a string to a contract on a destination L1, or burn ERC20 tokens on the source L1 and mint ERC20 tokens on the destination L1.
For more information about Avalanche ICM, see the following article.
Prerequisites
Before examining the ICM message flow, let's cover the concepts that underpin it.
P-Chain
In addition to the C-Chain and separately created L1 blockchains, Avalanche has the P-Chain. The P-Chain manages the validators responsible for block production and other activities on the C-Chain and individual L1s, as well as the AVAX staked by validators. When a new L1 is created, its information, including its validators and chain ID, must be registered on the P-Chain. The P-Chain is therefore central to validator management, staking, and the L1 lifecycle on Avalanche.
Validators
https://build.avax.network/academy/interchain-messaging/02-interoperability/03-multi-chain-networks
Each L1 on Avalanche has its own validators. These validators perform tasks such as producing blocks.
https://medium.com/coinmonks/avalanche-fundamentals-subnet-architecture-explained-e69f5aa3d75a
A validator is not restricted to a single L1; it can validate multiple L1s.
https://build.avax.network/blog/etna-upgrade-motivation
To become a validator of an L1, a participant must satisfy that L1's staking requirements for its native token.
https://build.avax.network/blog/etna-upgrade-motivation
Validators also pay a small monthly fee in AVAX to the P-Chain for registering their information.
BLS signatures
A BLS signature (Boneh–Lynn–Shacham signature) is a cryptographic signature scheme that allows multiple signatures to be combined into one aggregate signature. In addition to Avalanche ICM, it is used in Ethereum 2.0 (the Beacon Chain).
- Signature aggregation When multiple signers sign the same message, their signatures can be combined into a single signature. This reduces the amount of data transmitted over the network and makes more efficient use of block space.
- Lower verification costs An aggregate signature can be verified in a single verification operation, improving efficiency.
- Pairing-based cryptography BLS uses specialized cryptographic operations called pairings to verify signatures.
For example, consider three validators (Validator A, B, and C) signing the same message "Block123".
- Each validator signs with its private key.
sigA = sign(privA, "Block123")sigB = sign(privB, "Block123")sigC = sign(privC, "Block123") - Combine the individual signatures into a single aggregate signature.
aggSig = aggregate(sigA, sigB, sigC) - The verifier can check the aggregate signature in a single verification operation.
verify([pubA, pubB, pubC], "Block123", aggSig)This verifies that A, B, and C signed the same message in one operation.
Avalanche ICM message flow
This section examines the ICM message flow in detail.
Components
First, let's identify the components involved.
Source Chain & Destination Chain
| Source Chain | Message | Destination Chain |
|---|---|---|
![]() |
![]() |
![]() |
| L1 chain sending the request | Message being sent | L1 chain receiving the request |
The L1 that sends a message is called the Source Chain, and the L1 that receives it is called the Destination Chain. Both L1 chains must already be registered on the P-Chain.
When an L1 is created using a service such as AvaCloud, registration on the P-Chain is typically handled during creation.
A user submits a request on the Source Chain containing the message to be sent to the Destination Chain.

Both chains need contracts that send or receive messages across L1s (labeled Cross-Subnet dApp in the diagram), as well as a contract called Teleporter that handles message transmission and reception.
A Cross-Subnet dApp can include ERC20 contracts deployed across multiple L1s, contracts that exchange messages with other L1s, and off-chain applications that interact with those contracts. Teleporter formats data, including the message, for transmission to another L1 and supports retrying failed message deliveries.
For more information about Teleporter, see the following article.
Message
Let's look at how a message is formatted.
Simple data
Messages must be encoded rather than sent as raw strings.
The example above encodes two values, test and 42, together.
Encoding means converting data into a particular format.
The diagram converts the message ("test", 42) into bytes.
Representing the message as bytes makes it easier to process.
string memory someString = "test";
uint someNumber = 42;
bytes message = abi.encode(someString, someNumber);In the example, the variable someString holds the string test.
The variable someNumber holds the numeric value 42.
The two values, someString and someNumber, are encoded using abi.encode.
On the destination L1, the encoded data must be decoded back into its original values. Decoding uses the data types and the encoded bytes, as shown below.
(
string memory someString,
uint someNumber
) = abi.decode(message, (string, uint));By passing the encoded data message and its original types, string and uint, to abi.decode, the destination contract recovers the original values someString and someNumber.
someString and someNumber contain test and 42, respectively.
This is how a message can be sent from the Source Chain to the Destination Chain.
The contract performing the decoding on the Destination Chain must know the original data types in advance.
This is because abi.decode cannot correctly decode message without the original data types.
Function invocation data
An application may also want to send function invocation data to the destination chain.
https://build.avax.network/academy/interchain-messaging/06-invoking-functions/01-invoking-functions
There are two ways to pass this data:
- Send function arguments as the message.
- Send an identifier for the function to execute together with its arguments.
To send function arguments as the message, encode the values to be passed to the function, as described in the Simple data section.
string someString = "test";
uint someNumber = 43;
address someAddress = address(0);
bytes message = abi.encode(
someString,
someNumber,
someAddress
);The other approach is to send the function identifier together with the argument data.
enum CalculatorAction {
add,
concatenate
}Define an enum containing the function identifiers as shown above.
function encodeAddData(uint256 a, uint256 b) public pure returns (bytes memory) {
bytes memory paramsData = abi.encode(a, b);
return abi.encode(CalculatorAction.add, paramsData);
}
function encodeConcatenateData(string memory a, string memory b) public pure returns (bytes memory) {
bytes memory paramsData = abi.encode(a, b);
return abi.encode(CalculatorAction.concatenate, paramsData);
}Then define functions such as those above in the contract, including the previously defined function identifier in the message.
paramsData contains the arguments for the function. These bytes are then encoded together with the function identifier (CalculatorAction.add or CalculatorAction.concatenate).
When decoding, first specify the types of the function identifier and its encoded argument data (bytes), as shown below.
(CalculatorAction actionType, bytes memory paramsData) = abi.decode(message, (CalculatorAction, bytes));Define the same enum of function identifiers in the destination contract. Pass its type and the argument-data type (here, bytes, because the arguments were encoded twice) to abi.decode to obtain the function identifier (actionType) and the encoded arguments (paramsData).
if (actionType == CalculatorAction.add) {
(uint256 a, uint256 b) = abi.decode(paramsData, (uint256, uint256));
_calculatorAdd(a, b);
} else if (actionType == ...) {
(string memory text1, string memory text2) = abi.decode(paramsData, (string, string));
_calculatorConcatenateStrings(text1, text2);
} else {
revert("CalculatorReceiverOnDispatch: invalid action");
}Dispatch execution to the appropriate function based on the received identifier. Finally, decode the argument data to obtain the values passed to the function.
Representing messages as bytes allows applications to send a wide range of data to destination L1 chains. The example uses two layers of encoding, but three, four, or more layers are possible for more complex data structures. Keep in mind that additional layers can increase processing overhead and make the data more difficult to manage.
Relayer
https://build.avax.network/academy/interchain-messaging/08-avalanche-warp-messaging/04-awm-relayer
The Relayer is the component that actually relays messages between two L1s. It runs off-chain, monitoring connected L1 chains for message requests. When it detects a message, it collects BLS signatures from the relevant nodes and submits the message to the destination L1.
For more details, see the following article.
Warp Precompile
Avalanche precompiles are smart contracts built into an L1 when it is created. The Warp Precompile makes messages passed to it by the Teleporter contract available for relay. The Warp Precompile on the destination L1 also verifies the data submitted by the Relayer.
For more details about the Warp Precompile and precompiles in general, see the following article.
Message data
The message payload alone is not enough to send data to a destination chain. For example, it does not identify which L1 should receive it or which contract should be called. The Teleporter contract is designed to accept and process the information needed to send messages to other L1s. A Cross-Subnet dApp contract supplies the following information to the Teleporter contract.
destinationBlockchainIDThe blockchain ID of the destination L1. This is not the conventional chain ID. It is the hash of the transaction that registered the L1 on the P-Chain when the chain was created.destinationAddressThe address of the contract deployed on the destination L1 that should receive the message.feeInfoInformation about the fee to be paid to the Relayer. It is defined as follows. https://github.com/ava-labs/icm-contracts/blob/main/contracts/teleporter/ITeleporterMessenger.sol#L44-L47feeTokenAddressThe contract address of the ERC20 token used to pay the fee, or the native token address (0x00...), as described in the original article.amountThe amount of tokens to pay as the fee.
requiredGasLimitThe gas limit for execution. This can be configured so that execution does not consume more gas than the specified value.allowedRelayerAddressesThe list of Relayers authorized to relay the message. The list is empty by default, allowing any Relayer to process the message. Specify addresses when only particular Relayers should process it.messageThe message to be sent to the destination L1.
The Relayer uses this information to submit the message to the destination L1. A Cross-Subnet dApp contract does not need to implement this processing itself; it supplies the required information to Teleporter, which handles the rest.
Message flow
With the components in place, let's trace how ICM processes a message.

1. Sending a message
A contract on the Source Chain that integrates with Teleporter initiates a message request.
The contract deployed on the Source Chain assembles the information needed for the request and calls Teleporter's sendCrossChainMessage function, as shown below.
2. Teleporter message processing
When sendCrossChainMessage is called, Teleporter retrieves a list of receipts for messages previously sent from the destination L1 to this Teleporter contract on what is now the Source Chain.
Returning those receipts to the destination L1 confirms successful processing and allows Relayers to collect their rewards.
This step is needed because a Relayer receives its reward only after message delivery is complete.
The sendCrossChainMessage function calls _sendTeleporterMessage to perform the underlying operations.
The _sendTeleporterMessage function performs the following operations.
- Obtain the
messageIDAssociating each message with a unique ID makes it easier to manage operations such as retries.
- Construct the
TeleporterMessageBuild aTeleporterMessage, the data format used to send messages to the destination L1. TheoriginSenderAddressfield holds the address of the contract that called Teleporter.
- Collect the fee Based on the fee information supplied by the calling contract, transfer the specified ERC20 fee tokens to the Teleporter contract. The fee tokens held by Teleporter are transferred to the Relayer after delivery to the destination L1 has been confirmed.
- Emit an event Emit an event announcing that a message is to be sent to another L1. Relayers monitor this event.
- Call the Warp Precompile
Call the Warp Precompile so that the following additional information is emitted separately, as described in the original article.
sourceChainIDThe blockchain ID of the source L1.payload (teleporterMessageBytes)The bytes of the message to be sent.originSenderAddressThe address of the contract that submitted the request on the source L1.messageIndexA unique ID.- BLS signature After detecting the Teleporter event, the Relayer retrieves the event emitted by the Warp Precompile containing the information listed above.
3. Retrieving events
When Teleporter emits a SendCrossChainMessage event, the Relayer retrieves it.
The Relayer monitors connected L1s for SendCrossChainMessage events and retrieves them as soon as they are emitted.
The detailed process is explained here.
As described earlier, after retrieving the event, the Relayer also retrieves the event emitted by the Warp Precompile that contains the required information.
Because the Warp Precompile is called within the same transaction in which Teleporter emits its event, the Relayer retrieves events from that transaction.
If a transaction contains multiple events from Teleporter and the Warp Precompile, the Relayer associates them by checking the event order and whether the messageID derived from the following information matches.
networkIDThe source network ID.sourceChainIDThe blockchain ID of the source L1.payloadThe actual payload containing theTeleporterMessage.
4. Collecting BLS signatures
The Relayer requests BLS signatures from validators on the Source Chain.

Each validator has a weight corresponding to its stake. Depending on the L1's configuration, BLS signature verification fails unless the signatures represent at least the required weight.
Collecting individual signatures and aggregating them produces a signature of fixed length, even as the number of validators increases.
The public keys of the participating validators must also be aggregated for verification.
5. Submitting the message to the destination chain
Once the BLS signatures have been collected, the Relayer uses the retrieved event information to submit the message to the specified destination L1. It calls the Teleporter contract on that destination L1. The Relayer registers the Teleporter contracts on its connected L1s in advance. Since only one Teleporter contract can be registered per L1 in this configuration, the Relayer sends the message to that registered contract.
6. Verification
When the Relayer calls the Teleporter contract on the destination L1, the receiveCrossChainMessage function is invoked.
At the beginning of receiveCrossChainMessage, the Warp Precompile is called.
The Warp Precompile's VerifyPredicate function below verifies the BLS signature and checks whether the signing validators meet the weight threshold configured by the destination L1.
BLS signature verification uses the aggregate signature and aggregate public key of the validators. The system also checks that the signatures represent at least the weight configured in advance on the destination L1. For example, if the threshold is 50% or more, processing fails when the signing validators represent less than 50% of the total weight.
Weight refers to a value determined by the amount of tokens a validator has staked on that L1. A larger stake corresponds to a higher weight.
The receiveCrossChainMessage function also performs the following checks.
- Verify the originating Teleporter contract Check that the originating Teleporter contract address matches the address of the Teleporter contract being called. This check is based on the convention that Teleporter is deployed at the same contract address on each L1 using CREATE2.
For more information about CREATE2, see the following article.
-
Verify the destination chain Check that the message is addressed to the L1 on which the called Teleporter contract resides.
-
Verify the
messageIDCheck whether themessageIDhas already been processed. ThemessageIDis unique, so the same message cannot be executed twice through this path. -
Verify
allowedRelayerAddressesIf the message specifies Relayers throughallowedRelayerAddresses, check that it was submitted by an authorized Relayer.
If all checks pass, the message is delivered to the specified contract.
7. Receiving the message
The specified contract on the destination L1 is called.
The function invoked is receiveTeleporterMessage, which the receiving contract must implement.
The receiveTeleporterMessage function accepts the following three arguments.
originChainIDThe blockchain ID of the source L1.originSenderAddressThe address of the contract that requested message delivery on the source L1.messageThe message that was sent.
Additional considerations
Fee flow
https://build.avax.network/academy/interchain-messaging/11-incentivizing-a-relayer/02-fee-data-flow
A fee can be specified when sending a message from the Source Chain. Some Relayers may decline to process messages unless a minimum fee is offered, making a fee necessary in those cases. The fee is paid to the Relayer after delivery to the destination L1 has been confirmed. As shown in the diagram, when a message is requested, the specified ERC20 tokens are first deposited on the Source Chain. The message is then delivered to the destination L1. Once the delivery information is returned to the Teleporter contract as a receipt, the fee can finally be paid to the Relayer.
Note that the receipt is sent back to the Source Chain's Teleporter contract only when the Destination Chain's Teleporter contract is called for the return message. Until that occurs, the fee remains unpaid.
ICM Registry
By default, the Teleporter contract is not upgradeable. However, changes to Teleporter's specification or the discovery of a vulnerability may make it desirable to upgrade to a new Teleporter contract. The ICM Registry supports this process.
The diagram shows a contract called the Teleporter Registry. Calling its getLatestTeleporter function returns the address of the latest Teleporter contract.
Each dApp contract can call getLatestTeleporter to access the latest version of the Teleporter contract.
When a new version of Teleporter is deployed, registering its address with the Teleporter Registry makes it available as the latest version.
For more information about the Teleporter Registry, see the following article.
Conclusion
This article covered the components and message flow of Avalanche ICM.
I also write articles on other topics. You can find them at the following links.












