IntroductionCosmos GMPSolidity UtilitiesSandbox
InterchainTokenServiceInterchainTokenFactoryTokenManagerAxelarGateway AxelarGasServiceAxelarExecutableAxelarJS SDK
Bug Bounty
Crosschain Message FlowaxlUSDCSecurity OverviewInterchain Transaction DurationEVM Contract Governance

Introduction to the AxelarGasService contract

AxelarGasService is a smart contract that manages gas payments and refunds for cross-chain communication on the Axelar network. It allows an application to prepay gas fees on the source chain and increase the gas paid for a transaction. If too much gas is paid for a transaction, it can calculate and refund the sender.

Prepay gas on the source chain

The Axelar network routes every General Message Passing (GMP) transaction to its destination chain. The final step of this process involves the application paying the gas fees for the transaction. This can be done in one of two ways:

  1. On the destination chain: Manually paid on the destination chain
  2. On the source chain: Prepaid to the AxelarGasService contract on the source chain, thus allowing it to execute the final transaction on the destination chain

It’s possible for gas fees to be manually paid on the destination chain, but developers typically rely on Axelar’s Gas Service, which provides the ability to prepay the full estimated cost for any GMP transaction with a single payment on the source chain. This service manages the full pipeline: once gas is paid to the Gas Receiver contract, the Gas Service uses the payment to submit the transaction to the Axelar Network and to execute the final GMP call on the destination chain.

Increase gas

If the amount of prepaid gas is not enough — for example, if the destination chain is congested with transfers, causing a gas fee increase for each transaction — the application can add additional gas to pay for the transaction.

Gas refunds

After the message has been relayed to the destination contract, Axelar will calculate and refund any extra gas fees to the payer account on the source chain. This execution can be monitored on Axelarscan or requested through the AxelarJS SDK.

Two-way calls

The Gas Service supports relaying two-way calls, when a message is sent from the source chain and another message is returned from the destination chain.

  • Outbound call: a GMP call from chain A to chain B
  • Return call: a GMP call returned from chain B to chain A

Once the outbound call is executed on chain B and sends another call to return a message to chain A, Axelar will automatically pay the gas for the return transaction.

If the remaining gas amount is insufficient for the return trip, the Insufficient Fee tag will show up on Axelarscan. The return call will not be relayed until more gas is added via Axelarscan or the AxelarJS SDK.

Sending messages from a single transaction to multiple destination chains

The Gas Service also supports relaying multiple message calls from a single transaction. To do this, the application must pay the GasReceiver contract a single gas fee covering all messages. The following message call is an example transaction where this occurs.

Edit this page