Block value limitation of blockchain expansion scheme

Blockchain expansion has always been the focus of the blockchain team. Because Bitcoin's block size setting is fixed, and Nakamoto will limit the initial size to 1M, but as the transaction volume increases, the network congestion becomes more serious, eventually leading to Bitcoin's points. cross.

Different from the setting of the fixed size of Bitcoin, Ethereum introduced the concept of fuel and adopted the block gas limit dynamic adjustment mechanism, which is to adjust the Block Gas Limit according to the volume of the transaction. . Usually we use TPS to measure the transaction processing power of the blockchain. The larger the Block Gas Limit value, the more transaction volume that allows the block to be packaged, which means that the network has a higher TPS. Therefore, one of Ethereum's expansion plans is to increase the value of the Gas value to alleviate network congestion.

Gas Limit dynamic adjustment mechanism

Ethereum mainly determines the target fuel limit (TGL, Target Gas Limit) through the miner voting mechanism, and cannot be less than the minimum fuel limit (MGL, Min Gas Limit). The dynamic adjustment mechanism is mainly based on the block gas limit of the current block when the usage of the block gas exceeds 2/3 of the Block Gas Limit of the parent block, but the block gas limit of the current block is appropriately increased, but the TGL is not allowed to be exceeded.

However, there are drawbacks to the implementation of the expansion of the Block Gas Limit. If the Block Gas Limit has no upper limit, then the block must have a delay when broadcasting. The higher the TGL, the larger the Block Gas Limit value. The more transactions that are allowed to be packed into the block, the more gas is consumed, and the time it takes to synchronize to the entire blockchain network. The longer, the block is also likely to compete for failure due to the delay problem, and eventually abandoned as an Uncle Block.

According to Vitalik Buterin's scripting analysis, for every 1,000,000 gas value transaction in a packaged block, the probability of becoming a bad block increases by about 1.86%. On the one hand, because the blocks can only get 75% of the block rewards, the miners are not willing to choose to upgrade the TGL because of the interest. On the other hand, in the promotion of TGL, it also needs to face the problem of centralization of computing power. For the time being, no suitable mathematical algorithm has been found to set the TGL, and the decision is still attributable to the miners, so the dynamic adjustment mechanism of the block fuel limit still needs to be improved.

Gas related calculations

Gas is mainly used to pay the transaction fee, and its calculation is relatively simple. When we are trading, the maximum consumption limit of gas needs to be set by the trader, namely gas limit. Then we can get the maximum gas cost calculation formula for the transaction, as shown below:

Among them, the maximum value of the gas allowed to be consumed is expressed as the value of the unit gas, and the multiplication is the largest transaction fee. For example, if Gas Limit=50,000, Gas Price=20Gwei, then the maximum handling fee (calculated as the maximum consumption) is 0.001 ETH. among them

However, other expenses, such as contract creation fees, may also be involved in the execution of the entire transaction. Then the actual consumption of the gas calculation formula is as follows:

Among them, Predifined Gas Fee indicates the execution of the transaction booking fee, and Storage Fee indicates the gas cost of the data sent with the transaction (zero bytes and non-zero bytes will consume a certain amount of gas according to the corresponding set value), and Contract Creation indicates contract creation. There is an additional charge for the transaction.

Then, the remaining gas after the transaction is completed is the maximum gas cost of the transaction minus the Intrinsic Gas used.

Among them, Gas Limit≧Intrinsic Gas, after the transaction is completed, the remaining gas will be returned to the trader.

In terms of cost estimation, for the trader, the pre-gas fee can take the sum of the maximum gas fee and the total value of the transfer.

Among them, Upfront Cost represents the upfront cost of the transaction execution, Gas Limit represents the maximum amount of gas consumption, Gas Price represents the unit price of gas, and Value represents the total value transmitted by the sender to the receiver.

For the Ethereum network, "the network is blocked again" is often discussed. From the 2017 cat hacking network incident to the recent exchanges to swallow a single congestion incident, or in the face of hacker DDOS attacks, Ethereum also tried to solve the network congestion problem by adjusting the Gas value limit, although it can be seen temporarily Sexual effectiveness, but the problem is not completely solved, and other expansion plans are still needed to optimize network performance, thus effectively solving the network congestion problem.

(Source: Digital Qin Research Institute)