Those who have used blockchain-related applications, whether they are exchanges, DApps, or virtual currency wallets, must have heard the term Gas Fee. It is a fee that you have to pay to the miner when you want to initiate a transaction on the blockchain network.
A practical example that everyone is familiar with is analogous. When you want to transfer money between different bank accounts, you must pay a fee for the services provided by the bank.
Similarly, the miners of the blockchain should package your trades and put them on the blockchain in order to complete the transaction. In this process, the blockchain computing resources will be consumed, so the miners will be paid.
On the Ethereum network, ETH (Ethernet) is used to pay for miners. If you want to send Ethernet currency exchange or purse and ERC 20 tokens, and smart or interactive contracts, such as participation in ICO or use DApp, etc., must be used to pay miners ETH fee.
Take the above MetaMask screenshot as an example. Each time you want to transfer the Ethereum, you will be taken out of this operation screen. There are two fields in the picture related to the miners' fees, namely "Gas Limit" and "Gas Price". In each transaction, you can adjust these two values ??as needed.
Gas Fee = Gas Limit x Gas Price
calculated the total amount of the miners Gas Limit fee is multiplied by the Gas Price. Thus the first figure and Gas Limit Gas Price multiplying two numbers, and then converted into credits ether (1 ETH = 10 ^ 9 GWEI ): 21000 x 10/10 ^ 9, you can get the total amount of charges miners 0.00021 ETH .
Gas Limit is the maximum number of Gas units you are willing to pay in this transaction. The number of Gas units required to complete a transaction depends on the complexity of the transaction. When a transaction is more complicated, it has to consume more computing resources, so it takes more Gas.
It is important to note that when the set of Gas units is not enough, the transaction will fail. 21,000 is the Gas Limit default for general transfer transactions. If you want to participate in token sales or use DApp, because the process involves more complex smart contracts, set a higher Gas Limit.
Gas Price is the price per unit of Gas, expressed in GWEI. It will affect the speed at which your trades are packaged by miners and placed on the blockchain.
If Gas Price is set higher, it will give the miners a bigger incentive to package your trade; on the contrary, if Gas Price is set low, it will take a long time. If you are not in a hurry to complete a transaction, you can choose a lower Gas Price to save money.
After you have a basic understanding of the miners' fees, then you can see the six key points you must know:
1. Note that when Gas Limit is set to participate in token sales, you should set the Gas Limit to the value recommended by the seller. Because the smart contract for token sales is more complicated than the general transfer transaction, the Gas Limit is also set higher. I used to be in the ICO because I didn't know how to change the Gas Limit from 21,000 to 100,000 and I got an "out of gas" error.
2. To save on miners, you should lower Gas Price instead of Gas Limit.
As mentioned earlier, if you lower the Gas Limit, you may not be able to meet the Gas required to complete the trade, causing the trade to fail. So to save on miners, lower Gas Price and wait patiently for the transaction to complete.
3. You can get back the unused Energy Gas without worrying about setting the Gas Limit too high. If Gas is not used up, it will be returned to your account after the transaction is completed. You can check the transaction on Etherscan. The details. In the screenshot below, we can see that the Gas Limit setting is 100,000, but in fact only 35,826 is used, so the remaining unused Gas will be returned.
4. If the transaction fails, you still have to pay the miner's fee. If you accidentally set the Gas Limit too low, the transaction will fail, and the miner fee will not be returned to you, because you still have to pay for the operation of the blockchain. fee.
5. Make sure there is enough ETH to pay for the miners.
Remember that you must pay ETH for MIT or ERC20 tokens. Sometimes everyone will forget that there must be ETH in the wallet to be able to send tokens.
6. Practical gadgets: ETH Gas Station, Etherscan
On ETH Gas Station, you can find the Gas Price based on the Ethereum network congestion level, depending on whether you want to save miners, or want to complete the transaction quickly. On Etherscan, you can find out more about each transaction, including Gas Limit, Gas Price, and the miners actually used in the transaction.