IntroductionEVM RelayerCosmos GMPSolidity UtilitiesSandbox
InterchainTokenServiceInterchainTokenFactoryTokenManagerAxelarGateway AxelarGasServiceAxelarExecutableAxelarJS SDK
Onboard your IBC chainBug Bounty
Crosschain Message FlowaxlUSDCSecurity OverviewInterchain Transaction DurationEVM Contract Governance

General Message Passing with Amplifier Example

This example shows the execution of a GMP call from the Avalanche Fuji to the Ethereum Sepolia testnets.

Prerequisites

You should:

Helpful references

Send a GMP call between two chains

Execute the contract call on the source chain

Use callContract() to execute the contract call on Ethereum Sepolia, then locate the ContractCall event in the transaction details on Axelarscan, which should look something like this. Note the transaction hash and log index.

Verify messages at the source chain gateway

Once the transaction is finalized on the source chain, call verify_messages at the source chain’s Axelar gateway:

export RPC="http://devnet-verifiers.axelar.dev:26657"
axelard tx wasm execute axelar1vnfn0e4vnn58ydpm05wqcc9zp8t5ztwd5rw5f895lykqaezmuccqujmwl2 \
    '{
       "verify_messages": [
            {
                "cc_id": {
                    "chain":"avalanche",
                    "id":"0x711f8485591d0350dc87f9cb1e807887b91c3fc197f15b95e692a5170146113f-0"
                },
                "destination_chain":"ethereum-sepolia",
                "destination_address":"0x8f8dedd09E23E22E1555e9D2C25D7c7332291919",
                "source_address":"0x0a3b8dc7706c47b6dd87d771df63875b1c5cd867",
                "payload_hash":"220f68445e3cec114bff50cd6b251e3deabc7684b10280c2116b20bcc6795a96"
            }
       ]
    }' \
    --keyring-backend test  \
    --from wallet  \
    --gas auto --gas-adjustment 1.5 --gas-prices 0.007uverifiers  \
    --chain-id=devnet-verifiers \
    --node $RPC

Wait for verification, which usually takes 1-3 blocks. Then call route_messages:

export RPC="http://devnet-verifiers.axelar.dev:26657"
axelard tx wasm execute axelar1vnfn0e4vnn58ydpm05wqcc9zp8t5ztwd5rw5f895lykqaezmuccqujmwl2 \
    '{
       "route_messages": [
            {
                "cc_id": {
                    "chain":"avalanche",
                    "id":"7C7C74495FFD6CCC6B4B5E7069CF2495485F59E9CA5E8222DA486CE08DADC7E8-0"
                },
                "destination_chain":"ethereum-sepolia",
                "destination_address":"0x8f8dedd09E23E22E1555e9D2C25D7c7332291919",
                "source_address":"0x0a3b8dc7706c47b6dd87d771df63875b1c5cd867",
                "payload_hash":"220f68445e3cec114bff50cd6b251e3deabc7684b10280c2116b20bcc6795a96"
            }
       ]
    }' \
    --keyring-backend test  \
    --from wallet  \
    --gas auto --gas-adjustment 1.5 --gas-prices 0.007uverifiers  \
    --chain-id=devnet-verifiers \
    --node $RPC

Call construct_proof on the multisig prover corresponding to the destination chain:

axelard tx wasm execute axelar1g6520uhs8u37el40wqngf60z06mjgk6z7nezytd2mxrmh7yesnmsyc0zjw \
  '{
    "construct_proof":
      {
        "message_ids":
          [
            {
              "chain":"avalanche",
              "id":"7C7C74495FFD6CCC6B4B5E7069CF2495485F59E9CA5E8222DA486CE08DADC7E8-0"
            }
          ]
      }
  }' \
  --keyring-backend test  \
  --from wallet  \
  --gas auto --gas-adjustment 1.5 --gas-prices 0.007uamplifier  \
  --chain-id=devnet-amplifier \
  --node $RPC

Note the multisig_session_id in the output:

{\"key\":\"multisig_session_id\",\"value\":\"1\"}

Retrieve the signed batch of messages

Wait for signing to complete, which usually takes 1-3 blocks. Then call get_proof:

axelard q wasm contract-state smart axelar1qum2tr7hh4y7ruzew68c64myjec0dq2s2njf6waja5t0w879lutqv062tl \
  '{
    "get_proof":
      {
        "multisig_session_id":"1"
      }
  }'

The output should look something like this:

data:
  data:
    commands:
    - id: c767e0ff9bcfcfa11d5346095b2c969fedb1c4a87bbf9fd0cb82578eda6fecc2
      params: 00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000079a35fd62dbaa820d3025b3400ebce17cdd6c58764b8427717b2ce8573a0c37e03e30ec683c2fe57dcee4d426d22cf43c769267500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010657468657265756d2d7365706f6c696100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30784134663130663736423836453031423938646146363641336430326136356531346164623037363700000000000000000000000000000000000000000000
      ty: approve_contract_call
    destination_chain_id: "43113"
  message_ids:
  - chain: ethereum-sepolia
    id: 0xeafbc1283699c49ba4f79ec43d8749fd82ca4ee14c236787dd25a2f7d4932daa-60
  multisig_session_id: "1"
  status:
    completed:
      execute_data: 09c5eabe000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000006e00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000a869000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001c767e0ff9bcfcfa11d5346095b2c969fedb1c4a87bbf9fd0cb82578eda6fecc2000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000013617070726f7665436f6e747261637443616c6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000079a35fd62dbaa820d3025b3400ebce17cdd6c58764b8427717b2ce8573a0c37e03e30ec683c2fe57dcee4d426d22cf43c769267500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010657468657265756d2d7365706f6c696100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a307841346631306637364238364530314239386461463636413364303261363565313461646230373637000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000030000000000000000000000008054f16ad10c3bf57e178f7f9bc45ea89f84301a00000000000000000000000089a73afebb411c865074251e036d4c12eb99b7ba000000000000000000000000f330a7f2a738eefd5cf1a33211cd131a7e92fdd400000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000415b0df0a1859262dbe806ba916432a688dddf8b31e82138d94d7a4d29ffd04a6f136d6286f02d337ca5632f0c739a4fea909b68c7fee60143bde385cb7c0623f61c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041f5fb2289f995a4ec662cf4b83396ae3beaf004af77e9c60083637cd9596b28b30bf17949473dc6f2bb063bcba9e09ae9b267bb543b852fe43fa5fae6c01f81811b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004123d2d5f8f86b7f568f2503cb156e184c3a96d48c0b3ab8f096f83d31a4a03b057e7ef8b0ac0e36eef8354e0b0acab8475ac6f1801571e82c45ff8eeeaf1a0f9c1c00000000000000000000000000000000000000000000000000000000000000

Relay the execute data to the destination chain gateway

The execute data can be relayed to the destination chain’s AxelarGateway in a number of ways. Here’s how to do it with node.js using ethers:

> await wallet.sendTransaction({to: gatewayAddress, data: "0x"+executeData, gasLimit:ethers.BigNumber.from(5e+06)}).then((tx) => tx.wait())

Execute the contract

Fill in the appropriate values and execute the contract. The command_id can be found in the response to the get_proof query:

> await contract.execute(ethers.utils.arrayify(command_id),source_chain, source_address, ethers.utils.arrayify(payload)).then((tx) => tx.wait())
Edit this page