Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle DRAND API outages #90

Open
Tracked by #131
bajtos opened this issue Aug 26, 2024 · 3 comments
Open
Tracked by #131

Handle DRAND API outages #90

bajtos opened this issue Aug 26, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@bajtos
Copy link
Member

bajtos commented Aug 26, 2024

See e35c089 and https://space-meridian.slack.com/archives/C06RPCL6QGL/p1724249441844879

DRAND provides several API endpoints; see https://drand.love/docs/http-api-reference:

Protocol Labs

We should implement a fallback to other API endpoints when the primary one is down.

A possibly better & easier alternative is to use FastestNodeClient, see drand-client docs:

// if you're happy to get randomness from many APIs and automatically use the fastest
// you can construct a `FastestNodeClient` with multiple URLs
// note: the randomness beacons are cryptographically verifiable, so as long as you fill
// in the `chainVerificationParams` in the options, you don't need to worry about malicious 
// providers sending you fake randomness!
const urls = [
    'https://api.drand.sh',
    'https://drand.cloudflare.com'
    // ...
]
const fastestNodeClient = new FastestNodeClient(urls, options)
// don't forget to start the client, or it won't periodically optimise for the fastest node!
fastestNodeClient.start()
@bajtos bajtos added the enhancement New feature or request label Aug 26, 2024
@bajtos bajtos mentioned this issue Aug 26, 2024
36 tasks
@juliangruber
Copy link
Member

+1 to using FastestNodeClient

@bajtos
Copy link
Member Author

bajtos commented Aug 26, 2024

Hmm, after reading the implementation, I don't think FastestNodeClient is what we want. You need to run a benchmark to pick the fastest API provider. Then, the request is sent to this fastest provider only.

I wish drand-client provided something like FallbackProvider in Ethers.js.

@bajtos
Copy link
Member Author

bajtos commented Aug 26, 2024

I opened a feature request in drand-client repo: drand/drand-client#84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🗃 backlog
Development

No branches or pull requests

2 participants