Blockchain fundamentals

Learn more about how the blockchain works under the hood.

Gas units, gwei, and you

There are common confusions and misconceptions in regards how the EVM, Ethereum Virtual Machine, charges for a transaction. In case of confusion, most blockchains whose wallets and contracts start with 0x are an EVM instance, even in cases where the units are not named Ether nor gwei, like Pulsechain, which uses the "beats" denomination, but the underlying system is exactly the same.

Transactions spend gas units to execute, each instruction in the EVM has a specific gas cost associated to it. Not all tokens are the same and thus not all swaps take the same amount of gas to execute: a very basic token will always need less than 100,000 units of gas to execute a swap, whereas a token with tax code may take up to 250,000 easily, with complex tokens such as dividends or tokens that do several swaps or transfers within a transfer taking over 1 million easily.

The gas limit is a limit put to the amount of gas units a transaction can spend, to avoid a gas guzzling contract from taking all your Ether to perform a transaction unless you are really sure you want to proceed. The gas priceand our bot's gas delta configuration, denominated in gwei for all chains, is the amount of Ether you are willing to pay for each unit of gas, thus, increasing your gas limit won't make your transactions fail, but lowering it may, if the limit is lower than the transaction needs. Gwei is a sub unit of Ether, being 0.000000001 ETH, this means if you pay 5 gwei for a transaction, you are willing to pay 0.000000005 ETH per gas unit. On transaction that requires 200,000 gas units to be executed, that'd be a cost of 0.001 ETH.

This means that while you can translate gwei directly to a USD value, you cannot directly translate the cost of a swap from gwei, unless you approximate and average to the most habitual swap cost, which is what sites like Etherscan do. Furthermore, having a bigger gas limit and gwei means the wallet needs to have more funds at hand to pay for the maximum potential price at the moment of executing the transaction. To adjust the limit to avoid this, you can see the gas cost of executing a swap by checking a swap on that token on its respective scan page. However, should you want to keep a higher default gas limit, the bot will simulate the gas cost and try to keep the gas limit close to what is expected to avoid unnecessary spending and keeping unused Ether on the wallet.

Last updated