ROBINHOOD CHAIN / VRF
Verifiable randomness on Robinhood Chain.
Verifiable random numbers for smart contracts on Robinhood Chain.
Quickstart
npm i @d20dao/vrf-sdk// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
import {D20VRFConsumer} from "@d20dao/vrf-sdk/contracts/D20VRFConsumer.sol";
import {ID20VRF} from "@d20dao/vrf-sdk/contracts/interfaces/ID20VRF.sol";
contract Dice is D20VRFConsumer {
mapping(uint256 => bytes32) public results;
constructor(address coordinator) D20VRFConsumer(coordinator) {}
function roll(bytes32 seed) external payable returns (uint256 id) {
id = ID20VRF(vrfCoordinator).requestRandomness{value: msg.value}(seed, 100_000, msg.sender);
}
function _fulfillRandomness(uint256 id, bytes32 word) internal override {
results[id] = word;
}
}
Pass the coordinator below to the constructor and send at least quoteFee(100_000) with roll.
Coordinator
- Robinhood Chain · 4663
0xEc8b95B168c87294c45727Bd2ac903d09316D132· manifest- Robinhood Chain Testnet · 46630
0x2f26513DE4Ed388947f5d22FD395D5E06f472f05· manifest
Fee and delivery
- Fee
max(0.000025 ETH, 2 × base fee × (405,000 + callback gas))- Delivery
- A typical delivery takes 5–8 seconds.
- Refund
- If a request is not fulfilled within 60 seconds, its fee can be refunded to the request's refund address.
Verification
Each request is bound to a future drand round when it is made, so nobody can know or choose the result in advance. The contract verifies the drand signature and the VRF proof on chain, and anyone can replay a result from public data. Full trust model
Questions
- How do I get a random number on Robinhood Chain?
- Extend D20VRFConsumer with the coordinator 0xEc8b95B168c87294c45727Bd2ac903d09316D132, pay the quoted fee in ETH and call requestRandomness. The random word arrives in _fulfillRandomness; a typical delivery takes 5–8 seconds.
- What does it cost?
- max(0.000025 ETH, 2 × base fee × (405,000 + callback gas)), paid in ETH by the requesting transaction. Read quoteFee(callbackGasLimit) from the coordinator; the owner sets pricing for future requests.
- Can the result be verified?
- Yes. Each request is bound to a future drand round when it is made, so nobody can know or choose the result in advance. The contract verifies the drand signature and the VRF proof on chain, and anyone can replay a result from public data. The Explorer replays any request in the browser.
- Is there a testnet?
- Yes. Robinhood Chain Testnet, chain 46630, coordinator 0x2f26513DE4Ed388947f5d22FD395D5E06f472f05, with the same contracts and fee rules.
- What if a request is not fulfilled?
- A typical delivery takes 5–8 seconds. If a request is not fulfilled within 60 seconds, its fee can be refunded to the request's refund address. As with any randomness service, design applications so that a party cannot cancel a request and retry for a better outcome.
- Why not use block.prevrandao?
- On Robinhood Chain, an Arbitrum chain, block.prevrandao returns 1, so it carries no randomness.