Structs§
- Block
Template - BlockTemplate: Interface for mining software
Enums§
- Mining
Result - Result of mining attempt
Functions§
- append_
witness_ commitment - BIP141: coinbase wtxid is 0, so appending the OP_RETURN does not change the witness root.
Empty stacks when
nestedisNone(legacy). Preferappend_witness_commitment_from_nestedwhen mempool witnesses are known. - append_
witness_ commitment_ from_ nested - Same as
append_witness_commitment, using per-tx per-input stacks.nested[i]is the witness fortxs[i]. Coinbase wtxid stays 0. - calculate_
merkle_ root - Calculate merkle root using proper Bitcoin Merkle tree construction
- calculate_
merkle_ root_ from_ tx_ ids - Build merkle tree from pre-computed leaf hashes.
- check_
template_ weight - Weight of coinbase + selected txs (empty stacks if none stored).
Uses Bitcoin
MAX_BLOCK_WEIGHT(4_000_000). Not an invented pool cap. - compute_
merkle_ root_ and_ mutated - Compute merkle root and CVE-2012-2459 mutation flag without aborting on mutation.
Computes merkle root from leaves with optional mutation detection — always returns a root.
Callers decide policy:
CheckBlockrejects mutated blocks;ConnectBlockmay skip the check for already-accepted blocks. - create_
block_ template - Create a block template for mining
- create_
block_ template_ declared - Stage 3b slice 1: miner-declared mempool subset.
Resolves
declared_txids, builds the Stage 3a template, and errors if the selected non-coinbase txids are not exactly that list (no silent skip). Emptydeclared_txidsis coinbase-only. Spec-locked builders are unchanged. Overweight uses BitcoinMAX_BLOCK_WEIGHT(not a pool-invented cap). - create_
block_ template_ with_ outputs - Same as
create_block_template, then replace the coinbase and merkle root. - create_
coinbase_ with_ outputs - Multi-output coinbase. Callers set values (subsidy + fees). Empty list is an error.
Witness commitment is appended by
create_block_template_with_outputs/ Stratum. - create_
new_ block - CreateNewBlock: 𝒰𝒮 × 𝒯𝒳* → ℬ
- create_
new_ block_ with_ time - CreateNewBlock variant that accepts an explicit block_time.
- fit_
payouts_ to_ reward - If payouts exceed subsidy+fees, error. Shortfall is added to the first output.
- mine_
block - MineBlock: ℬ × ℕ → ℬ × {success, failure}
- resolve_
declared_ txs - Resolve named txids from a mempool list, in declaration order. Unknown or duplicate txids are errors. An empty list is allowed (coinbase-only).
- sum_
selected_ fees - Fees of selected (non-coinbase) txs. Missing UTXOs count as 0 so empty-set tests still run.
- template_
block_ version - Minimum header version
check_bip90accepts atheight.