sortition

package
v0.0.1-pre-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSeed

func FormatSeed(height uint64, round uint64, prevBlockHash string) []byte

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/

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL