Skip to main content

Module subsidy

Module subsidy 

Source
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§

FundingStreamRecipient
A funding stream recipient as specified in protocol specification §7.10.1
FundingStreams
Funding stream recipients and height ranges.

Enums§

CoinbaseTransactionError
An error from the block subsidy or miner fee checks on a block’s coinbase transaction.
FundingStreamReceiver
The funding stream receiver categories.
SubsidyError
Block subsidy errors.

Constants§

BLOCK_SUBSIDY_FRACTION_DENOMINATOR
The denominator of BLOCK_SUBSIDY_FRACTION in the halving-preserving issuance ZIP.
LN2_SCALED
10^10 * ln 2, rounded so that Mainnet’s PostBlossomHalvingInterval of 1,680,000 blocks gives a BLOCK_SUBSIDY_FRACTION numerator of exactly 4126.
MAINNET_INITIAL_NSM_VALUE_BALANCE
INITIAL_NSM_VALUE_BALANCE on 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§

ParameterSubsidy
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) from DEPLOYMENT_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) on network: LN2_SCALED / HalvingInterval(height).
block_subsidy_with_parent_nsm_value_balance
BlockSubsidy(height) for a block whose parent block leaves parent_nsm_value_balance in the NSM value balance. See block_subsidy_with_parent_pools.
block_subsidy_with_parent_pools
BlockSubsidy(height) for a block whose parent block leaves parent_chain_value_pools in 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 containing height.
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 at height removes 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 true if the halving-preserving issuance ZIP reissues the NSM value balance at height: from DEPLOYMENT_BLOCK_HEIGHT, which is at or after NU7 activation.
nsm_value_balance_before
NSMValueBalance(height - 1): the Network Sustainability Mechanism value balance the block at height reissues from, where parent_nsm_value_balance is the balance after its parent block.
nsm_value_balance_change
The change the block at height makes to the Network Sustainability Mechanism value balance, where parent_chain_value_pools are the chain value pools after its parent block.
nsm_value_balance_is_tracked
Returns true if the NSM value balance is tracked at height: 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 for BlockSubsidy(height).
subsidy_is_valid
Returns Ok() with the deferred pool balance change of the coinbase transaction if the block subsidy in block is valid for network