How do gas fee's work on Ethereum
This post will clarify exactly how GAS works and its role in sending Ether.
Any Ethereum user who would like to participate in an ICO should read up on it. By doing so, they will learn how exactly this decentralized platform works. For example, smart contracts and GAS play an important role in the functioning of Ethereum.
The Ethereum virtual machine
Ethereum is a platform on which software developers can build decentralized apps, also known as dApps. To truly understand the platform, you cannot ignore the Ethereum Virtual Machine (EVM). Simply put, it is a digital environment in which smart contracts, among other things, are executed.
Computers within the blockchain are known as nodes. Each node in the Ethereum network performs operations within the EVM and follows the same instructions, ensuring that everything is secure and orderly. It is a kind of supercomputer that prevents Ethereum from falling victim to external attacks that want to damage the network.
Ether: fuel of the network
The Ethereum network has its own currency called Ether (ETH). This is the fuel of the network. For every transaction you make, transaction fees must be paid. These fees are calculated in GAS, which are then paid in Ethereum.
Where do the transaction fees end up?
The transaction fees paid do not end up with the creator of the Ethereum wallet. Instead, you pay for transactions that miners perform in the network.
What if an Ether transaction fails?
You always pay for the calculation that miners make, whether the transaction is successful or not. Even when something has gone wrong, miners have the task of validating and executing the transaction.
Do you get Ether back in the event of a failed transaction?
In case of a transaction that did not go well, you will not get back the Ether that was used. However, your coins will simply remain in the wallet as the transaction is incomplete.
Price for calculations decoupled from Ether
The price for performing calculations is decoupled from Ether. This means that the cost of calculating a transaction never goes up or down. In this regard, it does not matter if Ether has large price fluctuations. You can check the current price of GAS on several websites, including EthGasStation and Etherscan.
Who makes money from GAS?
Ethereum GAS basically measures how much work a miner has to do to perform an operation in a certain way. This is important because execution of these calculations must be rewarded with compensation in the form of Ethereum GAS.
Reward provides an incentive
The more GAS is used, the more the miner earns. In fact, the reward is an incentive to continue mining. GAS can thus be seen as the engine of Ethereum network, while Ether is the fuel.
GAS Price and GAS limit
When talking about GAS you can talk about both the "GAS Price" and the "GAS Limit". There are a number of differences between the two terms. You can compare the GAS Price to the price of fuel you use for a car.
GAS Limit is different from GAS Price because it specifies how much GAS you are willing to spend on a transaction. This limit exists because otherwise there is a risk of a contract being circulated on the blockchain network for far too long. As a result, you could accidentally lose all your Ether, which is obviously not the intention.
Does a very high GAS limit fill in the blanks?
By the way, a very high GAS limit does not always mean that you will get your turn faster. There is always a risk that the transaction will fail and then you will still lose the miners fee.
Do you have to fill in a high or low GAS price?
Miners decide which transactions to include in the block. This way they can select transactions randomly or decide not to include any transactions at all in a particular block. To stimulate the miners to include your transaction you need to fill in a GAS Price that is high enough.
Miners' strategy when processing transactions
Most miners follow a simple strategy from high to low when processing transactions. They process the highest GAS Price first and lowest price last.
How to calculate the cost of GAS?
To calculate the cost of GAS, GAS Price and GAS Limit are multiplied by each other. You need to calculate GAS Price x GAS Limit for this purpose. The example of a car example comes in handy in this case. Imagine that you have to pay €2.50 for a liter of gasoline. You need 5 liters, which therefore means you need to calculate 5 liters of gasoline x €2.50. The total cost in that case is €12.50. A transaction with Ethereum is the same as the example above.
Calculating GAS: a practical example
A practical example makes the use of GAS and the GAS limit a little clearer. With the GAS limit, you specify how many units of GAS you want to use for a transaction. 21000 is usually sufficient for simple transfers. The GAS Price is expressed in GWEI, which is 1/1,000,000,000th part of Eth.
GAS Limit for ICOs
For ICOs, the limit is sometimes higher. Imagine that for a transaction you need 21,000 GAS. With a GAS Price of 6 Gwei, the exact calculation is (21000 (Gas) x 6 (GAS Price))/1,000,000,000 = 0.0000126 ETH. The total cost of a transaction is referred to as "TX Fee" in English.
Check the price per transaction
Remember that different types of transactions require various amounts of GAS. Always check this before making a transaction. Using too little GAS will result in a failed transaction. However, you lose the fees because the miner gets to keep them. If the GAS price is too high, you only pay the fee for mining. The remainder will be returned to you.
How to lower the GAS Price?
Some Ethereum users would like to use less transaction fees for ETH. In that case they lower the GAS Price. Of course, you can do this yourself as well. However, in return, miners are likely to process your transaction later. Miners decide which transaction to process first based on the level of the GAS Price. A low GAS Price therefore means a longer transaction duration.
Assume that a transaction of 4 GWEI generally takes a few minutes. At 40 GWEI or higher, transaction processing typically takes place in the next block, which takes an average of 15 seconds. Keep in mind, however, that the exact transaction time depends on several factors. For example, it may take slightly longer if the network is busy
The advantage of a high GAS Price
Miners are more likely to handle a higher GAS Price. Still, it is not always wise to enter a very high GAS Price. Some Token Sales have a maximum GAS Price. For example, consider 45 or 55 GWEI. Transactions with a higher GAS Price may be rejected because of this rule.
Therefore, always check the requested GAS Price before participating in an ICO.
What to do if your transaction does not appear on Etherscan?
It sometimes happens that a transaction via a wallet such as MyEther does not appear on Etherscan. In that case you should check the transaction and replace it with a higher GAS Price on this website. Are you sending the transaction via an exchange? Then it is usually a matter of patience.
Causes of delayed transactions
There can be several causes for a delayed transaction, such as an overloaded network. The combination of new users, increasing interest and ICOs are other reasons that can cause sending transactions to be slower than normal.
Not enough space in the blocks
With delayed transactions, there is not enough space in the blocks for the miners to mine all the transactions. Also, systems may simply not be able to handle the massive amounts of transactions.
What to do if you want to cancel a transaction?
You may want to cancel a transaction because you have discovered, for example, that incorrect data has been entered. In that case, you should cancel it as soon as possible, before it is mined. Remember that you have an average of thirty seconds. To cancel the transaction, you must overwrite it with another transaction.
Follow these steps:
- Go to Etherscan to view your transaction. You will see the number of the Ether transaction listed, called the nonce. The nonce is the number of transactions your Ether address has already made, so each transaction has a higher nonce.
- Go to the website www.myetherwallet.com and select the 'offline transactions' button.
- Enter your Ether address
- Send 0 ETH to your desired address.
- Use 21000 for the GAS Limit.
- Use a higher GAS Price than you normally do. 30 Gwei is generally fine. Remember, this is 30,000,000,000 Wei to be exact.
- Enter the nonce (the number) you received through Etherscan.
- Enter your private key.
- Sign the transaction.
- Send the transaction, which will overwrite your previous transaction.
- Repeat the step-by-step process if you want to cancel other sent transactions as well.
We hope you have learned a bit more about the fascinating Ethereum network and how it works. Here in Brickken our utility token $BKN, is an ERC-20 which runs on the Ethereum blockchain, so if you want to find out more about it, go to our IDO page!