go-clients

command module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0, MIT Imports: 3 Imported by: 0

README

go-clients is a Go client library and a set of useful binaries for the drand ecosystem

This repo contains most notably:

  • Go code for interfacing with the drand networks through both HTTP and Gossipsub
  • a client CLI tool to fetch and verify drand beacons from the various available sources in your terminal
  • a gossipsub relay to relay drand beacons on gossipsub

Migration from drand/drand

Prior to drand V2 release, the drand client code lived in the drand/drand repo. Since its V2 release, the drand daemon code aims at being more minimalist and having as few dependencies as possible. Most notably this meant removing the libp2p code that was exclusively used for Gossip relays and Gossip client, and also trimming down the amount of HTTP-related code.

From now on, this repo is meant to provide the Go Client code to interact with drand, query drand beacons and verify them through either the HTTP or the Gossip relays.

Note that drand does not provide public gRPC endpoints since ~2020, therefore the gRPC client code has been moved to the internal package of the relays (to allow relays to directly interface with a working daemon using gRPC).

There are relatively few changes to the public APIs of the client code and simply using the drand/go-clients/http packages should be enough. We recommend using go-doc to see the usage documentation and examples.

Most notable changes from the drand/drand V1 APIs

The Result interface now follows the Protobuf getter format:

Result.Round() -> Result.GetRound()
Result.Randomness() -> Result.GetRandomness()
Result.Signature() -> Result.GetSignature()
Result.PreviousSignature() -> Result.GetPreviousSignature()

meaning PublicRandResponse now satisfies directly the Result interface.

The HTTP client now returns a concrete type and doesn't need to be cast to a HTTP client to use e.g. SetUserAgent.

The client option WithVerifiedResult was renamed WithTrustedResult, to properly convey its function.

Note also that among other packages you might be using in the github.com/drand/drand/v2 packages, the crypto.GetSchemeByIDWithDefault function was renamed crypto.GetSchemeByID; and the Beacon struct now lives in the github.com/drand/drand/v2/common package rather than in the chain one.


License

This project is licensed using the Permissive License Stack which means that all contributions are available under the most permissive commonly-used licenses, and dependent projects can pick the license that best suits them.

Therefore, the project is dual-licensed under Apache 2.0 and MIT terms:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package client provides transport-agnostic logic to retrieve and verify randomness from drand, including retry, validation, caching and optimization features.
Package client provides transport-agnostic logic to retrieve and verify randomness from drand, including retry, validation, caching and optimization features.
http
Package http provides a drand client implementation that uses drand's HTTP API.
Package http provides a drand client implementation that uses drand's HTTP API.
lp2p
Package lp2p provides a drand client implementation that retrieves randomness by subscribing to a libp2p pubsub topic.
Package lp2p provides a drand client implementation that retrieves randomness by subscribing to a libp2p pubsub topic.
grpc
Package grpc provides a drand client implementation that uses drand's gRPC API.
Package grpc provides a drand client implementation that uses drand's gRPC API.
lib
metrics/pprof
Package pprof is separated out from metrics to isolate the 'init' functionality of pprof, so that it is included when used by binaries, but not if other drand packages get used or integrated into clients that don't expect the pprof side effect to have taken effect.
Package pprof is separated out from metrics to isolate the 'init' functionality of pprof, so that it is included when used by binaries, but not if other drand packages get used or integrated into clients that don't expect the pprof side effect to have taken effect.

Jump to

Keyboard shortcuts

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