Chainlink VRF
Every Duty3 winner is selected by Chainlink VRF — a Verifiable Random Function that produces cryptographically provable randomness. No human, no operator, and not even Chainlink itself can predict or manipulate the outcome.
What is a VRF?
A Verifiable Random Function (VRF) is a cryptographic primitive that generates a random number together with a proof. Anyone who receives the number and the proof can verify that the number was generated correctly — without being able to predict it in advance.
Chainlink VRF works by having a decentralized oracle node generate a random number off-chain using a secret key, then publish both the number and a cryptographic proof on-chain. The smart contract verifies the proof before using the number — ensuring the result is unmanipulated.
The VRF Flow in Duty3
- The vault closes (all tickets sold or deadline passed)
- The vault calls
requestRandomWords()on the Chainlink VRF Coordinator, transitioning to CALCULATING state - Chainlink's oracle generates a random number off-chain with its secret key
- The oracle submits the number + proof to the VRF Coordinator on Arbitrum
- The Coordinator verifies the proof on-chain, then calls
fulfillRandomWords()on the vault - The vault uses the random number to select the winning ticket ID and pays out the prize
Winner Selection Formula
// Single winner:
winningTicketId = vrfRandomWord % totalTicketsSold
// Multi-winner (N winners):
for i in 0..N:
winningTicketId[i] = uint256(keccak256(vrfRandomWord, i)) % totalTicketsSoldTicket IDs are assigned sequentially starting from 0. The holder of the winning ticket ID receives the prize.
Why This Cannot Be Manipulated
- Commit-reveal scheme — the random number is generated before being published. No one knows it until the oracle submits it.
- On-chain proof verification — the VRF Coordinator verifies the proof mathematically. Any tampered number would fail verification and revert.
- Decentralized oracle — Chainlink operates across multiple independent nodes. No single entity controls the output.
- No miner influence — unlike block hash-based randomness, VRF output cannot be influenced by miners or validators withholding blocks.
Timing
On Arbitrum, VRF fulfillment typically arrives within 1-3 blocks (~0.5-1 second) after the request. In rare cases of oracle congestion, it may take up to a few minutes. The vrfRequestTimestamp field on the vault records when the request was made.
Verifying a Draw
Every VRF fulfillment is visible on Arbiscan. To verify a specific raffle's draw:
- Open the vault contract address on Arbiscan
- Find the
WinnerPickedorMultiWinnersPickedevent in the transaction logs - Cross-reference the VRF request ID with Chainlink's on-chain records
The full proof is permanently recorded on-chain and independently verifiable by anyone.