Why does the Stacks layer sometimes skip Bitcoin blocks?
by Mitchell Cuevas on November 17, 2023
Under normal circumstances, the Stacks layer creates a new block with every new Bitcoin block. In other words, the current consensus mechanism (Proof-of-transfer) ensures everything that happens on the Stacks layer, eventually ‘settles’ to the Bitcoin base layer. But sometimes, a new Bitcoin block will come and go without a new Stacks block.

There are several reasons Stacks blocks might be missed this way, all of which are within the normal bounds of healthy operation. That doesn't mean, however, that this behavior isn't without downsides. When blocks are missed, especially several in a row, transactions are forced to wait longer for confirmations which negatively impacts the user experience. Because the network has seen this happen a couple of times in the past several weeks, this post will synthesize information on the causes and solutions.
Higher Bitcoin transaction fees, especially when unexpected
Most recently, the Stacks chain has seen missed blocks due to fees on the Bitcoin network being higher than expected. Fee spikes have been driven by things like Ordinals and BRC-20 related releases of late, but can happen anytime there is competition for blockspace. When this happens, miners need to update their configs to avoid missing their block-commits and when there is a lag before they do, it is more likely the network will see missed Bitcoin blocks.
Flash blocks
Occasionally, an empty or near-empty Bitcoin block will be mined unusually quickly. In this case, the Bitcoin block will be mined before a Stacks miner has a chance to submit their block-commit transaction and the block will be missed. You can read a little more about this in CoinTelegraph.
Other potential reasons for missed blocks
For the most part, fee spikes and flash blocks are the culprits for missed Stacks blocks. However, there are other less common potential reasons they might happen:

  • The winning Bitcoin miner was unwilling to consider the transaction, because it arrived too late or didn’t have a high enough fee for their liking.
  • The node that produced the block-commit was not aware that the Bitcoin block they were targeting was no longer the Bitcoin chain tip (i.e. they were behind).
  • If a miner that produced a block is not aware of a Bitcoin fork and attempts to write their block-commit transaction to the non-canonical Bitcoin chain tip, this can cause the actual canonical chain tip block to be missed.
  • The node that produced the block-commit is out-of-date, and does not have the latest performance improvements that would reduce the likelihood of this event.
  • Since mining is an open network and we do not know the identities of all miners, they can misconfigure their nodes and there is not much that can be done about that, except to wait for them to suffer the economic consequences, as this activity is far less profitable than honest mining.
Solutions
First, a major part of the Nakamoto release is that Stacks blocks will no longer be coupled to Bitcoin blocks for the purpose of mining, meaning that after Nakamoto upgrade, the network can keep producing blocks at a fixed cadence regardless of how often block-commit transactions are confirmed. While this change doesn’t specifically address flash blocks, because Stacks block production cadence is no longer coupled with Bitcoin blocks by the block-commit transaction, chain liveness is not directly affected by missed Bitcoin blocks, and as a result will prevent chain stalls.

In the short term, several mitigation paths are already in place, but depend on miners to adopt:

  • Likely the simplest solution, miners can update their configs. For example, bitcoinfees.net is a good resource to see what value miners should set for their satoshis_per_byte to ensure block-commit transactions are picked up by the Bitcoin network. More info for configuring a miner can be found here and channels where miners frequent have been updated.
  • Related, a PR that sets the stage for miners to automate fee adjustments is being reviewed here. When merged, this PR will allow miners to update their config whenever Bitcoin tx fees are spiking, without the need to manually intervene or restart their miner software.
  • Last but not least, at the Stacks Foundation, we’re working with a developer to explore enabling an automatic fee adjustment tool for miners and will open-source the solution if it proves viable. Please contact [email protected] if you’re interested in collaborating. Note: The Stacks Foundation will mine on occasion to gather data, test solutions, or otherwise support the network during upgrades and more.
Why is this a good thing for Stacks and Bitcoin?
Transaction fees on the Bitcoin network are up 100x and seemingly in a sustained manner. As more projects enter the picture to help developers create interesting experiences for Bitcoiners, this will likely continue. As this happens, pressure to push activity to the L2s will grow, setting the stage for Stacks and others to serve this demand and activate the Bitcoin economy. Now is the time to build on Bitcoin L2s!