CoinDesk Explainer: How BIP 91 Enacts SegWit While Avoiding a Bitcoin Split

computer-keys-e1500338088894
18 July 2017

While many thought signaling for the controversial scaling proposal Segwit2x wouldn’t begin until July 21, bitcoin miners are now doing just that by way of a piece of code called BIP 91.

At press time, nearly 60% of the last 144 blocks mined have signaled support for the measure. But, what are miners signaling for, and what does bitcoin improvement proposal (BIP) 91 mean for the network?

As the first part of the Segwit2x scaling plan, BIP 91 does two things:

  • It makes it significantly easier for the network to adopt Segregated Witness (SegWit), a backward compatible upgrade that fixes transaction malleability and clears the path for off-chain solutions like Lightning Network.
  • If activated by July 31, BIP 91 will supersede BIP 148, a proposal that poses a risk of causing the network to split.

The basics

Segwit2x was introduced during CoinDesk’s Consensus 2017 conference in May. Based on a fork of the Bitcoin Core software client called BTC1, Segwit2x seeks to both implement SegWit and raise the block size limit.

About a month later, in response to that, Bitmain Warranty engineer James Hilliard introduced BIP 91 as a way to implement SegWit quickly and safely, without the risk of splitting the network.

He specifically developed the proposal with two other active proposals for scaling bitcoin in mind.

These include:

  • BIP 141: Introduced in November 2016, BIP 141 is the original plan for activating SegWit.
  • BIP 148: Released in March, BIP 148 was developed as a way to push through the stalled BIP 141 via a user-activated soft fork (UASF).

But, more importantly, BIP 91 was proposed as an alternative to having to completely redeploy BIP 141, a task that would have been technically infeasible, given that BIP 141 does not expire until mid-November.

To explain further, a bitcoin soft fork deployment requires that miners set a bit in the version field of blocks they mine to signal their readiness to enforce new rules. Segwit2x originally called for BIP 141 to require a “bit 4” signalling, but BIP 141 was already coded to respond to “bit 1” signalling.

So, to get around that, BIP 91 employs a clever trick. Rather than change the existing SegWit activation logic, it uses a secondary bit to signal mandatory enforcement of the original bit.

As such, BIP 91 uses the same BIP 9 soft fork deployment method as BIP 141, but with a few key differences:

  • Miners signal with “bit 4,” as opposed to “bit 1”
  • Activation only requires 80% as opposed to 95% of hash power support
  • The activation window is 336 blocks, as opposed to 2,016.

So, once that 80% threshold is reached, BIP 91 locks in, and another 336 blocks later, it activates.

At that point, BIP 141 is enforced using the same technique as BIP 148:

  • Miners begin signaling with “bit 1”
  • Any blocks that do not signal with “bit 1” will be blocked from the network.

As long as 51% of miners (by hash power) enforce the mandatory “bit 1” signalling, the chain will not split. And since a majority will have already supported BIP 91 activation via the “bit 4” signalling, maintaining that hash power is unlikely to be a problem.

Two weeks (2,016 blocks) after enforcement begins, BIP141 locks in, and another two weeks after that, SegWit activates.

Opposition and support

BIP 91 was also a recognition of the realities of the scaling debate.

Namely, the fact that, nearly a year down the road, BIP 141 still has not gained traction with miners. While BIP 141 requires a 95% miner support (by hash power), the figure has remained stuck at around 30%, though recently it increased to 45%.

But if BIP 91 is almost identical to BIP 141, why didn’t miners signal support for the latter?

The reason is two-fold:

  • First was the high bar set to achieve activation. BIP 141 requires a super majority of miners to signal their readiness within a two-week (2,016 block) activation period.
  • Second, it is possible some miners were holding out for a block-size increase, a measure that has been embraced by the Segwit2x proposal.

A fast lane to SegWit

But, the proposal that has had the biggest impact on BIP 91’s design is BIP 148, the so-called UASF discussed above.

In many ways, BIP 91 can be read as an effort to front-run the BIP 148 proposal, thus removing the potential of creating two rival bitcoin blockchains, each with competing assets.

To resolve that issue, Hilliard proposed that BIP 91 should activate before BIP 148’s August 1 deadline. And of course, he made that possible by essentially shortening BIP 141’s original two-week activation period to 56 hours.

Miners today are signaling their support for BIP 91 early because of the perceived need to avoid the split BIP 148 could create or, as others speculate, because some miners think that a successful UASF would reduce their control over network changes.

For now, your best bet is to watch the upcoming 336-block periodBeginning tonight at block 476,448, this is the next period during which miners can signal for BIP 91.

Should 269 blocks signal for BIP 91 within a 56-hour window, BIP 91 will lock-in, setting the stage for the next phase of Segwit2x this autumn, or possibly later.

And, with bitcoin’s three largest mining pools throwing their computing power behind the effort, it is possible that the threshold will be reached before the end of the week.

Edit: BIP 91 lock in requires 269 (80%) of blocks to signal over 336 block period. An early version of this story incorrectly stated 226 blocks were needed.

Disclosure: CoinDesk is a subsidiary of Digital Currency Group, which helped organize the Segwit2x agreement.

Computer code image via Shutterstock