Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultConfigFolder() string
- func GetBeaconDescription(value BeaconStatus) string
- func GetDkgStatusDescription(value DkgStatus) string
- func GetReshareStatusDescription(value ReshareStatus) string
- func Proxy(s drand.PublicServer) client.Client
- func StatusResponseToString(status *drand.StatusResponse) string
- type BeaconProcess
- func (bp *BeaconProcess) BackupDatabase(ctx context.Context, req *drand.BackupDBRequest) (*drand.BackupDBResponse, error)
- func (bp *BeaconProcess) BroadcastDKG(c context.Context, in *drand.DKGPacket) (*drand.Empty, error)
- func (bp *BeaconProcess) ChainInfo(context.Context, *drand.ChainInfoRequest) (*drand.ChainInfoPacket, error)
- func (bp *BeaconProcess) GetIdentity(context.Context, *drand.IdentityRequest) (*drand.IdentityResponse, error)
- func (bp *BeaconProcess) GroupFile(context.Context, *drand.GroupRequest) (*drand.GroupPacket, error)
- func (bp *BeaconProcess) Home(c context.Context, _ *drand.HomeRequest) (*drand.HomeResponse, error)
- func (bp *BeaconProcess) InitDKG(c context.Context, in *drand.InitDKGPacket) (*drand.GroupPacket, error)
- func (bp *BeaconProcess) InitReshare(c context.Context, in *drand.InitResharePacket) (*drand.GroupPacket, error)
- func (bp *BeaconProcess) ListBeaconIDs(context.Context, *drand.ListSchemesRequest) (*drand.ListSchemesResponse, error)
- func (bp *BeaconProcess) ListSchemes(context.Context, *drand.ListSchemesRequest) (*drand.ListSchemesResponse, error)
- func (bp *BeaconProcess) Load() (bool, error)
- func (bp *BeaconProcess) MetricsHandlerForPeer(addr string) (http.Handler, error)
- func (bp *BeaconProcess) PartialBeacon(c context.Context, in *drand.PartialBeaconPacket) (*drand.Empty, error)
- func (bp *BeaconProcess) PingPong(context.Context, *drand.Ping) (*drand.Pong, error)
- func (bp *BeaconProcess) PublicKey(context.Context, *drand.PublicKeyRequest) (*drand.PublicKeyResponse, error)
- func (bp *BeaconProcess) PublicRand(ctx context.Context, in *drand.PublicRandRequest) (*drand.PublicRandResponse, error)
- func (bp *BeaconProcess) PublicRandStream(req *drand.PublicRandRequest, stream drand.Public_PublicRandStreamServer) error
- func (bp *BeaconProcess) PushDKGInfo(_ context.Context, in *drand.DKGInfoPacket) (*drand.Empty, error)
- func (bp *BeaconProcess) RemoteStatus(ctx context.Context, in *drand.RemoteStatusRequest) (*drand.RemoteStatusResponse, error)
- func (bp *BeaconProcess) SignalDKGParticipant(ctx context.Context, p *drand.SignalDKGPacket) (*drand.Empty, error)
- func (bp *BeaconProcess) StartBeacon(catchup bool) error
- func (bp *BeaconProcess) StartCheckChain(req *drand.StartSyncRequest, stream drand.Control_StartCheckChainServer) error
- func (bp *BeaconProcess) StartFollowChain(req *drand.StartSyncRequest, stream drand.Control_StartFollowChainServer) error
- func (bp *BeaconProcess) Status(ctx context.Context, in *drand.StatusRequest) (*drand.StatusResponse, error)
- func (bp *BeaconProcess) Stop(ctx context.Context)
- func (bp *BeaconProcess) StopBeacon()
- func (bp *BeaconProcess) SyncChain(req *drand.SyncRequest, stream drand.Protocol_SyncChainServer) error
- func (bp *BeaconProcess) WaitDKG() (*key.Group, error)
- func (bp *BeaconProcess) WaitExit() chan bool
- type BeaconStatus
- type Broadcast
- type Client
- type Config
- func (d *Config) BoltOptions() *bolt.Options
- func (d *Config) Certs() *net.CertManager
- func (d *Config) ConfigFolder() string
- func (d *Config) ConfigFolderMB() string
- func (d *Config) ControlPort() string
- func (d *Config) DBFolder(beaconID string) string
- func (d *Config) Logger() log.Logger
- func (d *Config) PgDSN() string
- func (d *Config) PrivateListenAddress(defaultAddr string) string
- func (d *Config) PublicListenAddress(defaultAddr string) string
- func (d *Config) Version() string
- type ConfigOption
- func WithBoltOptions(opts *bolt.Options) ConfigOption
- func WithCallOption(opts ...grpc.CallOption) ConfigOption
- func WithConfigFolder(folder string) ConfigOption
- func WithControlPort(port string) ConfigOption
- func WithDBStorageEngine(engine chain.StorageType) ConfigOption
- func WithDkgTimeout(t time.Duration) ConfigOption
- func WithGrpcOptions(opts ...grpc.DialOption) ConfigOption
- func WithInsecure() ConfigOption
- func WithLogLevel(level int, jsonFormat bool) ConfigOption
- func WithMemDBSize(bufferSize int) ConfigOption
- func WithPgDSN(dsn string) ConfigOption
- func WithPrivateListenAddress(addr string) ConfigOption
- func WithPublicListenAddress(addr string) ConfigOption
- func WithTLS(certPath, keyPath string) ConfigOption
- func WithTrustedCerts(certPaths ...string) ConfigOption
- func WithVersion(version string) ConfigOption
- type DkgStatus
- type DrandDaemon
- func (dd *DrandDaemon) AddBeaconHandler(beaconID string, bp *BeaconProcess)
- func (dd *DrandDaemon) BackupDatabase(ctx context.Context, in *drand.BackupDBRequest) (*drand.BackupDBResponse, error)
- func (dd *DrandDaemon) BroadcastDKG(c context.Context, in *drand.DKGPacket) (*drand.Empty, error)
- func (dd *DrandDaemon) ChainInfo(ctx context.Context, in *drand.ChainInfoRequest) (*drand.ChainInfoPacket, error)
- func (dd *DrandDaemon) GetIdentity(ctx context.Context, in *drand.IdentityRequest) (*drand.IdentityResponse, error)
- func (dd *DrandDaemon) GroupFile(ctx context.Context, in *drand.GroupRequest) (*drand.GroupPacket, error)
- func (dd *DrandDaemon) Home(c context.Context, in *drand.HomeRequest) (*drand.HomeResponse, error)
- func (dd *DrandDaemon) InitDKG(c context.Context, in *drand.InitDKGPacket) (*drand.GroupPacket, error)
- func (dd *DrandDaemon) InitReshare(ctx context.Context, in *drand.InitResharePacket) (*drand.GroupPacket, error)
- func (dd *DrandDaemon) InstantiateBeaconProcess(beaconID string, store key.Store) (*BeaconProcess, error)
- func (dd *DrandDaemon) ListBeaconIDs(ctx context.Context, in *drand.ListBeaconIDsRequest) (*drand.ListBeaconIDsResponse, error)
- func (dd *DrandDaemon) ListSchemes(ctx context.Context, in *drand.ListSchemesRequest) (*drand.ListSchemesResponse, error)
- func (dd *DrandDaemon) LoadBeacon(ctx context.Context, in *drand.LoadBeaconRequest) (*drand.LoadBeaconResponse, error)
- func (dd *DrandDaemon) LoadBeaconFromDisk(beaconID string) (*BeaconProcess, error)
- func (dd *DrandDaemon) LoadBeaconFromStore(beaconID string, store key.Store) (*BeaconProcess, error)
- func (dd *DrandDaemon) LoadBeaconsFromDisk(metricsFlag string, singleBeacon bool, singleBeaconName string) error
- func (dd *DrandDaemon) NodeVersionStreamValidator(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func (dd *DrandDaemon) NodeVersionValidator(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (response interface{}, err error)
- func (dd *DrandDaemon) PartialBeacon(c context.Context, in *drand.PartialBeaconPacket) (*drand.Empty, error)
- func (dd *DrandDaemon) PingPong(ctx context.Context, in *drand.Ping) (*drand.Pong, error)
- func (dd *DrandDaemon) PrivateKey(ctx context.Context, in *drand.PrivateKeyRequest) (*drand.PrivateKeyResponse, error)
- func (dd *DrandDaemon) PublicKey(ctx context.Context, in *drand.PublicKeyRequest) (*drand.PublicKeyResponse, error)
- func (dd *DrandDaemon) PublicRand(c context.Context, in *drand.PublicRandRequest) (*drand.PublicRandResponse, error)
- func (dd *DrandDaemon) PublicRandStream(in *drand.PublicRandRequest, stream drand.Public_PublicRandStreamServer) error
- func (dd *DrandDaemon) PushDKGInfo(ctx context.Context, in *drand.DKGInfoPacket) (*drand.Empty, error)
- func (dd *DrandDaemon) RemoteStatus(ctx context.Context, request *drand.RemoteStatusRequest) (*drand.RemoteStatusResponse, error)
- func (dd *DrandDaemon) RemoveBeaconHandler(beaconID string, bp *BeaconProcess)
- func (dd *DrandDaemon) RemoveBeaconProcess(beaconID string, bp *BeaconProcess)
- func (dd *DrandDaemon) Share(_ context.Context, _ *drand.ShareRequest) (*drand.ShareResponse, error)
- func (dd *DrandDaemon) Shutdown(ctx context.Context, in *drand.ShutdownRequest) (*drand.ShutdownResponse, error)
- func (dd *DrandDaemon) SignalDKGParticipant(ctx context.Context, in *drand.SignalDKGPacket) (*drand.Empty, error)
- func (dd *DrandDaemon) StartCheckChain(in *drand.StartSyncRequest, stream drand.Control_StartCheckChainServer) error
- func (dd *DrandDaemon) StartFollowChain(in *drand.StartSyncRequest, stream drand.Control_StartFollowChainServer) error
- func (dd *DrandDaemon) Status(ctx context.Context, in *drand.StatusRequest) (*drand.StatusResponse, error)
- func (dd *DrandDaemon) Stop(ctx context.Context)
- func (dd *DrandDaemon) SyncChain(in *drand.SyncRequest, stream drand.Protocol_SyncChainServer) error
- func (dd *DrandDaemon) WaitExit() chan bool
- type MetadataGetter
- type ReshareStatus
Constants ¶
const DefaultBeaconPeriod = 1 * time.Minute
DefaultBeaconPeriod is the period in which the beacon logic creates new random beacon.
const DefaultConfigFolderName = ".drand"
DefaultConfigFolderName is the name of the folder containing all key materials (and the beacons db file by default). It is relative to the user's home directory.
const DefaultControlPort = "8888"
DefaultControlPort is the default port the functionality control port communicate on.
const DefaultDBFolder = "db"
DefaultDBFolder is the name of the folder in which the db file is saved. It is relative to the DefaultConfigFolder path.
const DefaultDKGTimeout = 10 * time.Second
DefaultDKGTimeout is the default time of each DKG period by default. Note that by default, DKG uses the "fast sync" mode that shorten the first phase and the second phase, "as fast as possible" when the protocol runs smoothly (there is no malicious party).
const DefaultGenesisOffset = 1 * time.Second
DefaultGenesisOffset is the time the leader adds after the maximum DKG time (the full three phases) to compute the genesis time of the randomness chain.
const InProgressDesc = "In progress"
const NotStartedDesc = "Not started"
const UnknownDesc = "Unknown"
Variables ¶
var DefaultResharingOffset = 30 * time.Second
DefaultResharingOffset is the time the leader adds to the current time to set the TransitionTime field in the group file when setting up a resharing. This time will be rounded up to the next round time of the beacon, since a beacon has to keep the same period.
var MaxWaitPrepareDKG = 24 * 7 * 2 * time.Hour
MaxWaitPrepareDKG is the maximum time the "automatic" setting up of the group can take. If the setup is still not finished after this time, it is canceled.
Functions ¶
func DefaultConfigFolder ¶
func DefaultConfigFolder() string
DefaultConfigFolder returns the default path of the configuration folder.
func GetBeaconDescription ¶ added in v1.4.6
func GetBeaconDescription(value BeaconStatus) string
func GetDkgStatusDescription ¶ added in v1.4.6
func GetReshareStatusDescription ¶ added in v1.4.6
func GetReshareStatusDescription(value ReshareStatus) string
func Proxy ¶ added in v1.0.0
func Proxy(s drand.PublicServer) client.Client
Proxy wraps a server interface into a client interface so it can be queried
func StatusResponseToString ¶ added in v1.4.6
func StatusResponseToString(status *drand.StatusResponse) string
Types ¶
type BeaconProcess ¶ added in v1.4.6
type BeaconProcess struct {
// contains filtered or unexported fields
}
BeaconProcess is the main logic of the program. It reads the keys / group file, it can start the DKG, read/write shares to files and can initiate/respond to tBLS signature requests.
func NewBeaconProcess ¶ added in v1.4.6
func NewBeaconProcess(log dlog.Logger, store key.Store, beaconID string, opts *Config, privGateway *net.PrivateGateway, pubGateway *net.PublicGateway) (*BeaconProcess, error)
func (*BeaconProcess) BackupDatabase ¶ added in v1.4.6
func (bp *BeaconProcess) BackupDatabase(ctx context.Context, req *drand.BackupDBRequest) (*drand.BackupDBResponse, error)
BackupDatabase triggers a backup of the primary database.
func (*BeaconProcess) BroadcastDKG ¶ added in v1.4.6
BroadcastDKG is the public method to call during a DKG protocol.
func (*BeaconProcess) ChainInfo ¶ added in v1.4.6
func (bp *BeaconProcess) ChainInfo(context.Context, *drand.ChainInfoRequest) (*drand.ChainInfoPacket, error)
ChainInfo replies with the chain information this node participates to
func (*BeaconProcess) GetIdentity ¶ added in v1.4.6
func (bp *BeaconProcess) GetIdentity(context.Context, *drand.IdentityRequest) (*drand.IdentityResponse, error)
GetIdentity returns the identity of this drand node
func (*BeaconProcess) GroupFile ¶ added in v1.4.6
func (bp *BeaconProcess) GroupFile(context.Context, *drand.GroupRequest) (*drand.GroupPacket, error)
GroupFile replies with the distributed key in the response
func (*BeaconProcess) Home ¶ added in v1.4.6
func (bp *BeaconProcess) Home(c context.Context, _ *drand.HomeRequest) (*drand.HomeResponse, error)
Home provides the address the local node is listening
func (*BeaconProcess) InitDKG ¶ added in v1.4.6
func (bp *BeaconProcess) InitDKG(c context.Context, in *drand.InitDKGPacket) (*drand.GroupPacket, error)
InitDKG take a InitDKGPacket, extracts the information needed and wait for the DKG protocol to finish. If the request specifies this node is a leader, it starts the DKG protocol.
func (*BeaconProcess) InitReshare ¶ added in v1.4.6
func (bp *BeaconProcess) InitReshare(c context.Context, in *drand.InitResharePacket) (*drand.GroupPacket, error)
InitReshare receives information about the old and new group from which to operate the resharing protocol.
func (*BeaconProcess) ListBeaconIDs ¶ added in v1.4.6
func (bp *BeaconProcess) ListBeaconIDs(context.Context, *drand.ListSchemesRequest) (*drand.ListSchemesResponse, error)
func (*BeaconProcess) ListSchemes ¶ added in v1.4.6
func (bp *BeaconProcess) ListSchemes(context.Context, *drand.ListSchemesRequest) (*drand.ListSchemesResponse, error)
func (*BeaconProcess) Load ¶ added in v1.4.6
func (bp *BeaconProcess) Load() (bool, error)
Load restores a drand instance that is ready to serve randomness, with a pre-existing distributed share. Returns 'true' if this BeaconProcess is a fresh run, returns 'false' otherwise
func (*BeaconProcess) MetricsHandlerForPeer ¶ added in v1.4.6
func (bp *BeaconProcess) MetricsHandlerForPeer(addr string) (http.Handler, error)
MetricsHandlerForPeer returns a handler for retrieving metric information from a peer in this group
func (*BeaconProcess) PartialBeacon ¶ added in v1.4.6
func (bp *BeaconProcess) PartialBeacon(c context.Context, in *drand.PartialBeaconPacket) (*drand.Empty, error)
PartialBeacon receives a beacon generation request and answers with the partial signature from this drand node.
func (*BeaconProcess) PingPong ¶ added in v1.4.6
PingPong simply responds with an empty packet, proving that this drand node is up and alive.
func (*BeaconProcess) PublicKey ¶ added in v1.4.6
func (bp *BeaconProcess) PublicKey(context.Context, *drand.PublicKeyRequest) (*drand.PublicKeyResponse, error)
PublicKey is a functionality of Control Service defined in protobuf/control that requests the long term public key of the drand node running locally
func (*BeaconProcess) PublicRand ¶ added in v1.4.6
func (bp *BeaconProcess) PublicRand(ctx context.Context, in *drand.PublicRandRequest) (*drand.PublicRandResponse, error)
PublicRand returns a public random beacon according to the request. If the Round field is 0, then it returns the last one generated.
func (*BeaconProcess) PublicRandStream ¶ added in v1.4.6
func (bp *BeaconProcess) PublicRandStream(req *drand.PublicRandRequest, stream drand.Public_PublicRandStreamServer) error
PublicRandStream exports a stream of new beacons as they are generated over gRPC
func (*BeaconProcess) PushDKGInfo ¶ added in v1.4.6
func (bp *BeaconProcess) PushDKGInfo(_ context.Context, in *drand.DKGInfoPacket) (*drand.Empty, error)
PushDKGInfo triggers sending DKG info to other members
func (*BeaconProcess) RemoteStatus ¶ added in v1.4.6
func (bp *BeaconProcess) RemoteStatus(ctx context.Context, in *drand.RemoteStatusRequest) (*drand.RemoteStatusResponse, error)
func (*BeaconProcess) SignalDKGParticipant ¶ added in v1.4.6
func (bp *BeaconProcess) SignalDKGParticipant(ctx context.Context, p *drand.SignalDKGPacket) (*drand.Empty, error)
SignalDKGParticipant receives a dkg signal packet from another member
func (*BeaconProcess) StartBeacon ¶ added in v1.4.6
func (bp *BeaconProcess) StartBeacon(catchup bool) error
StartBeacon initializes the beacon if needed and launch a go routine that runs the generation loop.
func (*BeaconProcess) StartCheckChain ¶ added in v1.4.6
func (bp *BeaconProcess) StartCheckChain(req *drand.StartSyncRequest, stream drand.Control_StartCheckChainServer) error
StartCheckChain checks a chain for validity and pulls invalid beacons from other nodes
func (*BeaconProcess) StartFollowChain ¶ added in v1.4.6
func (bp *BeaconProcess) StartFollowChain(req *drand.StartSyncRequest, stream drand.Control_StartFollowChainServer) error
StartFollowChain syncs up with a chain from other nodes
func (*BeaconProcess) Status ¶ added in v1.4.6
func (bp *BeaconProcess) Status(ctx context.Context, in *drand.StatusRequest) (*drand.StatusResponse, error)
Status responds with the actual status of drand process
func (*BeaconProcess) Stop ¶ added in v1.4.6
func (bp *BeaconProcess) Stop(ctx context.Context)
Stop simply stops all drand operations.
func (*BeaconProcess) StopBeacon ¶ added in v1.4.6
func (bp *BeaconProcess) StopBeacon()
StopBeacon stops the beacon generation process and resets it.
func (*BeaconProcess) SyncChain ¶ added in v1.4.6
func (bp *BeaconProcess) SyncChain(req *drand.SyncRequest, stream drand.Protocol_SyncChainServer) error
SyncChain is an inter-node protocol that replies to a syncing request from a given round
func (*BeaconProcess) WaitDKG ¶ added in v1.4.6
func (bp *BeaconProcess) WaitDKG() (*key.Group, error)
WaitDKG waits on the running dkg protocol. In case of an error, it returns it. In case of a finished DKG protocol, it saves the dist. public key and private share. These should be loadable by the store.
func (*BeaconProcess) WaitExit ¶ added in v1.4.6
func (bp *BeaconProcess) WaitExit() chan bool
WaitExit returns a channel that signals when drand stops its operations
type BeaconStatus ¶ added in v1.4.6
type BeaconStatus uint32
const ( BeaconNotInited BeaconStatus = iota BeaconInited )
type Broadcast ¶ added in v1.2.6
type Broadcast interface { dkg.Board BroadcastDKG(c context.Context, p *drand.DKGPacket) error Stop() }
Broadcast is an interface that represents the minimum functionality required by drand to both (1) be the interface between drand and the dkg logic and (2) implement the broadcasting mechanism.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the endpoint logic, communicating with drand servers XXX: This API should go away. Do not extend any further.
func NewGrpcClient ¶ added in v0.3.7
func NewGrpcClient(chainHash []byte, opts ...grpc.DialOption) *Client
NewGrpcClient returns a Client able to talk to drand instances using gRPC communication method
func NewGrpcClientFromCert ¶ added in v0.3.7
func NewGrpcClientFromCert(chainHash []byte, c *net.CertManager, opts ...grpc.DialOption) *Client
NewGrpcClientFromCert returns a client that contact its peer over TLS
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds all relevant information for a drand node to run.
func NewConfig ¶
func NewConfig(opts ...ConfigOption) *Config
NewConfig returns the config to pass to drand with the default options set and the updated values given by the options.
func (*Config) BoltOptions ¶ added in v0.9.0
BoltOptions returns the options given to the bolt db
func (*Config) Certs ¶ added in v0.3.7
func (d *Config) Certs() *net.CertManager
Certs returns all custom certs currently being trusted by drand.
func (*Config) ConfigFolder ¶
ConfigFolder returns the folder under which drand stores all its configuration.
func (*Config) ConfigFolderMB ¶ added in v1.4.6
ConfigFolderMB returns the folder under which multi-beacon drand stores all its configuration.
func (*Config) ControlPort ¶ added in v0.4.0
ControlPort returns the port used for control port communications which can be the default one or the port setup thanks to WithControlPort
func (*Config) DBFolder ¶
DBFolder returns the folder under which drand stores db file specifically. If beacon id is empty, it will use the default value
func (*Config) PrivateListenAddress ¶ added in v0.9.0
PrivateListenAddress returns the given default address or the listen address stored in the config thanks to WithPrivateListenAddress
func (*Config) PublicListenAddress ¶ added in v0.9.0
PublicListenAddress returns the given default address or the listen address stored in the config thanks to WithPublicListenAddress
type ConfigOption ¶
type ConfigOption func(*Config)
ConfigOption is a function that applies a specific setting to a Config.
func WithBoltOptions ¶
func WithBoltOptions(opts *bolt.Options) ConfigOption
WithBoltOptions applies boltdb specific options when storing random beacons.
func WithCallOption ¶ added in v0.3.7
func WithCallOption(opts ...grpc.CallOption) ConfigOption
WithCallOption applies grpc options when drand calls a gRPC method.
func WithConfigFolder ¶
func WithConfigFolder(folder string) ConfigOption
WithConfigFolder sets the base configuration folder to the given string.
func WithControlPort ¶ added in v0.4.0
func WithControlPort(port string) ConfigOption
WithControlPort specifies which port on localhost the ListenerControl should bind to.
func WithDBStorageEngine ¶ added in v1.5.3
func WithDBStorageEngine(engine chain.StorageType) ConfigOption
WithDBStorageEngine allows setting the specific storage type
func WithDkgTimeout ¶
func WithDkgTimeout(t time.Duration) ConfigOption
WithDkgTimeout sets the timeout under which the DKG must finish.
func WithGrpcOptions ¶
func WithGrpcOptions(opts ...grpc.DialOption) ConfigOption
WithGrpcOptions applies grpc dialing option used when a drand node actively contacts another.
func WithInsecure ¶ added in v0.3.7
func WithInsecure() ConfigOption
WithInsecure allows drand to listen on standard non-encrypted port and to contact other nodes over non-encrypted TCP connections.
func WithLogLevel ¶ added in v0.5.2
func WithLogLevel(level int, jsonFormat bool) ConfigOption
WithLogLevel sets the logging verbosity to the given level.
func WithMemDBSize ¶ added in v1.5.3
func WithMemDBSize(bufferSize int) ConfigOption
func WithPgDSN ¶ added in v1.5.3
func WithPgDSN(dsn string) ConfigOption
WithPgDSN applies PosgresSQL specific options to the PG store. It will also create a new database connection.
func WithPrivateListenAddress ¶ added in v0.9.0
func WithPrivateListenAddress(addr string) ConfigOption
WithPrivateListenAddress specifies the address the drand instance should bind to. It is useful if you want to advertise a public proxy address and the drand instance runs behind your network.
func WithPublicListenAddress ¶ added in v0.9.0
func WithPublicListenAddress(addr string) ConfigOption
WithPublicListenAddress specifies the address the drand instance should bind to. It is useful if you want to advertise a public proxy address and the drand instance runs behind your network.
func WithTLS ¶ added in v0.3.7
func WithTLS(certPath, keyPath string) ConfigOption
WithTLS registers the certificates and private key path so drand can accept and issue connections using TLS.
func WithTrustedCerts ¶ added in v0.3.7
func WithTrustedCerts(certPaths ...string) ConfigOption
WithTrustedCerts saves the certificates at the given paths and forces drand to trust them. Mostly useful for testing.
func WithVersion ¶ added in v1.0.0
func WithVersion(version string) ConfigOption
WithVersion sets a version for drand, a visible string to other peers.
type DrandDaemon ¶ added in v1.4.6
type DrandDaemon struct {
// contains filtered or unexported fields
}
func NewDrandDaemon ¶ added in v1.4.6
func NewDrandDaemon(c *Config) (*DrandDaemon, error)
NewDrandDaemon creates a new instance of DrandDaemon
func (*DrandDaemon) AddBeaconHandler ¶ added in v1.4.6
func (dd *DrandDaemon) AddBeaconHandler(beaconID string, bp *BeaconProcess)
AddBeaconHandler adds a handler linked to beacon with chain hash from http server used to expose public services
func (*DrandDaemon) BackupDatabase ¶ added in v1.4.6
func (dd *DrandDaemon) BackupDatabase(ctx context.Context, in *drand.BackupDBRequest) (*drand.BackupDBResponse, error)
BackupDatabase triggers a backup of the primary database.
func (*DrandDaemon) BroadcastDKG ¶ added in v1.4.6
BroadcastDKG is the public method to call during a DKG protocol.
func (*DrandDaemon) ChainInfo ¶ added in v1.4.6
func (dd *DrandDaemon) ChainInfo(ctx context.Context, in *drand.ChainInfoRequest) (*drand.ChainInfoPacket, error)
ChainInfo replies with the chain information this node participates to
func (*DrandDaemon) GetIdentity ¶ added in v1.4.6
func (dd *DrandDaemon) GetIdentity(ctx context.Context, in *drand.IdentityRequest) (*drand.IdentityResponse, error)
GetIdentity returns the identity of this drand node
func (*DrandDaemon) GroupFile ¶ added in v1.4.6
func (dd *DrandDaemon) GroupFile(ctx context.Context, in *drand.GroupRequest) (*drand.GroupPacket, error)
GroupFile replies with the distributed key in the response
func (*DrandDaemon) Home ¶ added in v1.4.6
func (dd *DrandDaemon) Home(c context.Context, in *drand.HomeRequest) (*drand.HomeResponse, error)
Home provides the address the local node is listening
func (*DrandDaemon) InitDKG ¶ added in v1.4.6
func (dd *DrandDaemon) InitDKG(c context.Context, in *drand.InitDKGPacket) (*drand.GroupPacket, error)
InitDKG take a InitDKGPacket, extracts the information needed and wait for the DKG protocol to finish. If the request specifies this node is a leader, it starts the DKG protocol.
func (*DrandDaemon) InitReshare ¶ added in v1.4.6
func (dd *DrandDaemon) InitReshare(ctx context.Context, in *drand.InitResharePacket) (*drand.GroupPacket, error)
InitReshare receives information about the old and new group from which to operate the resharing protocol.
func (*DrandDaemon) InstantiateBeaconProcess ¶ added in v1.4.6
func (dd *DrandDaemon) InstantiateBeaconProcess(beaconID string, store key.Store) (*BeaconProcess, error)
InstantiateBeaconProcess creates a new BeaconProcess linked to beacon with id 'beaconID'
func (*DrandDaemon) ListBeaconIDs ¶ added in v1.4.6
func (dd *DrandDaemon) ListBeaconIDs(ctx context.Context, in *drand.ListBeaconIDsRequest) (*drand.ListBeaconIDsResponse, error)
func (*DrandDaemon) ListSchemes ¶ added in v1.4.6
func (dd *DrandDaemon) ListSchemes(ctx context.Context, in *drand.ListSchemesRequest) (*drand.ListSchemesResponse, error)
func (*DrandDaemon) LoadBeacon ¶ added in v1.4.6
func (dd *DrandDaemon) LoadBeacon(ctx context.Context, in *drand.LoadBeaconRequest) (*drand.LoadBeaconResponse, error)
LoadBeacon tells the DrandDaemon to load a new beacon into the memory
func (*DrandDaemon) LoadBeaconFromDisk ¶ added in v1.4.6
func (dd *DrandDaemon) LoadBeaconFromDisk(beaconID string) (*BeaconProcess, error)
func (*DrandDaemon) LoadBeaconFromStore ¶ added in v1.4.6
func (dd *DrandDaemon) LoadBeaconFromStore(beaconID string, store key.Store) (*BeaconProcess, error)
func (*DrandDaemon) LoadBeaconsFromDisk ¶ added in v1.4.6
func (dd *DrandDaemon) LoadBeaconsFromDisk(metricsFlag string, singleBeacon bool, singleBeaconName string) error
LoadBeaconsFromDisk checks for existing stores and creates the corresponding BeaconProcess accordingly to each stored BeaconID. When singleBeacon is set, and the singleBeaconName matches one of the stored beacons, then only that beacon will be loaded. If the singleBeaconName is an empty string, no beacon will be loaded.
func (*DrandDaemon) NodeVersionStreamValidator ¶ added in v1.4.6
func (dd *DrandDaemon) NodeVersionStreamValidator(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
func (*DrandDaemon) NodeVersionValidator ¶ added in v1.4.6
func (dd *DrandDaemon) NodeVersionValidator(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (response interface{}, err error)
func (*DrandDaemon) PartialBeacon ¶ added in v1.4.6
func (dd *DrandDaemon) PartialBeacon(c context.Context, in *drand.PartialBeaconPacket) (*drand.Empty, error)
PartialBeacon receives a beacon generation request and answers with the partial signature from this drand node.
func (*DrandDaemon) PingPong ¶ added in v1.4.6
PingPong simply responds with an empty packet, proving that this drand node is up and alive.
func (*DrandDaemon) PrivateKey ¶ added in v1.4.6
func (dd *DrandDaemon) PrivateKey(ctx context.Context, in *drand.PrivateKeyRequest) (*drand.PrivateKeyResponse, error)
PrivateKey is a functionality of Control Service defined in protobuf/control that requests the long term private key of the drand node running locally Deprecated: no need to export secret key to a remote client.
func (*DrandDaemon) PublicKey ¶ added in v1.4.6
func (dd *DrandDaemon) PublicKey(ctx context.Context, in *drand.PublicKeyRequest) (*drand.PublicKeyResponse, error)
PublicKey is a functionality of Control Service defined in protobuf/control that requests the long term public key of the drand node running locally
func (*DrandDaemon) PublicRand ¶ added in v1.4.6
func (dd *DrandDaemon) PublicRand(c context.Context, in *drand.PublicRandRequest) (*drand.PublicRandResponse, error)
PublicRand returns a public random beacon according to the request. If the Round field is 0, then it returns the last one generated.
func (*DrandDaemon) PublicRandStream ¶ added in v1.4.6
func (dd *DrandDaemon) PublicRandStream(in *drand.PublicRandRequest, stream drand.Public_PublicRandStreamServer) error
PublicRandStream exports a stream of new beacons as they are generated over gRPC
func (*DrandDaemon) PushDKGInfo ¶ added in v1.4.6
func (dd *DrandDaemon) PushDKGInfo(ctx context.Context, in *drand.DKGInfoPacket) (*drand.Empty, error)
PushDKGInfo triggers sending DKG info to other members
func (*DrandDaemon) RemoteStatus ¶ added in v1.4.6
func (dd *DrandDaemon) RemoteStatus(ctx context.Context, request *drand.RemoteStatusRequest) (*drand.RemoteStatusResponse, error)
func (*DrandDaemon) RemoveBeaconHandler ¶ added in v1.4.6
func (dd *DrandDaemon) RemoveBeaconHandler(beaconID string, bp *BeaconProcess)
RemoveBeaconHandler removes a handler linked to beacon with chain hash from http server used to expose public services
func (*DrandDaemon) RemoveBeaconProcess ¶ added in v1.4.6
func (dd *DrandDaemon) RemoveBeaconProcess(beaconID string, bp *BeaconProcess)
RemoveBeaconProcess remove a BeaconProcess linked to beacon with id 'beaconID'
func (*DrandDaemon) Share ¶ added in v1.4.6
func (dd *DrandDaemon) Share(_ context.Context, _ *drand.ShareRequest) (*drand.ShareResponse, error)
Share is a functionality of Control Service defined in protobuf/control that requests the private share of the drand node running locally Deprecated: no need to export the secret share to a remote client.
func (*DrandDaemon) Shutdown ¶ added in v1.4.6
func (dd *DrandDaemon) Shutdown(ctx context.Context, in *drand.ShutdownRequest) (*drand.ShutdownResponse, error)
Shutdown stops the node
func (*DrandDaemon) SignalDKGParticipant ¶ added in v1.4.6
func (dd *DrandDaemon) SignalDKGParticipant(ctx context.Context, in *drand.SignalDKGPacket) (*drand.Empty, error)
SignalDKGParticipant receives a dkg signal packet from another member
func (*DrandDaemon) StartCheckChain ¶ added in v1.4.6
func (dd *DrandDaemon) StartCheckChain(in *drand.StartSyncRequest, stream drand.Control_StartCheckChainServer) error
func (*DrandDaemon) StartFollowChain ¶ added in v1.4.6
func (dd *DrandDaemon) StartFollowChain(in *drand.StartSyncRequest, stream drand.Control_StartFollowChainServer) error
func (*DrandDaemon) Status ¶ added in v1.4.6
func (dd *DrandDaemon) Status(ctx context.Context, in *drand.StatusRequest) (*drand.StatusResponse, error)
Status responds with the actual status of drand process
func (*DrandDaemon) Stop ¶ added in v1.4.6
func (dd *DrandDaemon) Stop(ctx context.Context)
Stop simply stops all drand operations.
func (*DrandDaemon) SyncChain ¶ added in v1.4.6
func (dd *DrandDaemon) SyncChain(in *drand.SyncRequest, stream drand.Protocol_SyncChainServer) error
SyncChain is a inter-node protocol that replies to a syncing request from a given round
func (*DrandDaemon) WaitExit ¶ added in v1.4.6
func (dd *DrandDaemon) WaitExit() chan bool
WaitExit returns a channel that signals when drand stops its operations
type MetadataGetter ¶ added in v1.4.6
Source Files ¶
- broadcast.go
- client_public.go
- config.go
- constants.go
- convert.go
- drand_beacon.go
- drand_beacon_control.go
- drand_beacon_metrics.go
- drand_beacon_public.go
- drand_daemon.go
- drand_daemon_control.go
- drand_daemon_helper.go
- drand_daemon_interceptors.go
- drand_daemon_public.go
- drand_proxy.go
- drand_status.go
- group_setup.go