Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Ledger Model

Bitcoin validation is modeled as deterministic state transition over a proof-of-work header graph, available block data, and the active UTXO set. This section fixes the shared relations used by later sections.

State

A full-validation node’s protocol state is:

$$ S = (C,H,B,U,Q,\Pi) $$

SymbolTypeMeaning
$C$ActiveChainOrdered sequence of connected blocks from genesis to the active tip.
$H$HeaderIndexKnown block-header graph keyed by block hash, including height, predecessor, target, timestamp, and accumulated work.
$B$BlockDataSetFull block data known to the node, keyed by block hash.
$U$UTXOSetMap from unspent outpoints to coin records at the active-chain tip.
$Q$MempoolLocally accepted unconfirmed transactions. This is relay state, not consensus state.
$\Pi$PeerSetConnected-peer state and negotiated network capabilities.

Consensus validation reads $C,H,B,U$ and mutates only $C,H,B,U$. Mempool and peer transitions read consensus state but do not define block validity.

Coins

The UTXO set maps outpoints to coins:

$$ U[(txid,n)] = (value, scriptPubKey, height, coinbase). $$

Coin fieldTypeMeaning
valueAmountOutput amount in satoshis. Consensus-valid values are in the money range.
scriptPubKeyScriptLocking script committed by the creating transaction output.
heightuint32Active-chain height of the creating transaction.
coinbaseboolTrue iff the creating transaction is the block coinbase.

Rule context

Let $N$ be the selected network parameter set. For candidate height $h$, candidate block time $t$, and active chain $C$, define:

$$ R = \operatorname{Rules}(N,C,h,t). $$

$R$ is the set of consensus rules active for the candidate object. It includes network constants, buried activation heights, versionbits state, timestamp rules, and script flags. Later sections use $R$ rather than restating whether P2SH, BIP34, strict DER, locktime, sequence locks, SegWit, Taproot, Tapscript, or network-specific timewarp mitigations are active.

Validity classes

ClassMeaning
$DecodeValid_T(b)$$E_T^-1(b)$ succeeds and consumes a canonical encoding of type $T$.
$FormValid(x)$Object $x$ is internally well-formed independent of chain state.
$ContextValid_R(x,C)$Object $x$ satisfies height, time, and active-rule predicates under $R$.
$StateValid_R(x,U)$Object $x$ is valid against the current spendable coin set.
$RelayValid_P(x,Q,U)$Object $x$ is accepted by local relay policy. This is not a consensus predicate.

Transition relations

For a non-coinbase transaction, the transaction transition is:

$$ \operatorname{ApplyTx}(R,U,tx) = \begin{cases} U’, & \text{if } tx \text{ is valid against } U \text{ under } R,\ \bot, & \text{otherwise.} \end{cases} $$

For a block $B_h$ at height $h$, block connection is:

$$ \operatorname{ConnectBlock}(R,(C,U),B_h) = \begin{cases} (C’,U’), & \text{if every block and transaction predicate succeeds,}\ \bot, & \text{otherwise.} \end{cases} $$

Header acceptance, block-data acceptance, chain selection, and reorganization are the consensus transitions defined in Section Consensus. Mempool admission is the local transition defined in Section Mempool.

Invariants

Every accepted active-chain transition preserves:

InvariantStatement
DeterminismFor fixed $N,C,U,B_h$, successful connection produces a unique $C’,U’$.
Outpoint uniquenessAt any active tip, each outpoint appears at most once in $U$.
No double spendA connected transaction consumes each input outpoint at most once, and a connected block consumes each live outpoint at most once.
ConservationA non-coinbase transaction cannot create value: $\sum outputs(tx) <= \sum spent(tx)$.
Issuance boundFor each connected block, $\sum outputs(coinbase) <= subsidy(h)+\sum fees(B_h)$.
Work selectionThe active chain is selected from valid candidates by greatest accumulated work.