Guide
Why block.prevrandao returns 1 on Robinhood Chain, and how to get verifiable randomness
On Robinhood Chain, block.prevrandao is always 1, so a contract that needs a random number asks Blockhash VRF for verifiable randomness instead.
Why does block.prevrandao return 1 on Robinhood Chain?
On Ethereum, block.prevrandao is the beacon chain’s random mix from the block before.
Robinhood Chain is an Arbitrum chain, and Arbitrum’s docs say block.prevrandao and block.difficulty return the constant 1 on its chains.
Robinhood’s docs say both return a constant on Robinhood Chain and are not a source of randomness.
The call below runs the PREVRANDAO opcode on the chain and returns its value: 1.
So a contract that takes block.prevrandao modulo a number gets the same answer in every block.
It was read through Blockhash’s RPC on November 26, 2026.
RPC=https://robinhood-mainnet.rpc.blockhash.xyz/v1
BLOCKHASH_KEY="<your key>"
# 0x44 is PREVRANDAO: the code stores it at 0 and returns that word
curl $RPC/$BLOCKHASH_KEY \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"data":"0x4460005260206000f3"},"latest"]}'
{"jsonrpc":"2.0","id":1,"result":"0x0000000000000000000000000000000000000000000000000000000000000001"}RPC=https://robinhood-mainnet.rpc.blockhash.xyz/v1
BLOCKHASH_KEY="<your key>"
cast call --rpc-url $RPC/$BLOCKHASH_KEY --create 0x4460005260206000f3
0x0000000000000000000000000000000000000000000000000000000000000001Why is a block hash no fair seed?
On Robinhood Chain, blockhash takes Ethereum’s block numbers, as block.number does.
A contract seeded by a block hash reads a hash that anyone could read before the transaction was sent.
Arbitrum’s docs call the hash blockhash returns on its chains cryptographically insecure.
One sequencer makes every block of Robinhood Chain, so one party decides what each block holds.
Robinhood Chain has 100 ms block times, and each block’s hash is public as soon as the block is.
A seed that nobody can know before it is used, and that whoever makes the block cannot choose, needs a proof.
curl $RPC/$BLOCKHASH_KEY \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["latest",false]}'
{"jsonrpc":"2.0","id":1,"result":{
"number":"0x75c15fd",
"difficulty":"0x1",
"miner":"0xa4b000000000000000000073657175656e636572",
…}}A block’s head carries difficulty 0x1 too, and its miner is the sequencer’s address.
How does Blockhash VRF work?
A contract asks the coordinator for random words, and gets them back in a later block.
Blockhash’s oracle answers with the words and a proof, and the coordinator checks the proof on chain before it calls your contract.
The seed mixes in the hash of the request’s own block, so nobody can know the number before that block is made, the oracle included.
The oracle cannot choose a number: one key gives one number for a request, and the coordinator refuses any other proof.
It is Chainlink’s VRF v2.5, forked: a consumer written for Chainlink’s works with the coordinator’s address and the key hash changed.
Requests are paid in ether, from a subscription on chain or with the request itself.
The coordinator needs no Blockhash account: open a subscription on chain and fund it.
It runs on Robinhood Chain. Testnet requests are paused for now.
A request names the key hash of the key that proves it.
Read it from the coordinator, s_provingKeyHashes(0), as the sample does.
- Coordinator
- Key hash
- Chain ID
- 4663
- Paid in
- Ether
- Account
- None needed
RPC=https://robinhood-mainnet.rpc.blockhash.xyz/v1
BLOCKHASH_KEY="<your key>"
cast call 0x000094b5303272ea593137ca65b4B15200bFb10C 's_provingKeyHashes(uint256)(bytes32)' 0 \
--rpc-url $RPC/$BLOCKHASH_KEY
0x6df4…4a85A consumer contract
A consumer extends Chainlink’s own base contract, VRFConsumerBaseV2Plus, from Chainlink’s package @chainlink/contracts 1.5.0.
Only the coordinator’s address and the key hash are Blockhash’s.
This raffle fixes each round’s entrants when it asks for the draw, so nothing can move what the number picks from.
Its callback, fulfillRandomWords, never reverts.
A test in Blockhash’s repository draws this contract with a proof the oracle made.
In a Foundry project, install Chainlink’s package with npm and map its imports in remappings.txt, as the setup tab does.
The setup ran on November 26, 2026 with Foundry 1.8.4, and forge build compiled the raffle.
Deploy it with Foundry as the RPC URL and Foundry guide does, with the coordinator’s address, the key hash and your subscription’s id.
npm install @chainlink/contracts@1.5.0
echo '@chainlink/contracts/=node_modules/@chainlink/contracts/' > remappings.txt
# src/Raffle.sol is the contract in the next tab
forge build// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {VRFTypes} from "@chainlink/contracts/src/v0.8/vrf/VRFTypes.sol";
import {VRFConsumerBaseV2Plus} from "@chainlink/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol";
import {VRFV2PlusClient} from "@chainlink/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol";
// Blockhash VRF's own addition: a request that waited unanswered past the coordinator's expiry is expired.
interface IExpiringCoordinator {
function expireRequest(uint256 requestId, VRFTypes.RequestCommitmentV2Plus calldata rc) external;
}
// A raffle drawn with a number from Blockhash VRF. It is written against Chainlink's own VRF v2.5 package
// (@chainlink/contracts 1.5.0): only the coordinator's address and the key hash are Blockhash's.
// Each round's entrants are fixed when its draw is asked for, so nothing can move what the number picks from.
// A draw that expires unanswered voids its round, which is never drawn again: asking again would let whoever can
// see a number before it is delivered choose between numbers.
contract Raffle is VRFConsumerBaseV2Plus {
bytes32 public immutable keyHash;
uint256 public immutable subscriptionId;
uint256 public round; // the round open for entries
mapping(uint256 => address[]) internal s_entrants; // a round's entrants
mapping(uint256 => uint256) public drawOf; // a round's draw request
mapping(uint256 => uint256) public roundOf; // a draw request's round
mapping(uint256 => address) public winner;
mapping(uint256 => bool) public voided;
event Drawn(uint256 indexed round, address winner);
event Voided(uint256 indexed round);
constructor(address coordinator, bytes32 keyHash_, uint256 subscriptionId_) VRFConsumerBaseV2Plus(coordinator) {
keyHash = keyHash_;
subscriptionId = subscriptionId_;
}
function enter() external {
s_entrants[round].push(msg.sender);
}
// Closes the open round and asks for its draw; entries from here on go to the next round.
function draw() external returns (uint256 requestId) {
require(s_entrants[round].length > 0, "no entrants");
requestId = s_vrfCoordinator.requestRandomWords(
VRFV2PlusClient.RandomWordsRequest({
keyHash: keyHash,
subId: subscriptionId,
requestConfirmations: 1,
callbackGasLimit: 100_000,
numWords: 1,
extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: true}))
})
);
drawOf[round] = requestId;
roundOf[requestId] = round;
round++;
}
// Never revert here: a callback that reverts leaves its number kept on the coordinator, to be delivered again.
function fulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) internal override {
uint256 r = roundOf[requestId];
if (voided[r] || winner[r] != address(0)) return;
address[] storage entrants = s_entrants[r];
winner[r] = entrants[randomWords[0] % entrants.length];
emit Drawn(r, winner[r]);
}
// A draw unanswered past the coordinator's expiry voids its round, for good. Anyone may ask once it is due; the
// commitment is the draw request's own, from its RandomWordsRequested event.
function voidRound(uint256 r, VRFTypes.RequestCommitmentV2Plus calldata rc) external {
require(r < round && winner[r] == address(0) && !voided[r], "not a round waiting for its draw");
voided[r] = true;
IExpiringCoordinator(address(s_vrfCoordinator)).expireRequest(drawOf[r], rc);
emit Voided(r);
}
function entrants(
uint256 r
) external view returns (address[] memory) {
return s_entrants[r];
}
}
Create and fund a subscription with viem
createSubscription() makes a subscription, and its id comes back in the SubscriptionCreated event.
addConsumer(subId, consumer) lets your contract ask on it.
fundSubscriptionWithNative(subId) puts ether on it, which pays for each fulfillment.
viem names the chain robinhood, so the wallet signs for chain ID 4663 alone.
A request on a subscription that cannot pay waits until it is funded.
The four calls were simulated on Robinhood Chain with eth_simulateV1 on November 26, 2026, from an address given ether for the run: each succeeded, and nothing was sent.
import { createPublicClient, createWalletClient, getAddress, http, isHex, parseAbi, parseEther, parseEventLogs } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { robinhood } from 'viem/chains'
const RPC = `https://robinhood-mainnet.rpc.blockhash.xyz/v1/${process.env.BLOCKHASH_KEY}`
const COORDINATOR = '0x000094b5303272ea593137ca65b4B15200bFb10C'
const abi = parseAbi([
'function createSubscription() returns (uint256)',
'function addConsumer(uint256 subId, address consumer)',
'function fundSubscriptionWithNative(uint256 subId) payable',
'function getSubscription(uint256 subId) view returns (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] consumers)',
'event SubscriptionCreated(uint256 indexed subId, address owner)',
])
// the key that owns the subscription, and the consumer you deployed, from the environment
const key = process.env.PRIVATE_KEY
if (!isHex(key)) throw new Error('PRIVATE_KEY is a 0x key')
const consumer = getAddress(process.env.CONSUMER ?? '')
const chain = createPublicClient({ chain: robinhood, transport: http(RPC) })
const wallet = createWalletClient({ account: privateKeyToAccount(key), chain: robinhood, transport: http(RPC) })
// a subscription, its id read from the event that made it
const made = await wallet.writeContract({ address: COORDINATOR, abi, functionName: 'createSubscription' })
const { logs } = await chain.waitForTransactionReceipt({ hash: made })
const [created] = parseEventLogs({ abi, logs, eventName: 'SubscriptionCreated' })
const subId = created.args.subId
// your consumer may ask on it, and it holds ether to pay for what it asks
const added = await wallet.writeContract({ address: COORDINATOR, abi, functionName: 'addConsumer', args: [subId, consumer] })
await chain.waitForTransactionReceipt({ hash: added })
const funded = await wallet.writeContract({ address: COORDINATOR, abi, functionName: 'fundSubscriptionWithNative', args: [subId], value: parseEther('0.002') })
await chain.waitForTransactionReceipt({ hash: funded })
const [, nativeBalance, , owner, consumers] = await chain.readContract({ address: COORDINATOR, abi, functionName: 'getSubscription', args: [subId] })
console.log(subId, nativeBalance, consumers)
// <the subscription's id>n 2000000000000000n [ '<your consumer>' ]What happens to a request older than 256 blocks, and how much callback gas can it use?
The coordinator checks a proof against its request’s block hash, which ArbSys’s arbBlockHash gives for the chain’s last 256 blocks.
At 100 ms block times, 256 blocks are about 26 seconds.
A request older than that is answered once its block’s hash is kept in the blockhash store, 0x00002393E695B5dC5b6aa34F75fB713005C0B10C, which the oracle does for a request that waits.
A request names its callback gas, up to 2,500,000 gas, and the coordinator refuses one that asks for more.
A request may ask for up to 500 words and up to 200 confirmations.
A callback that reverts or runs out of gas does not lose its number: getKeptRandomWords(requestId) gives it, and your consumer calls deliverKeptRandomWords(requestId, gas) to run its callback again.
A request unanswered for 812,000 blocks, at least 22 hours, may be expired, and its round must never be drawn again.
What does a random number cost?
A fulfillment is charged its gas, the chain’s L1 fee for its data, and 60% on top of both, in ether.
There is no flat fee.
The gas is measured by the coordinator itself, and includes your callback’s.
Robinhood Chain’s gas price is 0.02 gwei.
The VRF page works one fulfillment’s fee through, and gives every bound in full.
| Page | What it documents |
|---|---|
| VRF | Random numbers with a proof, for a contract on Robinhood Chain: Chainlink’s VRF v2. |
| Deploy a contract | Simulate a contract’s deployment, then send it, with Foundry or viem, and what differs from Ethereum. |
| RPC | JSON-RPC 2. |