drand_core 0.0.9

A drand client library.
Documentation

drand-core: Rust implementation of drand

Documentation License crates.io

drand-core is a library to retrieve public randomness generated by drand beacons. It features an HTTP client, and verification method.

The format specification is at drand.love/docs/specification. drand was designed in Scalable Bias-Resistant Distributed Randomness.

The reference interroperable Go implementation is available at drand/drand.

Tables of Content

Features

  • Retrieve and verify drand randomness
  • Chain and unchained randomness
  • Signatures verification on G1 and G2
  • Interroperability with Go and JS implementation
  • wasm32 compatible library

What's next

  • P2P randomness retrieval
  • Built-in beacon time estimation

Installation

Environment CLI Command
Cargo (Rust 1.67+) cargo install drand_core

The library is tested against the following targets: x86_64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf, aarch64-unknown-linux-gnu, wasm32-wasi

Usage

Retrieve the latest beacon from https://drand.cloudflare.com.

use drand_core::HttpClient;

// Create a new client.
let client: HttpClient = "https://drand.cloudflare.com".try_into().unwrap();

// Get the latest beacon. By default, it verifies its signature against the chain info.
let latest = client.latest()?;

Code examples are provided in drand_core/examples. You can run them using cargo run --examples <name>.

Common remotes

ID Remote Timelock encryption
fastnet-cloudflare https://drand.cloudflare.com/dbd506d6ef76e5f386f41c651dcb808c5bcbd75471cc4eafa3f4df7ad4e4c493 Yes
fastnet-pl https://api.drand.sh/dbd506d6ef76e5f386f41c651dcb808c5bcbd75471cc4eafa3f4df7ad4e4c493 Yes
mainnet-cloudflare https://drand.cloudflare.com No
mainnet-pl https://api.drand.sh No

drand_core does not come with a default remote beacon. You should decide whichever suit your needs.

More beacon origins are available on drand website.

Security Considerations

This library has not been audited. Please use at your sole discretion.

License

This project is under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be MIT licensed as above, without any additional terms or conditions.