api

package
v0.2012.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: Apache-2.0 Imports: 4 Imported by: 22

Documentation

Overview

Package api implements the random beacon API.

Index

Constants

View Source
const (
	// ModuleName is a unique module name for the beacon module.
	ModuleName = "beacon"

	// BeaconSize is the size of the beacon in bytes.
	BeaconSize = 32
)

Variables

View Source
var ErrBeaconNotAvailable = errors.New(ModuleName, 1, "beacon: random beacon not available")

ErrBeaconNotAvailable is the error returned when a beacon is not available for the requested height for any reason.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// GetBeacon gets the beacon for the provided block height.
	// Calling this method with height `0`, should return the
	// beacon for latest finalized block.
	GetBeacon(context.Context, int64) ([]byte, error)

	// StateToGenesis returns the genesis state at specified block height.
	StateToGenesis(context.Context, int64) (*Genesis, error)
}

Backend is a random beacon implementation.

type ConsensusParameters

type ConsensusParameters struct {
	// DebugDeterministic is true iff the output should be deterministic.
	DebugDeterministic bool `json:"debug_deterministic,omitempty"`
}

ConsensusParameters are the beacon consensus parameters.

type Genesis

type Genesis struct {
	// Parameters are the beacon consensus parameters.
	Parameters ConsensusParameters `json:"params"`
}

Genesis is the beacon genesis state.

func (*Genesis) SanityCheck

func (g *Genesis) SanityCheck() error

SanityCheck does basic sanity checking on the genesis state.

Jump to

Keyboard shortcuts

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