Policy
Properties
BATCHES_PER_EPOCH
How many batches constitute an epoch
BLOCK_SEPARATION_TIME
The optimal time in milliseconds between blocks (1s)
BLOCKS_PER_BATCH
Length of a batch including the macro block
BLOCKS_PER_EPOCH
Length of an epoch including the election block
BLS_CACHE_MAX_CAPACITY
The maximum size of the BLS public key cache.
COINBASE_ADDRESS
This is the address for the coinbase. Note that this is not a real account, it is just the address we use to denote that some coins originated from a coinbase event.
F_PLUS_ONE
Calculates f+1 slots which is the minimum number of slots necessary to be guaranteed to have at
least one honest slots. That's because from a total of 3f+1 slots at most f will be malicious.
It is calculated as ceil(SLOTS/3)
and we use the formula ceil(x/y) = (x+y-1)/y
for the
ceiling division.
GENESIS_BLOCK_NUMBER
Genesis block number
HISTORY_CHUNKS_MAX_SIZE
Maximum size of history chunks. 25 MB.
JAIL_EPOCHS
The number of epochs a validator is put in jail for. The jailing only happens for severe offenses.
MAX_SIZE_MICRO_BODY
The maximum allowed size, in bytes, for a micro block body.
MIN_EPOCHS_STORED
Minimum number of epochs that the ChainStore will store fully
MIN_PRODUCER_TIMEOUT
The minimum timeout in milliseconds for a validator to produce a block (4s)
MINIMUM_REWARDS_PERCENTAGE
The minimum rewards percentage that we allow
SLOTS
Number of available validator slots. Note that a single validator may own several validator slots.
STAKING_CONTRACT_ADDRESS
This is the address for the staking contract.
STATE_CHUNKS_MAX_SIZE
Maximum size of accounts trie chunks.
TIMESTAMP_MAX_DRIFT
The maximum drift, in milliseconds, that is allowed between any block's timestamp and the node's system time. We only care about drifting to the future.
TOTAL_SUPPLY
Total supply in units.
TRANSACTION_VALIDITY_WINDOW
Number of batches a transaction is valid with Albatross consensus.
TRANSACTION_VALIDITY_WINDOW_BLOCKS
Number of blocks a transaction is valid with Albatross consensus.
TWO_F_PLUS_ONE
Calculates 2f+1 slots which is the minimum number of slots necessary to produce a macro block,
a skip block and other actions.
It is also the minimum number of slots necessary to be guaranteed to have a majority of honest
slots. That's because from a total of 3f+1 slots at most f will be malicious. If in a group of
2f+1 slots we have f malicious ones (which is the worst case scenario), that still leaves us
with f+1 honest slots. Which is more than the f slots that are not in this group (which must all
be honest).
It is calculated as ceil(SLOTS*2/3)
and we use the formula ceil(x/y) = (x+y-1)/y
for the
ceiling division.
VALIDATOR_DEPOSIT
The deposit necessary to create a validator in Lunas (1 NIM = 100,000 Lunas). A validator is someone who actually participates in block production. They are akin to miners in proof-of-work.
VERSION
The current version number of the protocol. Changing this always results in a hard fork.
Methods
free()
batchAt()
Returns the batch number at a given block_number
(height)
Parameter | Type |
---|---|
First | number |
batchDelayPenalty()
Returns the percentage reduction that should be applied to the rewards due to a delayed batch. This function returns a float in the range [0, 1] I.e 1 means that the full rewards should be given, whereas 0.5 means that half of the rewards should be given The input to this function is the batch delay, in milliseconds The function is: [(1 - MINIMUM_REWARDS_PERCENTAGE) * BLOCKS_DELAY_DECAY ^ (t^2)] + MINIMUM_REWARDS_PERCENTAGE
Parameter | Type |
---|---|
First | bigint |
batchIndexAt()
Returns the batch index at a given block number. The batch index is the number of a block relative to the batch it is in. For example, the first block of any batch always has an batch index of 0.
Parameter | Type |
---|---|
First | number |
blockAfterJail()
Returns the first block after the jail period of a given block number has ended.
Parameter | Type |
---|---|
First | number |
blockAfterReportingWindow()
Returns the first block after the reporting window of a given block number has ended.
Parameter | Type |
---|---|
First | number |
electionBlockAfter()
Returns the number (height) of the next election macro block after a given block number (height).
Parameter | Type |
---|---|
First | number |
electionBlockBefore()
Returns the block number (height) of the preceding election macro block before a given block number (height). If the given block number is an election macro block, it returns the election macro block before it.
Parameter | Type |
---|---|
First | number |
electionBlockOf()
Returns the block number of the election macro block of the given epoch (which is always the last block). If the index is out of bounds, None is returned
Parameter | Type |
---|---|
First | number |
epochAt()
Returns the epoch number at a given block number (height).
Parameter | Type |
---|---|
First | number |
epochIndexAt()
Returns the epoch index at a given block number. The epoch index is the number of a block relative to the epoch it is in. For example, the first block of any epoch always has an epoch index of 0.
Parameter | Type |
---|---|
First | number |
firstBatchOfEpoch()
Returns a boolean expressing if the batch at a given block number (height) is the first batch of the epoch.
Parameter | Type |
---|---|
First | number |
firstBlockOf()
Returns the block number of the first block of the given epoch (which is always a micro block). If the index is out of bounds, None is returned
Parameter | Type |
---|---|
First | number |
firstBlockOfBatch()
Returns the block number of the first block of the given batch (which is always a micro block). If the index is out of bounds, None is returned
Parameter | Type |
---|---|
First | number |
isElectionBlockAt()
Returns a boolean expressing if the block at a given block number (height) is an election macro block.
Parameter | Type |
---|---|
First | number |
isMacroBlockAt()
Returns a boolean expressing if the block at a given block number (height) is a macro block.
Parameter | Type |
---|---|
First | number |
isMicroBlockAt()
Returns a boolean expressing if the block at a given block number (height) is a micro block.
Parameter | Type |
---|---|
First | number |
lastBlockOfReportingWindow()
Returns the block height for the last block of the reporting window of a given block number.
Note: This window is meant for reporting malicious behaviour (aka jailable
behaviour).
Parameter | Type |
---|---|
First | number |
lastElectionBlock()
Returns the block number (height) of the last election macro block at a given block number (height). If the given block number is an election macro block, then it returns that block number.
Parameter | Type |
---|---|
First | number |
lastMacroBlock()
Returns the block number (height) of the last macro block at a given block number (height). If the given block number is a macro block, then it returns that block number.
Parameter | Type |
---|---|
First | number |
macroBlockAfter()
Returns the block number (height) of the next macro block after a given block number (height). If the given block number is a macro block, it returns the macro block after it.
Parameter | Type |
---|---|
First | number |
macroBlockBefore()
Returns the block number (height) of the preceding macro block before a given block number (height). If the given block number is a macro block, it returns the macro block before it.
Parameter | Type |
---|---|
First | number |
macroBlockOf()
Returns the block number of the macro block (checkpoint or election) of the given batch (which is always the last block). If the index is out of bounds, None is returned
Parameter | Type |
---|---|
First | number |
supplyAt()
Returns the supply at a given time (as Unix time) in Lunas (1 NIM = 100,000 Lunas). It is calculated using the following formula:
Where t is the time in milliseconds since the PoS genesis block and genesis_supply
is the supply at
the genesis of the Nimiq 2.0 chain.
Parameter | Type |
---|---|
First | bigint |