Documentation
¶
Overview ¶
Package beacon provides integration with drand for global time anchoring
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidConfig = fmt.Errorf("invalid beacon configuration")
ErrInvalidConfig indicates the beacon configuration is invalid
Functions ¶
This section is empty.
Types ¶
type Beacon ¶
type Beacon interface {
// GetLatestRound fetches the latest beacon round
GetLatestRound(ctx context.Context) (*Round, error)
// GetRound fetches a specific beacon round
GetRound(ctx context.Context, round uint64) (*Round, error)
// Start begins fetching rounds at the specified interval
Start(ctx context.Context, interval time.Duration) error
// Stop stops fetching rounds
Stop() error
// Subscribe returns a channel that receives new rounds
Subscribe() (<-chan *Round, error)
}
Beacon represents a drand beacon client
type Config ¶
type Config struct {
// URL is the drand HTTP endpoint
URL string
// ChainHash is the hash of the drand chain info
ChainHash []byte
// PublicKey is the drand group public key
PublicKey []byte
// Period is the duration between rounds
Period time.Duration
}
Config represents beacon configuration
type Round ¶
type Round struct {
// Number is the round number
Number uint64
// Randomness is the random bytes produced by drand
Randomness []byte
// Signature is the threshold signature of the round
Signature []byte
// Timestamp is when this round was created
Timestamp time.Time
}
Round represents a drand beacon round
Click to show internal directories.
Click to hide internal directories.