Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSeed ¶
TODO(discuss): How should the seed be formatted? Discrepancies from the original spec [4]:
- Not using `lastNLeaders` as part of the seed
- Not using the validator's `PubKey` as part of the seed
Reasoning:
As long as the VRF keys are computed BEFORE some unpredictable seed, the security guarantees are maintained - this is provided by `prevBlockHash`.
[4] github.com/pokt-network/pocket-network-protocol/tree/main/consensus
Seed to be used for soritition when generating the vrfOut and vrfProof
Types ¶
type SortitionResult ¶
type SortitionResult uint64
func Sortition ¶
func Sortition(validatorStake, networkStake, numExpectedCandidates uint64, vrfOut vrf.VRFOutput) SortitionResult
Based on a validator's stake, the amount of staked uPOKT in the network, and the VRF output that the validator generated at some point in the past, this returns a value that can be used to rank potential view change leaders that is uniformally distributed and proportional to the validator's stake. See [3] for simpler explanation of the algorithm [1]. [3] https://community.algorand.org/blog/the-intuition-behind-algorand-cryptographic-sortition/