Documentation ¶
Overview ¶
Package winner contains structs and functions for describing which miner was calculated to be the winner of the current block. The winner is rewarded a certain amount of tokens that is halved in regular intervals. More details about the deterministic and fair winner selection process can be found in https://arxiv.org/abs/2312.01951
Index ¶
Constants ¶
const (
MinTransactionAmount float64 = 0.00000001
)
Variables ¶
This section is empty.
Functions ¶
func GetTokenRewardForBlock ¶
GetTokenRewardForBlock takes the blockIndex as input (e.g. Block 5) and returns the TokenReward that the winner of this block is awarded. The formula for block n > 0 is: 64 * (0.5)^(ceil(n/1460)-1). This means that the block reward starts at 64 tokens and is lowered by 50% every 1460 (4*365) blocks. The RA is expected to create 1 new block per day which means the block reward is halved approximately every 4 years. This prevents long-term token inflation by introduction artificial scarcity and it also rewards early blockchain adapation. The total supply of tokens is limited to 186880, and the time it takes until reward becomes zero is less than 132 years (same target time as Bitcoin). To be able to send hard sim problems (24 hours time to solve) halvings occurr much more often (per x blocks) than Bitcoin to compensate for not having 10 min blocktime target.
Types ¶
type BlockWinner ¶
BlockWinner has fields such as winnerAddress, SolutionHash and TokenReward. The TokenReward follows a formula that ensures that the first block rewards 1024 tokens and every four blocks this amount is halved. Articifial scarcity prevents inflation and enables tokens to have a perceived value / rarity.
func NewBlockWinner ¶
func NewBlockWinner(winnerAddress string, solutionHash hash.Hash, tokenReward float64) BlockWinner
NewBlockWinner is the constructor function of BlockWinner.
func (BlockWinner) PrintBlockWinner ¶
func (w BlockWinner) PrintBlockWinner()
PrintBlockWinner prints winner data in a human-readable format.