In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "What is the concept of Gas/ Gas Price/ Gas Limit". The small editor shows you the operation process through practical cases. The operation method is simple, fast and practical. I hope this article "What is the concept of Gas/ Gas Price/ Gas Limit" can help you solve the problem.
Gas
Gas corresponds to the actual number of steps of the Ethereum Virtual Machine (EVM) in a transaction. The simpler the smart contract transaction, such as a pure ether transfer contract transaction, the fewer the number of steps required, and the Gas will also require a little less. On the other hand, if you want to calculate some complex calculations, the consumption of Gas will be large. So the more calculations the EVM needs to perform for the transactions you submit in smart contracts, the higher the Gas consumption required.
Gas Price
Gas Price is how much Eth you are willing to pay for a unit of Gas, usually in Gwei. Therefore, the higher the Gas Price, the more Eth will be paid for each step in the smart contract transaction.
You may be unfamiliar with the unit Gwei, which is actually 10 ^ -9 Eth, that is, 1 Gwei = 0.000001 Eth. So, when you set Gas price = 20 Gwei, it means you are willing to pay 0.000002 Eth for a single step operation.
Having said that, smart people like you will realize that the calculation formula for handling fees in Ethereum smart contract development is very simple:
Tx Fee = Actual Gas Used * Gas Price
For example, your smart contract transaction requires Ethereum to perform 50 steps to complete the operation, assuming that your Gas Price is 2 Gwei, then the transaction fee in the entire smart contract development is 50 * 2 = 100 Gwei.
Gas Limit
Gas Limit is the maximum number of steps you can take in a trade. Since transactions vary in complexity, the exact amount of Gas consumed will not be known until the transaction is completed, so you need to set a cap on Gas consumption for the transaction before you submit the transaction.
If you submit a transaction that has consumed more Gas than your Gas Limit before it is completed, the transaction will be cancelled and the fee already consumed will also be deducted-because the miner has already paid the labor. If the transaction has been completed and the Gas consumed has not reached the Gas Limit, the transaction service fee will only be charged according to the actual Gas consumed. In other words, the highest service charge that can be charged for a transaction is Gas Limit * Gas Price.
Finally, it is worth mentioning that the higher the Gas Price, the faster the trades you submit will be accepted by miners. However, people are usually reluctant to pay more fees, so how much should the Gas Price be set to ensure that transactions are confirmed to the region chain within the normal time (eg 10 mins)? This website can help you. At the time of writing, 1 Gwei's Gas Price ensures that trades are accepted in about 50 seconds.
This is where the concept of "Gas/ Gas Price/ Gas Limit" ends. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the industry information channel. Xiaobian will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.