CRYPTO

    Into the mempool: Empty blocks

    21 April 2021. Written by Daniel Hwang

    Empty blocks. What are they good for? Absolutely… nothing? The incentivization mechanism which is built to enforce proper behavior, mining empty blocks is a side effect of the chain's developing cryptoeconomic growth.


    The various reasons as to why empty blocks have been mined in the past have been covered extensively¹ ² ³. Many reasons have been due to technical inefficiencies that have now been remediated, but some still will inevitably persist. As an example, expedient block propagation and download times had at one point been an issue for Chinese miners trying to get around regulations of cross-border internet traffic (aka the ‘Great Firewall’⁴). This was in effect solved. Geography agnostic block propagation times still also existed due to inefficient software, but that has also been solved with updates and tailor-made protocols like FIBRE⁵. Finally, one of the persistent and remaining reasons for empty block mining has been the unavoidable time it takes to download and validate newly packaged blocks. This still continues to be a major source of why some miners (and mining pools) end up mining empty blocks.

    Why do mining pools mine empty blocks?

    In short, many empty blocks are mined because of the inevitable block validation time lag and its consequences on mining fresh blocks vs invalidated blocks.

    New Adventure

    To understand this concept, let’s go on a journey describing the lifecycle of a hypothetical miner.

    Miner Lifecycle

    You are a miner. You’re doing your thing, mining blocks. You’re sifting through the mempool and choosing attractive transactions with high fees and bundling them up into your blocks. You’re also racing other miners to be the first to craft a valid block.

    Valid Block

    The interesting thing about the mempool that you and all the other miners are drawing from is that it’s not an exclusive selection mempool. If you and another miner choose the same transaction, both of you can use it at the same time to create and mine your own blocks! This is the compilation phase and it’s a race. Whoever can find the ‘proof of work’⁶ solution first (a nonce satisfying the network’s difficulty requirements) wins.

    Nonce

    So here you are, grabbing up all the juicy high fee transactions for your block so you can get hammering away at maximum speed to find nonces for your block. Others probably grabbed many of the same high fee transactions as well. Therefore the compilation of transactions making up your block have potential overlap! And indeed there is… Another miner just so happens to be working on his own block and with some of the same transactions as yours! The stakes are set. The race is on.

    New Blocks

    A few minutes pass and you hear the broadcast. A block has been successfully formed and is now being broadcast to the entire network. Your heart skips a beat. There are consequences to this. If this broadcast block also contains a transaction you bundled up in the block you’re currently working on, then that makes your block invalid! All that time and energy wasted! To go a bit deeper, every time a block is broadcast you, as a miner, must make sure all the transactions in that block are valid. Once verified as all valid, these transactions must be removed from the mempool.

    So now what do you do? Count that lost time you spend hacking away at nonces for your now invalid block as a loss or are there other options to leverage time spent? It seems there are. You can mine an empty block…

    Empty Blocks

    What are they good for? Absolutely… nothing?

    Why in the world would miners want to mine empty blocks? As mentioned earlier, this has to do with the literal millisecond differences between block validation times and time spent on mining. In this industry where time is quite literally money, every second counts. Particularly in decentralized and trustless networks, proper behavior is incentivized. Miners enforce the proper inclusion of valid transactions and defend against malicious activity like double spend attacks which they are incentivized by coinbase block rewards. Fees on transactions help miners to determine which transactions to prioritize and act as an additional incentive for miners.

    Miners calculate their revenues by adding proceeds from block rewards and transaction fees. Miners must ensure that profit maximization per time and energy cost spent is carefully thought out. In the example above, the incurred tradeoff cost of time spent validating a broadcast block in a synchronous manner is very relevant. The block you spent time mining may be completely invalidated. Continuing work on a potentially invalid block is inefficient. Therefore, that tiny millisecond difference in time (approximately 100ms at this point) spent between a miner spending time downloading and validating a block can actually be spent pushing out an empty block and receiving rewards (though without the added benefit of additional aggregated transaction fees). This process of validating a broadcasted block’s transactions and subsequently having to remove them from the mempool is time consuming (even to the millisecond level).

    Now, this situation is not ideal for a PoW-based blockchain. An ideal system should never promote empty blocks as it is inefficient from the perspective of the system’s users. However, from the miner’s perspective, the incentivization mechanism which is built to enforce proper behavior, mining empty blocks is a side effect of the chain’s developing cryptoeconomic growth.

    As we have seen, the many reasons for empty block mining have primarily been technical in nature and have been solved via software solutions and the advancing pace of internet infrastructure innovation (aka literal latency times, download speeds, and even sovereignty-based internet ‘great walls’). However, until the latency of block validation times is sufficiently minimized, there will still be an opportunity cost tradeoff for empty block mining.

    Further there is a constant race for advantage that miners face. This race is summarily represented by the situation in which miners who are successful in finding a block first can immediately begin work on the next block with a fresh set of transactions that will not put their block at risk of invalidation. This immediacy gives them a leg up on the rest of the miners in a network because they do not have to wait that 100ms for download and validation. And on the network, every millisecond is valuable. Other miners who have not produced blocks yet have to play that constant game of catch up with borrowed time. This is a potential centralization risk that exists for the benefit of miners who have already successfully found blocks. The more blocks found, the more of a leg up you have.

    Thus, if you were to create and mine an empty block without any risk of invalidation because of prior dependencies (existing blocks), then you, as a miner, can still be at a level playing field of which such a process detracts from centralization risks.

    However, as PoW networks mature with halvings, the incentive to mine these empty blocks will decrease dramatically as the aggregation of transaction fees making up blocks will sufficiently outpace that of the block rewards themselves.

    Chi Gastoken

    So now what can we as members of the ecosystem do? There is an unavoidable incentive that miners have in their cost basis for mining empty blocks. Enter CHI gas token. What if instead of just mining an empty block, we add something at least useful to it? This is why instead of empty blocks, there are CHI gas token transactions added to these blocks.

    Here is a quick primer on CHI gas tokens and why they exist.

    The Chi Gastoken is an ERC20-standard token that is meant to be used on 1inch exchange to pay transaction costs. The idea is similar to the GasToken token concept but it has some improvements. Chi is pegged to the Ethereum network’s gas price. When the gas price is low, the Chi price is also low, and the opposite. Just like GasToken, Chi is tokenized gas on the Ethereum network. The only difference is that Chi is used on 1inch and Curve, while GasToken is used across the entire Ethereum network.⁸

    Every transaction on the Ethereum network requires some gas. A Gastoken facilitates transactions with the same amount of work but less gas. A Gastoken takes advantage of the Ethereum storage refund. To encourage smart contracts to erase unnecessary storage, Ethereum provides a refund for each zeroed element. So, in the process of burning, a Gastoken’s smart contract erases storage that were filled during minting. The most efficient storage gas refunds are achieved by creating and destroying sub smart contract, not by direct writes and erases of the storage.⁷

    In effect these CHI gas tokens are responsible for efficient gas usage and represent a means of at least providing some utility to blocks that would have been otherwise empty. The incentivization schemes for proper miner (and mining pool) behavior on PoW chains like Bitcoin and (currently) Ethereum is a continuing evolving balance. We have seen, historically, the development of appropriate algorithms supply efficient broadcast measures around technical barriers around the ‘great firewall’ to reduce block broadcast and download times. However, there still exists a cryptoeconomic dance between cost effective mining strategies that are works in progress. Empty blocks being mined by miners and mining pools have existed in their vanilla states with no transactions beyond the coinbase or they have existed with some utility as we’ve seen with CHI gas token transactions being stored. Ultimately, as time passes on PoW networks, with subsequent halvings on block rewards, there will be more robust guarantees for favoring full blocks over empty blocks as block reward values decrease relative to that of aggregate transaction fees in a block.

    Footnote: For specificity on PoW mining of empty blocks, there is differentiation on mining empty blocks on Bitcoin and on PoW Ethereum. As we have gone into more depth in this post, mining empty blocks of ETH and BTC may be attributed to different reasons. For instance, with BTC, mining pools can obtain the latest block height from other mining pools, not from nodes. As a result, pools may mine a block without any transactions because they don’t know any transactions. For ETH, it is better but still has the general challenges discussed in this piece.

    Sources

    [1] https://bitcoinmagazine.com/business/decline-empty-blocks-has-increased-bitcoins-transaction-capacity

    [2] https://bitcoinmagazine.com/business/why-do-some-bitcoin-mining-pools-mine-empty-blocks-1468337739

    [3] https://bitcoin.stackexchange.com/questions/83358/reason-for-mininig-a-block-without-transaction

    [4] https://en.wikipedia.org/wiki/Great_Firewall

    [5] http://bitcoinfibre.org/

    [6] https://en.bitcoin.it/wiki/Proof_of_work

    [7] https://medium.com/r?url=https%3A%2F%2Fblog.1inch.io%2F1inch-introduces-chi-gastoken-d0bd5bb0f92b

    [8] https://medium.com/r?url=https%3A%2F%2Fblog.1inch.io%2Feverything-you-wanted-to-know-about-chi-gastoken-a1ba0ea55bf3

    Written by Daniel Hwang

    Daniel Hwang

    Twitter