# drand-core: Rust implementation of drand
[][Documentation]

[][Crates.io]
[Crates.io]: https://crates.io/crates/drand_core
[Documentation]: https://docs.rs/drand_core/
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](https://drand.love/docs/specification/). drand was designed in [Scalable Bias-Resistant Distributed Randomness](https://eprint.iacr.org/2016/1067.pdf).
The reference interroperable Go implementation is available at [drand/drand](https://github.com/drand/drand).
## Tables of Content
* [Features](#features)
* [What's next](#whats-next)
* [Installation](#installation)
* [Usage](#usage)
* [Common remotes](#common-remotes)
* [Security Considerations](#security-considerations)
* [License](#license)
## Features
* Retrieve and verify drand randomness
* Built-in beacon time estimation
* 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
## Installation
| 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`
## Usage
Retrieve the latest beacon from `https://drand.cloudflare.com`.
```rust
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](./examples). You can run them using `cargo run --examples <name>`.
### Common remotes
| `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](https://drand.love/developer/).
## 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.