Randomness and VRF
Gora produces randomness as a side effect of how committees are selected. Every consensus round already involves each validator publishing a verifiable random output. Your app or your on-chain contract can request that randomness, bound to a specific request, and verify it later.What VRF means here
A verifiable random function (VRF) is a sealed envelope:- The validator computes the envelope with their private key.
- The envelope looks random to everyone else.
- Anyone with the validator’s public key can verify the envelope is genuine.
- The envelope is decided before the round starts — no one can pick a different number after seeing how it played out.
(participation_key, input).
Two ways to access VRF
| Surface | Use it when | How |
|---|---|---|
| Off-chain app | You need randomness inside your app logic (e.g. a raffle winner). | Read request.vrf provided by the runtime. |
| On-chain contract | A smart contract needs unpredictable randomness it can verify. | Call Gora through the chain’s gateway program; verify the VRF proof in your contract. |
From an off-chain app
Every Gora app invocation arrives with avrf field on the request. It is derived from the proposer’s VRF output for that round, domain-separated by request_id so the same app on different requests sees different randomness.
winnerIndex from the same vrf.output_hex. The result is reproducible at verification time.
From a smart contract
A smart contract requests randomness by calling the Gora gateway on its chain. The gateway routes the request to Gora, the committee runs the request, and the gateway delivers a callback to the contract with{ result, vrf_output, vrf_proof, signatures }.
- Verifies the committee signatures against the registered validator set.
- (Optional) Verifies the VRF proof against the committee proposer’s pubkey using a Solana-style precompile or an EVM ed25519 verifier.
- Uses
vrfOutputas randomness.
contracts/.
What makes this safe
| Property | Why it holds |
|---|---|
| Unpredictability | The VRF input includes request_id and the round’s sequence; the participation key never leaves the validator. |
| Verifiability | Anyone with the proposer’s public key can check the proof. |
| Tamper-evidence | The output is committed to before votes are signed; changing it later invalidates the entire round attestation. |
| Bias resistance | The proposer is chosen by stake-weighted VRF score over the collected submissions, not by a single validator’s whim. |
When not to use Gora VRF
- You need millions of independent draws per second on-chain. Gora is request-scoped, not a high-throughput randomness firehose.
- You only need a hash of the recent block. The chain’s own block hash is cheaper and sufficient for low-stakes randomness.
Related
- Validators and consensus — where the VRF comes from in the first place.
- External calls — how to combine VRF with deterministic external data.
- Raffle example — a working end-to-end app that consumes VRF.