There are many myths surrounding gas fees for Ethereum transactions. Let’s get one of them out of the way first: Gas is not a currency. Contrary to popular belief, it has nothing to do with the amount of ether in your account and you cannot pay someone in gas if they want ETH instead. Instead, it is a measurement that pays for computation on the blockchain network – think electricity costs for running apps on your smartphone or PC at home.
Ethereum gas and gas costs are among the themes that unavoidably come up when there is a talk about the world’s second-biggest blockchain network. Ethereum gas is a fundamental component of the network that makes the Ethereum (virtual) machine tick. In this article, you get a closer look at what gas is and why it has turned into a subject of dispute inside the Ethereum community.
What is Gas?
Put very simply, gas is the fee that you pay in order to execute a transaction or contract on the Ethereum blockchain. The price of gas is set by miners, who can choose to increase or decrease the price as they see fit.
When you submit a transaction to the network, you specify how much gas you are willing to pay for it to go through. If miners deem your offer acceptable, your transaction will be included in the next block. If not, your money will be refunded and you can try again with a higher gas price.
Why do we need Gas?
Gas is needed to prevent spam on the network and to incentivize miners. Miners can only include transactions in a block if they are profitable – meaning that the total gas fees for that block are more than the mining rewards. If miners were to include every transaction that was offered, they would quickly lose money, as the mining rewards are much lower than the gas fees.
How is Gas used?
When you submit a transaction to the network, you specify how much gas you are willing to pay for it to go through. Ethereum checks the amount of gas specified against how much work the transaction will require. If it exceeds the limit, your transaction will not be processed and you will get your money back.
How much does Gas cost?
Gas prices are measured in Gwei. At the time of writing, one Ether (ETH) costs about 0.04 Gwei (0.00000004 ETH).
For example, to transfer 5 ETH with a gas limit of 200000, you need to pay a fee of 0.000009 ETH (~9 USD cents at the current exchange rate), which will be rewarded to the miner who included your transaction in a block. On the other hand, If you set too low a gas price – or if miners simply don’t want your business – it might take several blocks for your transaction to go through and you will have essentially wasted your money! Worse still, some wallets can accidentally send transactions with an extremely low gas price, which can lead to permanently getting your money stuck and lost.
How do I calculate the Gas Price?
Even though consumers and most dapps don’t need to worry about gas prices on a daily basis, it is crucial for developers and miners alike.
Miners will not be able to include transactions in a block if they are unprofitable – meaning that the total fees for that block is less than the mining reward. As such, as more people use Ethereum as a payment network, transaction processing times have been steadily increasing due to competition from other high-paying transactions that have been submitted by users willing to pay higher fees. In short: If you want faster processing times on the network, be prepared to pay a higher gas price.
There is no definitive answer to this question as it largely depends on the market conditions and what the miners deem acceptable. As a rule of thumb, you should aim to specify a gas price that is high enough so that your transaction is processed within a reasonable time frame, but not so high that you are losing money in the process.
Gas is an important part of the Ethereum network and, as such, needs to be taken into consideration when sending transactions. Make sure you are aware of the current gas prices and set your fees accordingly to ensure that your transactions are processed in a timely manner!