Advertisement
Guest User

Untitled

a guest
Jun 26th, 2015
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.93 KB | None | 0 0
  1. BIP: ??
  2. Title: Version bits
  3. Author: Pieter Wuille <pieter.wuille@gmail.com>, Peter Todd <pete@petertodd.org>, Greg Maxwell <greg@xiph.org>
  4. Status: Draft
  5. Type: Informational Track
  6. Created: 2015-01-16
  7. </pre>
  8.  
  9. ==Abstract==
  10.  
  11. This document specifies a proposed change to the semantics of the 'version' field in Bitcoin blocks, allowing multiple backward-compatible changes (further called called "soft forks") being deployed in parallel. It relies on interpreting the version field as a bit vector, where each bit can be used to track an independent change. Once the consensus change takes place, the bit is no longer necessary, and can be reused for later changes. In case a change is not adopted by majority vote before a pre-set timestamp, it is reverted and the used bit becomes available again as well.
  12.  
  13. ==Motivation==
  14.  
  15. BIP 34 introduced a mechanism for doing soft-forking changes without predefined flag timestamp (or flag block height), instead relying on measuring miner support indicated by a higher version number in block headers. As it relies on comparing version numbers as integers however, it only supports one single change being rolled out at once, requiring coordination between proposals, and does not allow for permanent rejection: as long as one soft fork is not fully rolled out, no future one can be scheduled.
  16.  
  17. In addition, BIP 34 made the integer comparison (nVersion >= 2) a consensus rule after its 95% threshold was reached, removing 2<sup>31</sup>+2 values from the set of valid version numbers (all negative numbers, as nVersion is interpreted as a signed integer, as well as 0 and 1). This indicates another downside this approach: every upgrade permanently restricts the set of allowed nVersion field values. This approach was later reused in BIP 66, which further removed nVersion = 2 as valid option. As will be shown further, this is unnecessary.
  18.  
  19. ==Specification==
  20.  
  21. ===Mechanism===
  22.  
  23. '''Bit flags'''
  24. We are permitting several independent soft forks to be deployed in parallel. For each, a bit B is chosen from the set {0,1,2,...,28}, which is not currently in use for any other ongoing soft fork that hasn't progressed into the implied or rejected state (see further). A deadline timestamp D is also chosen. Miners signal intent to enforce the new rules associated with the proposed soft fork by setting bit 1<sup>B</sup> in nVersion to 1 in their blocks, before the deadline D is reached.
  25.  
  26. '''High bits'''
  27. The highest 3 bits are set to 001, so the range of actually possible nVersion values is [0x20000000...0x3FFFFFFF], inclusive. This leaves two future upgrades for different mechanisms (top bits 010 and 011), while complying to the constraints set by BIP34 and BIP66. Having more than 29 available bits for parallel soft forks does not add anything anyway, as the (nVersion >= 3) requirement already makes that impossible.
  28.  
  29. '''Thresholds'''
  30. For each soft fork, two threshold conditions are tracked. Whenever A out of the W predecessors of a block, plus the block itself have bit B set, and all of those (W + 1) blocks have a GetMedianTimePast() below D, consensus rules related to the soft fork apply to that block (called activation). Whenever I out of any W subsequent blocks (regardless of the block itself) have bit B set, and all of those W blocks have a GetMedianTimePast() below D, the consensus rules related to that soft fork also apply (called implication) to any successor of those W blocks (called implication). Whenever a soft fork is implied for a block, its bit B should not be set anymore, allowing the bit to become available immediately again. The values A, I and W are chosen to be identical to BIP34 (750, 950, and 1000 for Bitcoin mainnet). Comparisons happen against the GetMedianTimePast(), because it is by consensus rules guaranteed to be monotonic.
  31.  
  32. '''Warning system'''
  33. To support upgrade warnings, an extra "unknown upgrade" is tracked, using the "implicit bit" mask = (block.nVersion & ~expectedVersion) != 0. Mask will be non-zero whenever an unexpected bit is set in nVersion. Whenever activation for the unknown upgrade is detected, the software should warn about the presence of an unknown network rule. When implications triggers, the software should warn even louder, and probably keep warning even if the threshold is not reached anymore for later blocks (assuming an unknown soft fork reached implied state, and is thus no longer detectable).
  34.  
  35. ===Support for future changes===
  36.  
  37. The mechanism described above is very generic, and variations are possible for future soft forks. Here are some ideas that can be taken into account.
  38.  
  39. '''Modified thresholds'''
  40. The thresholds chosen in BIP 34 (750, 950, 1001) do not have to be maintained for eternity, but changes should take the effect on the warning system into account. In particular, having an implication threshold that is incompatible with the one used for the warning system may have long-term effects, as the warning system cannot rely on a permanently detectable condition anymore (as opposed to the BIP 34 based mechanism).
  41.  
  42. '''Conflicting soft forks'''
  43. At some point, two mutually exclusive soft forks may be proposed. The naive way to deal with this is to never create software that implements both, but that is a making a bet that at least one side is guaranteed to lose. Better would be to encode "soft fork X cannot be activated or implicated" as consensus rule for the conflicting soft fork - allowing software that supports both, but can never trigger conflicting changes.
  44.  
  45. '''Multi-stage soft forks'''
  46. Soft forks right now are typically treated as booleans: they go from an inactive to an active state in blocks. Perhaps at some point there is demand for a change that has a larger number of stages, with additional validation rules that get enabled one by by. The above mechanism can be adapted to support this, by interpreting a combination of bits as an integer, rather than as isolated bits. The warning system is compatible with this, as (nVersion & ~nExpectedVersion) will always be non-zero for increasing integers.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement