beacon

package
v0.2300.9 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package beacon implements the combined beacon and epochtime application.

Index

Constants

View Source
const (
	// AppID is the unique application identifier.
	AppID uint8 = 0x40

	// AppName is the ABCI application name.
	// Run before all other applications.
	AppName string = "000_beacon"

	// AppPriority is the base priority for the app's transactions.
	AppPriority int64 = 100000
)

Variables

View Source
var (
	// EventType is the ABCI event type for beacon/epoch events.
	EventType = api.EventTypeForApp(AppName)

	// QueryApp is the query for filtering events procecessed by the
	// beacon application.
	QueryApp = api.QueryForApp(AppName)

	// MethodSetEpoch is the method name for setting epochs.
	MethodSetEpoch = transaction.NewMethodName(AppName, "SetEpoch", beacon.EpochTime(0))

	// Methods is a list of all methods supported by the beacon application.
	Methods = []transaction.MethodName{
		MethodSetEpoch,
		beacon.MethodVRFProve,
	}
)

Functions

func GetBeacon

func GetBeacon(epoch beacon.EpochTime, entropyCtx, entropy []byte) []byte

GetBeacon derives the actual beacon from the epoch and entropy source.

func MustGetChainContext

func MustGetChainContext(ctx *api.Context) []byte

MustGetChainContext returns the global blockchain chain context or panics.

XXX: This lives here because making it a method of `api.Context` import loops.

func New

func New() api.Application

New constructs a new beacon application instance.

Types

type Query

type Query interface {
	Beacon(context.Context) ([]byte, error)
	Epoch(context.Context) (beacon.EpochTime, int64, error)
	FutureEpoch(context.Context) (*beacon.EpochTimeState, error)
	Genesis(context.Context) (*beacon.Genesis, error)
	ConsensusParameters(context.Context) (*beacon.ConsensusParameters, error)
	VRFState(context.Context) (*beacon.VRFState, error)
}

Query is the beacon query interface.

type QueryFactory

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

QueryFactory is the beacon query factory.

func NewQueryFactory

func NewQueryFactory(state abciAPI.ApplicationQueryState) *QueryFactory

NewQueryFactory returns a new QueryFactory backed by the given state instance.

func (*QueryFactory) QueryAt

func (sf *QueryFactory) QueryAt(ctx context.Context, height int64) (Query, error)

QueryAt returns the beacon query interface for a specific height.

Directories

Path Synopsis
Package state is deprecated.
Package state is deprecated.

Jump to

Keyboard shortcuts

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