Documentation ¶
Overview ¶
Package api implements the random beacon and time keeping APIs.
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 // EpochInvalid is the placeholder invalid epoch. EpochInvalid EpochTime = 0xffffffffffffffff // ~50 quadrillion years away. // BackendInsecure is the name of the insecure backend. BackendInsecure = "insecure" // BackendPVSS is the name of the PVSS backend. BackendPVSS = "pvss" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsensusParameters ¶
type ConsensusParameters struct { // Backend is the beacon backend. Backend string `json:"backend"` // DebugMockBackend is flag for enabling the mock epochtime backend. DebugMockBackend bool `json:"debug_mock_backend,omitempty"` // DebugDeterministic is true iff the output should be deterministic. DebugDeterministic bool `json:"debug_deterministic,omitempty"` // InsecureParameters are the beacon parameters for the insecure backend. InsecureParameters *InsecureParameters `json:"insecure_parameters,omitempty"` // PVSSParameters are the beacon parameters for the PVSS backend. PVSSParameters *PVSSParameters `json:"pvss_parameters,omitempty"` }
ConsensusParameters are the beacon consensus parameters.
type EpochTime ¶
EpochTime is the number of intervals (epochs) since a fixed instant in time/block height (epoch date/height).
type EpochTimeState ¶
EpochTimeState is the epoch state.
type Genesis ¶
type Genesis struct { // Base is the starting epoch. Base EpochTime `json:"base"` // Parameters are the beacon consensus parameters. Parameters ConsensusParameters `json:"params"` }
Genesis is the genesis state.
type InsecureParameters ¶
type InsecureParameters struct { // Interval is the epoch interval (in blocks). Interval int64 `json:"interval,omitempty"` }
InsecureParameters are the beacon parameters for the insecure backend.
type PVSSCommit ¶
type PVSSCommit struct { Epoch EpochTime `json:"epoch"` Round uint64 `json:"round"` Commit interface{} `json:"commit,omitempty"` }
PVSSCommit is a PVSS commitment transaction payload.
type PVSSEvent ¶
type PVSSEvent struct { Height int64 `json:"height,omitempty"` Epoch EpochTime `json:"epoch,omitempty"` Round uint64 `json:"round,omitempty"` State RoundState `json:"state,omitempty"` Participants []signature.PublicKey `json:"participants,omitempty"` }
PVSSEvent is a PVSS backend event.
type PVSSParameters ¶
type PVSSParameters struct { Participants uint32 `json:"participants"` Threshold uint32 `json:"threshold"` CommitInterval int64 `json:"commit_interval"` RevealInterval int64 `json:"reveal_interval"` TransitionDelay int64 `json:"transition_delay"` DebugForcedParticipants []signature.PublicKey `json:"debug_forced_participants,omitempty"` }
PVSSParameters are the beacon parameters for the PVSS backend.
type PVSSReveal ¶
type PVSSReveal struct { Epoch EpochTime `json:"epoch"` Round uint64 `json:"round"` Reveal interface{} `json:"reveal,omitempty"` }
PVSSReveal is a PVSS reveal transaction payload.
type PVSSState ¶
type PVSSState struct { Height int64 `json:"height,omitempty"` Epoch EpochTime `json:"epoch,omitempty"` Round uint64 `json:"round,omitempty"` State RoundState `json:"state,omitempty"` Instance interface{} `json:"instance,omitempty"` Participants []signature.PublicKey `json:"participants,omitempty"` Entropy []byte `json:"entropy,omitempty"` BadParticipants map[signature.PublicKey]bool `json:"bad_participants,omitempty"` CommitDeadline int64 `json:"commit_deadline,omitempty"` RevealDeadline int64 `json:"reveal_deadline,omitempty"` TransitionHeight int64 `json:"transition_height,omitempty"` RuntimeDisableHeight int64 `json:"runtime_disable_height,omitempty"` }
PVSSState is the PVSS backend state.
type RoundState ¶
type RoundState uint8
RoundState is a PVSS round state.
const ( StateInvalid RoundState = 0 StateCommit RoundState = 1 StateReveal RoundState = 2 StateComplete RoundState = 3 )
func (RoundState) String ¶
func (s RoundState) String() string
Click to show internal directories.
Click to hide internal directories.