Crates.io | drand_core |
lib.rs | drand_core |
version | 0.0.16 |
source | src |
created_at | 2023-03-01 15:07:54.532841 |
updated_at | 2024-03-09 20:42:38.608039 |
description | A drand client library. |
homepage | https://github.com/thibmeu/drand-rs/tree/main/drand_core |
repository | https://github.com/thibmeu/drand-rs |
max_upload_size | |
id | 798095 |
size | 109,239 |
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.
Environment | CLI Command |
---|---|
Cargo (Rust 1.74+) | 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-unknown-unknown
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, and correlates the returned round number with the chain genesis time.
let latest = client.latest()?;
Code examples are provided in drand_core/examples. You can run them using cargo run --examples <name>
.
ID | Remote | Timelock encryption |
---|---|---|
quicknet-cloudflare |
https://drand.cloudflare.com/52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971 |
Yes |
quicknet-pl |
https://api.drand.sh/52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971 |
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.
This library has not been audited. Please use at your sole discretion.
This project is under the MIT license.
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.