LogoLogo
  • ⏩Introduction
    • Hyperlane Introduction
    • Getting started
    • Why Should You Use Hyperlane?
  • Permissionless Interoperability
    • Overview
    • Deploy Hyperlane
    • Warp Routes
      • Deploy a Warp Route
      • Deploy a UI for your Warp Route
    • Modular Rollup Interoperability
  • Build With Hyperlane
    • Quickstarts
      • Messaging
      • Accounts
      • Queries
      • hyperlane-quickstart repo
    • Guides
      • Finding my messages
      • Automatically pay for interchain gas
      • Manually pay for interchain gas
      • Choosing an interchain gas paymaster contract
      • Unit testing
      • Specifying an ISM
      • V2 migration guide
    • Explorer
      • Debugging messages
      • Configuring PI Chains
      • REST API
      • GraphQL API
    • Troubleshooting/Developer FAQ
    • Example apps
  • APIs and SDKs
    • Messaging API
      • Send
      • Receive
    • Accounts API
    • Queries API
    • Warp Route API
    • Interchain gas paymaster API
    • Hyperlane App Framework
      • Example usage
        • HelloWorld
        • Interchain Token
      • Solidity SDK
        • HyperlaneConnectionClient
        • Router
      • NodeJS SDK
        • RPC Providers
        • Deployment
        • Interchain testing
        • Quoting gas payments
        • App Abstraction
    • Hooks API
      • Contract addresses
  • Protocol
    • Overview
    • Mailbox
    • Interchain security modules
      • Interface
      • Multisig ISM
      • Routing ISM
      • Aggregation ISM
      • Optimistic ISM
      • Wormhole ISM
      • Hook ISM
      • CCIP-Read ISM
    • Interchain gas payments
    • Staking and slashing
    • Agents
      • Validators
      • Relayers
      • Watchtowers
    • Warp Routes
    • Implementation Guide
  • Operators
    • Validators
      • Guide
      • AWS setup
      • Monitoring and alerting
    • Relayers
      • Guide
      • Message filtering
    • Agent keys
      • Hexadecimal keys
      • AWS KMS keys
    • Agent configuration
      • Configuration reference
    • Running with docker compose
  • Resources
    • FAQ
    • Glossary
    • Contract addresses
      • Permissionless Deployment Contract Addresses
    • Domain identifiers
      • Permissionless Domain Identifiers
    • Default ISM settings
    • Coming Soon: Hyperlane v3
    • Token sources & faucets
    • Latencies
    • Github
    • Discord
    • Website
Powered by GitBook
On this page
  • Finding your message ID
  • Paying for interchain gas
  • Confirm delivery
  1. Build With Hyperlane
  2. Guides

Manually pay for interchain gas

Manually pay a relayer to deliver messages

PreviousAutomatically pay for interchain gasNextChoosing an interchain gas paymaster contract

Last updated 1 year ago

Read up on Interchain gas payments and the Interchain gas paymaster API

This guide will show you how to make a manual gas payment.

Typically, the smart contract that sent the interchain message will Automatically pay for interchain gas.

In some cases (e.g. Quickstarts) it may be useful to make gas payments manually.

To make a manual gas payment, you will need

  • The $MESSAGE_ID of the interchain message you are paying for

  • The $DESTINATION_DOMAIN of the interchain message you are paying for

  • The $GAS_AMOUNT that you need in order to deliver your message on the destination chain

Finding your message ID

If you have the hash of the transaction that sent your interchain message, you can use a block explorer to find the message ID. Navigate to the transaction in a block explorer, open the "Logs" tab, and find the DispatchId log. The "Topic 1" is your message ID. Use the dropdown to select "Hex", and use this value. For example:

Paying for interchain gas

Getting the interchain gas payment quote

  1. Under the Contract tab, select Read Contract.

  2. Expand the quoteGasPayment function.

  3. For destination domain, enter $DESTINATION_DOMAIN.

  4. For gas amount, enter $GAS_AMOUNT.

  5. Click Query and make note of the amount returned as $GAS_PAYMENT_QUOTE. For example, at the time of writing, the quote is 1 wei.

Make the interchain gas payment

  1. Still on the DefaultIsmInterchainGasPaymaster contract page on Etherscan, select Write Contract.

  2. Click on the Connect to Web3 button to connect your Wallet (i.e. Metamask). Make sure that you are on the correct network.

  3. Expand the payForGas function.

  4. For the message ID, input your $MESSAGE_ID.

  5. For the destination domain, input your $DESTINATION_DOMAIN.

  6. For gas amount, enter $GAS_AMOUNT.

  7. For the refund address, input the address of the account you will sign the transaction with. This will receive a potential refund if you overpay for interchain gas.

  8. Click "Write" and submit the transaction via your wallet/Metamask.

Getting the interchain gas payment quote

First, get a quote for how much your gas payment will cost, and save this in an environment variable called $GAS_PAYMENT_QUOTE:

cast call $IGP_ADDRESS "quoteGasPayment(uint32,uint256)" $DESTINATION_DOMAIN $GAS_AMOUNT --rpc-url $RPC_URL

Make the interchain gas payment

Now, we can call payGasFor, and we supply the gas payment quote as value in the transaction. The final parameter, $MY_ADDRESS, is the address of the account whose private key you're signing with. This address will be refunded any overpayment.

cast send $IGP_ADDRESS "payForGas(bytes32,uint32,uint256,address)" $MESSAGE_ID $DESTINATION_DOMAIN $GAS_AMOUNT $MY_ADDRESS --rpc-url $RPC_URL
--private-key $PRIVATE_KEY --value $GAS_PAYMENT_QUOTE

Confirm delivery

Message not delivered? See Debugging messages for tips and tricks

Navigate to the contract page on (or its equivalent if you're sending from a non-Ethereum chain).

For the payable amount, Etherscan expects an amount quoted in ether, while our $GAS_PAYMENT_QUOTE is in wei. To convert from wei to ether, input the amount $GAS_PAYMENT_QUOTE, which is in wei, into and copy the ether amount. Use this ether amount as the payable amount.

After you've paid for interchain gas, you should be able to see a corresponding transaction delivering your message on the destination chain. You can watch for this transaction on by entering the transaction hash or the sender/recipient address in the input field. You can see an example message delivery transaction .

https://eth-converter.com/
Hyperlane's Message Explorer
here
Etherscan
DefaultIsmInterchainGasPaymaster
Finding the message ID from the DispatchId log
This transaction sent a "Hello World" message from Goerli to Alfajores