Manually pay for interchain gas

Manually pay a relayer to deliver messages

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 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.

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

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

  7. For gas amount, enter $GAS_AMOUNT.

  8. 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.

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

Confirm delivery

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 Hyperlane's Message Explorer by entering the transaction hash or the sender/recipient address in the input field. You can see an example message delivery transaction here.

Message not delivered? See Debugging messages for tips and tricks

Last updated