Skip to main content

Module block_template

Module block_template 

Source
Expand description

Block Template Assembly — Transaction Selection and Template Construction

This module implements the BlockTemplateProvider port trait, assembling block templates from mempool transactions for mining. It corresponds to Bitcoin Core’s BlockAssembler (in node/miner.cpp).

§Strategy

  1. Query the mempool for transactions sorted by ancestor fee rate (CPFP-aware).
  2. Fill the block up to MAX_BLOCK_WEIGHT (4,000,000 weight units / BIP 141).
  3. Build a coinbase transaction with the correct subsidy + collected fees.
  4. Compute the merkle root and assemble the header.

The resulting BlockTemplate is ready for nonce-grinding by the miner.

Structs§

BlockAssembler
Block template assembler.