Expand description
Calculations for Block Subsidy and Funding Streams
This module contains the consensus parameters which are required for verification.
Some consensus parameters change based on network upgrades. Each network upgrade happens at a particular block height. Some parameters have a value (or function) before the upgrade height, at the upgrade height, and after the upgrade height. (For example, the value of the reserved field in the block header during the Heartwood upgrade.)
Typically, consensus parameters are accessed via a function that takes a
Network and block::Height.
Structs§
- Funding
Stream Recipient - A funding stream recipient as specified in protocol specification §7.10.1
- Funding
Streams - Funding stream recipients and height ranges.
Enums§
- Coinbase
Transaction Error - An error from the block subsidy or miner fee checks on a block’s coinbase transaction.
- Funding
Stream Receiver - The funding stream receiver categories.
- Subsidy
Error - Block subsidy errors.
Constants§
- BLOCK_
SUBSIDY_ FRACTION_ DENOMINATOR - The denominator of
BLOCK_SUBSIDY_FRACTIONin the halving-preserving issuance ZIP. - LN2_
SCALED 10^10 * ln 2, rounded so that Mainnet’sPostBlossomHalvingIntervalof 1,680,000 blocks gives aBLOCK_SUBSIDY_FRACTIONnumerator of exactly 4126.- MAINNET_
INITIAL_ NSM_ VALUE_ BALANCE INITIAL_NSM_VALUE_BALANCEon Mainnet: the block subsidy and fees left unclaimed by coinbase transactions before NU6, which seeds the NSM value balance at NU7 activation under the halving-preserving issuance ZIP.- TESTNET_
INITIAL_ NSM_ VALUE_ BALANCE - The unclaimed pre-NU6 subsidy and fees on public Testnet, measured at height 2,975,999.
Traits§
- Parameter
Subsidy - Functionality specific to block subsidy-related consensus rules
Functions§
- additional_
block_ subsidy AdditionalBlockSubsidy(height): the block subsidy added to the scheduled block subsidy by the halving-preserving issuance ZIP,ceiling(BLOCK_SUBSIDY_FRACTION * nsm_value_balance)fromDEPLOYMENT_BLOCK_HEIGHT, and zero before it.- block_
subsidy BlockSubsidy(height)as described in protocol specification §7.8- block_
subsidy_ fraction_ numerator - The numerator of
BLOCK_SUBSIDY_FRACTION(height)onnetwork:LN2_SCALED / HalvingInterval(height). - block_
subsidy_ with_ parent_ nsm_ value_ balance BlockSubsidy(height)for a block whose parent block leavesparent_nsm_value_balancein the NSM value balance. Seeblock_subsidy_with_parent_pools.- block_
subsidy_ with_ parent_ pools BlockSubsidy(height)for a block whose parent block leavesparent_chain_value_poolsin the chain value pools.- cumulative_
scheduled_ issuance - Cumulative scheduled issuance through
height, including the scheduled genesis subsidy. - founders_
reward FoundersReward(height)as described in §7.8.- founders_
reward_ address - Returns the founders reward address for a given height and network as described in §7.9.
- funding_
stream_ address - Return the address corresponding to given height, network and funding stream receiver.
- funding_
stream_ address_ period - Returns the address change period as described in protocol specification §7.10
- funding_
stream_ values - Returns the
fs.Value(height)for each stream receiver as described in protocol specification §7.8 - halving
- The halving index for a block height and network.
- halving_
divisor - The divisor used for halvings.
- halving_
interval HalvingInterval(height): the number of blocks in the halving period containingheight.- height_
for_ halving - The first block height of the halving at the provided halving index for a network.
- miner_
fees_ are_ valid - Returns
Ok(())if the miner fees consensus rule is valid. - miner_
subsidy MinerSubsidy(height)as described in protocol specification §7.8- nsm_
fee_ contribution NSMFeeContribution(height): the transaction fees the block atheightremoves from circulation,floor(block_miner_fees * 6 / 10)from NU7 activation, and zero before it. This is the fraction from ZIP 235, applied the way the NU7 deployment ZIP specifies.- nsm_
reissuance_ is_ active - Returns
trueif the halving-preserving issuance ZIP reissues the NSM value balance atheight: fromDEPLOYMENT_BLOCK_HEIGHT, which is at or after NU7 activation. - nsm_
value_ balance_ before NSMValueBalance(height - 1): the Network Sustainability Mechanism value balance the block atheightreissues from, whereparent_nsm_value_balanceis the balance after its parent block.- nsm_
value_ balance_ change - The change the block at
heightmakes to the Network Sustainability Mechanism value balance, whereparent_chain_value_poolsare the chain value pools after its parent block. - nsm_
value_ balance_ is_ tracked - Returns
trueif the NSM value balance is tracked atheight: from NU7 activation, per the halving-preserving issuance ZIP. - scheduled_
block_ subsidy ScheduledBlockSubsidy(height): the block subsidy under the halving schedule, as described in protocol specification §7.8 forBlockSubsidy(height).- subsidy_
is_ valid - Returns
Ok()with the deferred pool balance change of the coinbase transaction if the block subsidy inblockis valid fornetwork