Skip to main content
Banner

3.3 drand Client Libraries

Client libraries enable easy access to drand randomness in specific programming languages. They also provide peace of mind by verifying randomness rounds and add additional features like failover, racing, aggregation, and caching.

Drand randomness is available over HTTPlibp2p PubSub and gRPC.

Currently, the following client libraries are available:

If your application cannot use the libraries above, you can still use the drand-client CLI or make requests to the HTTP API endpoints. If you have created a client library or know of a client library not listed here, please let us know by opening an issue.

Go Logo

Install

go get github.com/drand/drand

Usage

The Go drand client library is structured with a base client interface in /client, and with protocol-specific transport implementations in /client/http/client/grpc and /lp2p/client. The main client package holds transport agnostic logic for retrying, validation, and caching.

For documentation and examples please check the Go clients reference:

Client implementations (to be used with the above):

Install

In the browser or Deno you can grab and use the client from a CDN e.g. https://cdn.jsdelivr.net/npm/drand-client/drand.js.

In Node.js, install with:

npm install drand-client

Usage

The JS drand client is an esmodule. It has no dependencies and is not transpiled. It can be imported directly in the browser, Deno or Node.js. In Node.js it can be imported from CommonJS using await import('...').