axelarnetwork / support

Your source for support with the Axelar Network
3 stars 1 forks source link

How does AxelarGMPService determine the gas price for transactions between different blockchains, such as BSC and Moonbase? #40

Closed Olanetsoft closed 10 months ago

Olanetsoft commented 10 months ago

I am sending 2-way messages, in testnet, from BSC to Moonbase and then in the same tx, from Moonbase back to BSC. The thing is that it always fails on the callback with "insufficient fee", seems like Moonbase needs 8-9 DEV to send the callback message back to BSC. What I do is to manually pay the execution on BSC, and I wonder: why is it so expensive to run the callback from Moonbase to BSC (8-9 DEV is a lot, in that testnet) and how can I know it beforehand? Where is the BSC/DEV price coming from? Because at the end, axelar is asking me to pay in DEV the BSC gas, so there must be a bsc-dev price somewhere

Thanks!

Olanetsoft commented 10 months ago

When using AxelarGMPService for transactions between blockchains like BSC and Moonbase, the gas price is estimated using the estimateGasFee method from the AxelarJS SDK. This estimation needs to be done twice, once for the gas cost from BSC to Moonbase and again for the return trip from Moonbase to BSC. The total cost is the sum of these two estimations. If sufficient gas is not provided, the transaction will fail with an "insufficient fee."

The service uses current conversion rates to translate the gas paid on the source chain to the gas used by Axelar and the destination chains. In this case, the gas is paid in the source chain's native token (e.g., Moonbase's token), and Axelar handles the conversion to the destination chain's token (e.g., BSC's token).