Skip to content

Add an options guide for randomness in Soroban contracts #2874

Description

@briwylde08

Soroban has no native randomness primitive and the docs don't discuss it. Builders who need it (games, raffles, fair ordering) each invent a workaround. Meanwhile the landscape is moving: CAP-0089 proposes VRF-based protocol randomness with a stellar-core PR implementing ECVRF, a community drand relay exists, and an SCF-funded Soroban VRF project is in flight.

Please add a guide covering:

  • what randomness a contract can and cannot get today;
  • the options (oracle/relay such as drand, an on-chain VRF contract, commit-reveal) with trust and cost tradeoffs;
  • a note on CAP-0089 so builders can plan for it.

Surfaced by Frontier Lab's ecosystem crawl.

Activity

  1. nema1502 commented on Sep 29, 2026

    @nema1502

    Hi! I'm building Tinkazo, verifiable community draws on Soroban. Its contract checks a drand quicknet round's BLS signature on chain with the BLS12-381 host functions (CAP-0059), so there's no oracle or relay to run, and anyone can finalize a draw once the target round is published.

    I'd be glad to write this guide. What I have in mind:

    • What a contract can get today and where it falls short: ledger values, and env.prng(), whose seed is public and can be biased by a validator, plus the blind-rerun risk described in The PRNG docs should emphasize potential risks from blind-rerunning rs-soroban-sdk#1748.
    • The stronger options and their trade-offs: commit-reveal with a future round, verifying a drand round on demand inside the contract, a drand relay like Drand-Relay, and a VRF like the SCF-funded VRF-Soroban.
    • Costs measured on testnet and the trust assumptions of each, with a small example contract.
    • A short note on CAP-0089.

    I'd add it as a new page under Build → Guides, cross-linked with the PRNG docs update in stellar/rs-soroban-sdk#1748 and the planned commit-reveal example in stellar/soroban-examples#255, so the three fit together. Does that scope work for you?

  2. kaankacar commented on Oct 6, 2026

    @kaankacar
    Contributor

    @nema1502 Thanks, that scope works. Please open the PR and request a review from me (@kaankacar).

  3. nema1502 commented on Oct 6, 2026

    @nema1502

    Thanks @kaankacar, glad the scope works! I'll tag you for review when I open the PR. Since Drand-Relay is one of the options, I'd especially appreciate your eyes on that section to make sure I get it right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

  • Status
    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions