beacon

package
v0.0.0-...-041d6b2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeVRF

func ComputeVRF(privKey crypto.PrivKey, sigInput []byte) ([]byte, error)

func DrawRandomness

func DrawRandomness(rbase []byte, randomnessType RandomnessType, round uint64, entropy []byte) ([]byte, error)

func VerifyVRF

func VerifyVRF(worker peer.ID, vrfBase, vrfproof []byte) error

Types

type BeaconAPI

type BeaconAPI interface {
	Entry(context.Context, uint64) (types.BeaconEntry, error)
	VerifyEntry(types.BeaconEntry, types.BeaconEntry) error
	LatestBeaconRound() uint64
}

BeaconAPI represents a system that provides randomness. Other components interrogate the BeaconAPI to acquire randomness that's valid for a specific chain epoch. Also to verify beacon entries that have been posted on chain.

type BeaconNetwork

type BeaconNetwork struct {
	Start  uint64
	Beacon BeaconAPI
}

type BeaconNetworks

type BeaconNetworks []BeaconNetwork

func (BeaconNetworks) BeaconNetworkForRound

func (bn BeaconNetworks) BeaconNetworkForRound(e uint64) BeaconAPI

func (BeaconNetworks) ValidateBlockBeacons

func (bn BeaconNetworks) ValidateBlockBeacons(beaconNetworks BeaconNetworks, curEntry, prevEntry types.BeaconEntry) error

ValidateBlockBeacons is a function that verifies block randomness

type BeaconResult

type BeaconResult struct {
	Entry types.BeaconEntry
	Err   error
}

type RandomnessType

type RandomnessType int64

RandomnessType specifies a type of randomness.

const (
	RandomnessTypeElectionProofProduction RandomnessType = 1 + iota
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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