Crate snarkvm_ledger

Source

Re-exports§

pub use ledger_authority as authority;
pub use ledger_block as block;
pub use ledger_committee as committee;
pub use ledger_narwhal as narwhal;
pub use ledger_puzzle as puzzle;
pub use ledger_query as query;
pub use ledger_store as store;

Modules§

header
ratifications
ratify
solutions
transaction
transactions
transition

Structs§

Block
Deployment
Execution
Fee
Header
The header for the block contains metadata that uniquely identifies the block.
Ledger
Metadata
Ratifications
Solutions
Transactions
Transition

Enums§

ConfirmedTransaction
The confirmed transaction.
Input
The transition input.
Output
The transition output.
Ratify
RecordsFilter
Rejected
A wrapper around the rejected deployment or execution.
Transaction

Constants§

MAX_COINBASE_REWARD
A safety bound (sanity-check) for the coinbase reward.

Functions§

block_reward
Calculate the block reward based on the network’s consensus version, determined by the given block height.
block_reward_v1
Calculate the V1 block reward, given the total supply, block time, coinbase reward, and transaction fees. R_staking = floor((0.05 * S) / H_Y1) + CR / 3 + TX_F. S = Total supply. H_Y1 = Expected block height at year 1. CR = Coinbase reward. TX_F = Transaction fees.
block_reward_v2
Calculate the V2 block reward, given the total supply, block interval, coinbase reward, and transaction fees. R_staking = floor((0.05 * S) * clamp(I, MIN_BI, MAX_BI) / S_Y) + CR / 3 + TX_F. S = Total supply. I = Seconds elapsed since last block. S_Y = Seconds in a year (31536000). CR = Coinbase reward. TX_F = Transaction fees. MIN_BI = Minimum block interval. MAX_BI = Maximum block interval.
coinbase_reward
Calculate the coinbase reward based on the network’s consensus version, determined by the given block height.
coinbase_reward_v1
Calculates the V1 coinbase reward for a given block. R_coinbase = R_anchor(H) * min(P, C_R) / C R_anchor = Anchor reward at block height. H = Current block height. P = Combined proof target. C_R = Remaining coinbase target. C = Coinbase target.
coinbase_reward_v2
Calculates the V2 coinbase reward for a given block. R_coinbase = R_anchor(H) * min(P, C_R) / C R_anchor = Anchor reward at block height. H = Current block height. P = Combined proof target. C_R = Remaining coinbase target. C = Coinbase target.
coinbase_target
Calculate the coinbase target for the given block timestamps and target.
decouple_transmissions
Takes in an iterator of transmissions and returns a tuple of ratifications, solutions, and transactions.
proof_target
Calculate the minimum proof target for the given coinbase target.
puzzle_reward
Calculate the puzzle reward, given the coinbase reward. The puzzle reward is 2/3 of the total coinbase reward and paid out to the provers. The other 1/3 of the coinbase reward is included in the block reward and paid out to stakers.
to_next_targets
This function calculates the next targets for the given attributes: latest_cumulative_proof_target: The latest cumulative proof target. combined_proof_target: The combined proof target of solutions in the block. latest_coinbase_target: The latest coinbase target. last_coinbase_target: The coinbase target for the last coinbase. last_coinbase_timestamp: The timestamp for the last coinbase. next_timestamp: The timestamp for the next block.
update_total_supply
Returns the next total supply in microcredits, given the starting total supply and newly-confirmed transactions.

Type Aliases§

NumFinalizeSize
RecordMap