sortition

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sortition

type Sortition struct {
	// contains filtered or unexported fields
}

func NewSortition

func NewSortition(state *state.State, signer crypto.Signer, chainID string) *Sortition

func (*Sortition) Address

func (s *Sortition) Address() crypto.Address

func (*Sortition) Evaluate

func (s *Sortition) Evaluate(blockHeight uint64, blockHash []byte)

Evaluate return the vrf for self choosing to be a validator

func (*Sortition) Verify

func (s *Sortition) Verify(blockHash []byte, pb crypto.PublicKey, index uint64, proof []byte) bool

type VRF

type VRF struct {
	// contains filtered or unexported fields
}

func NewVRF

func NewVRF(signer crypto.Signer) VRF

func (*VRF) Evaluate

func (vrf *VRF) Evaluate(m []byte) (index uint64, proof []byte)

Evaluate returns a random number between 0 and 10^18 with the proof

func (*VRF) SetMax

func (vrf *VRF) SetMax(max uint64)

func (*VRF) Verify

func (vrf *VRF) Verify(msg []byte, publicKey crypto.PublicKey, proof []byte) (index uint64, result bool)

Verify ensure the proof is valid

Jump to

Keyboard shortcuts

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