Docs
How it works

Message verification

What the destination gateway proves about an incoming message, and what your contract must check itself.

Before a message is executed, the destination contract asks the gateway to validate it. Validation proves two things:

  • Axelar approved this message. A message with this source chain, source address, destination and payload was verified on the source chain and approved on this gateway, signed by Axelar's validators or verifiers. See Flow of Messages.
  • It runs once. The gateway marks the message executed, so the same message can't be executed again.

It doesn't prove who sent it. Anyone can send a message to any contract from any connected chain, so a message that passes validation can still come from someone you don't trust. Unless your contract accepts messages from anyone, check the source chain and source address after validation.

On each chain

ChainValidationChecking the sender
EVM chainsAxelarExecutable.execute calls validateContractCall on the gatewayCheck the sender
Solanavalidate_message, a CPI to the gatewayCheck the sender
Suiconsume_approved_message with your channelCheck the sender
StellarThe execute generated by #[derive(AxelarExecutable)]Check the sender
Cosmosibc-hooks calls your contract from an address derived from Axelar's GMP accountCheck where the message came from

If your code fails after validation, the whole transaction reverts, including the validation. The message stays approved and can be executed again.

Command ID

The destination gateway identifies each message by a command ID, a bytes32 that your contract receives with the message on EVM chains.

  • Amplifier chains: the command ID is derived from the message's source chain and message ID: keccak256(sourceChain + "_" + messageId). The gateway's messageToCommandId computes it.
  • Consensus chains: Axelar assigns the command ID when it approves the message, and it's in the gateway's ContractCallApproved event.

The message ID identifies a message across chains, e.g. <transaction hash>-<log index> for a message from an EVM chain, and is shown on Axelarscan. For the gateway functions that use them, see the EVM contract reference.

On this page