Three minutes to understand GasNow: the real Gas price indicator
Editor's Note: This article comes fromEthereum enthusiasts (ID: ethfans), Author: A Jian, reproduced by Odaily with authorization.
Editor's Note: This article comes from
Ethereum enthusiasts (ID: ethfans)
Ethereum enthusiasts (ID: ethfans)
, Author: A Jian, reproduced by Odaily with authorization.
Simply put, Gas is a unit used to measure the amount of computation required for a transaction on Ethereum. The higher the complexity of a transaction, the more Gas it needs to spend. Therefore, the more complex the transaction, the more Gas quota must be set (reserved) when initiating the transaction. If the initiator reserves If the amount of Gas left is not enough, the transaction will fail due to the exhaustion of computing resources.
But the good thing is that you don’t need to worry about this matter. You can set a value that is affordable and sufficiently large in your own account, because the unused Gas will not calculate the handling fee. In other words, although you set this amount The transaction can use 100 Gas, but in fact it only uses 20 Gas, so the block producer who packaged your transaction can only get 20 Gas as a handling fee, and you cannot charge it in vain. In addition, gas usage estimation technology is now very common. When users use the Metamask wallet plug-in to interact with applications, they will find that they do not need to manually set the Gas Limit at all. The plug-in has already estimated it for you.
But when it comes to Gas Price, it's a headache. Everyone knows that this parameter expresses the price that the transaction initiator is willing to pay for each unit of Gas, and this part of the price will eventually be obtained by the block producer who packaged the transaction; in view of this, the block producer certainly favors Those transactions with high Gas Price. But, who wouldn't want to make the transaction fee cheaper? Who doesn't want to close a deal affordably?
image descriptionThis article- Its general meaning is: if you want your transaction to be packaged within 2 minutes, then you need to set a Gas price of 95 Gwei or higher; if you only need it to be packaged within 5 minutes, then set 79 Gwei or more is fine. -
Most users like you and me will find nothing wrong with using Gas Station. But what if you want to do high-frequency trading? Or what if you want to write a trading robot? Can Gas Station really be relied on?
This is not finding fault, nor is it playing tricks.
This articleIt mentioned the difficult experience of many users on March 14, 2020 (due to the sharp drop in ETH prices, which led to a large increase in chain activity): In the Ethereum protocol, transactions initiated by an account are in order, and one only increases but not Subtract the serial number nonce to mark the order; when your previous transaction is discarded by the block node because the Gas Price is too low, no matter how high the Gas Price you set for the subsequent transaction, it will not help, because the node cannot Skip the previous transaction and package the subsequent transaction directly, but the previous transaction has been discarded, which is equivalent to locking your account. The only remedy is to retrieve your earliest transaction that has not been uploaded to the chain, use the serial number of this transaction to resend a transaction, and the Gas Price must be high enough. Similarly, many trading bots are stuck for the same reason. The reason is that the gas price reporter they rely on incorrectly estimates the network Gas price. After sending a few transactions, the bot is stuck.These bloody lessons fully illustrate how important it is to arrange a suitable Gas price for each transaction. Because when the application on the chain is active (such as the Yield Farming craze some time ago), the success of a transaction will not only affect this transaction, but also affect subsequent transactions.
But what is preventing us from getting accurate gas price estimates? Can we get over it?
peer-to-peer network architecture
: All nodes are decentralized. When a transaction is sent to a node, the node will broadcast the transaction data to other nodes after a certain check; this network structure determines that no node can real-time To obtain the global state of unprocessed transactions in the entire network, the propagation of transactions takes time and accidents (some nodes may use a higher Gas Price as a threshold and reject transactions with low fees to protect themselves). Regarding this point, we can only improve it, but it is impossible to fundamentally overcome it, because we do not want a centralized network structure.
But on the other hand, what is crucial is the way we estimate the gas price. So far, the methods used by most of the gas price indicators are based on the gas price of the transactions that have been packaged into the block for a period of time in the past, and the gas price of the transaction is processed statistically to obtain an estimate of the future gas price. If you think about it carefully, this is actually very unreasonable. At the moment you send a transaction, what determines how quickly your transaction can be uploaded to the chain is the number of transactions with a higher Gas price than your transaction in the existing unprocessed transactions, and the number of transactions in your transaction. How many people have issued a transaction with a higher gas price than yours during the period when the transaction has not been packaged. It seems reasonable to use the transactions already on the chain, that is, historical data, to make such an estimate, but it is actually absurd. When network activity increases rapidly and Gas prices rise rapidly, the method of estimating based on historical data will most likely only give an underestimated Gas price. A more accurate estimate should be based on the gas price distribution of existing unprocessed transactions. Even if statistical methods are required, it will be simpler than using historical data to estimate.
This is where GasNow is great. It is no longer based on historical data to predict the future, it is based on the gas price distribution of transactions in the transaction pool of spark mining pool nodes. In order to maximize the income, on the one hand, the mining pool should collect transactions as much as possible, and on the other hand, it should package the transactions to be packaged in the transaction pool from high to low. Therefore, the data given by GasNow is truly meaningful.


