Docs

Everything you need to add verifiable randomness to a contract on Arc: how to request it, what it costs, how to use this dashboard, and how the system works underneath.

Overview

On Arc, PREVRANDAO always returns 0, so a contract has no safe source of randomness of its own. Arc VRF provides it: your contract asks for random numbers, an off-chain node computes them with a secret key and a proof, and the coordinator contract checks the proof on-chain before passing the numbers to your contract. Nobody, including the operator, can choose the result.

Arc VRF is Chainlink VRF v2.5 adapted to Arc: the same contracts, proof and request shapes, billed in native USDC, with no LINK anywhere. If you’ve used VRF v2.5, you already know how to use it.

There are two ways to pay. Both use the same coordinator, proof and callback.

SubscriptionDirect funding
Who paysA shared USDC balance you fund in advanceYour contract, with each request
PriceGas actually used, plus premium, charged after deliveryQuoted up front at the request’s gas price
SetupCreate, fund, add consumer contractsNone
InheritArcVRFConsumerBaseArcVRFWrapperConsumerBase
Limits100 consumers, 500 words per request10 words per request
Best forRegular requests, several contractsOccasional requests, end users paying

Quick start: subscription

  1. Connect a wallet on Subscriptions, create a subscription and fund it with USDC.
  2. Deploy a contract that inherits ArcVRFConsumerBase, passing the coordinator address, the key hash and your subscription ID (all listed under Addresses).
  3. Add the contract as a consumer of the subscription.
  4. Call it. The node answers with a proof, the coordinator verifies it and calls fulfillRandomWords, usually within a couple of blocks.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import {ArcVRFConsumerBase} from "arc-vrf/ArcVRFConsumerBase.sol";
import {ArcVRFClient} from "arc-vrf/libraries/ArcVRFClient.sol";

contract Raffle is ArcVRFConsumerBase {
  bytes32 immutable keyHash;
  uint256 immutable subId;
  mapping(uint256 => address) public requester;

  constructor(address coordinator, bytes32 _keyHash, uint256 _subId)
    ArcVRFConsumerBase(coordinator)
  {
    keyHash = _keyHash;
    subId = _subId;
  }

  function draw() external returns (uint256 requestId) {
    requestId = s_vrfCoordinator.requestRandomWords(
      ArcVRFClient.RandomWordsRequest({
        keyHash: keyHash,
        subId: subId,
        requestConfirmations: 0,      // Arc finalises on inclusion
        callbackGasLimit: 150_000,
        numWords: 1,
        extraArgs: ArcVRFClient.nativeExtraArgs()  // or ""
      })
    );
    requester[requestId] = msg.sender;
  }

  // Must not revert: a failed callback is not retried and is still charged.
  function fulfillRandomWords(uint256 requestId, uint256[] calldata words) internal override {
    uint256 winningTicket = words[0] % 1000;
    // ...
  }
}

The contracts live in contracts/src of the repository. With Foundry, add the repo as a dependency and remap arc-vrf/=lib/arc-vrf/contracts/src/, or copy the files in.

Quick start: direct funding

  1. Deploy a contract that inherits ArcVRFWrapperConsumerBase, passing the wrapper address.
  2. Make sure it holds, or is sent, enough USDC. Check the price on Direct funding.
  3. Call requestRandomnessPayInNative. It quotes and pays in one call; the excess stays in your contract.
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import {ArcVRFWrapperConsumerBase} from "arc-vrf/ArcVRFWrapperConsumerBase.sol";
import {ArcVRFClient} from "arc-vrf/libraries/ArcVRFClient.sol";

contract CoinFlip is ArcVRFWrapperConsumerBase {
  constructor(address wrapper) ArcVRFWrapperConsumerBase(wrapper) {}

  // The contract pays from its own USDC balance (plus whatever the caller sends).
  function flip() external payable returns (uint256 requestId) {
    (requestId, ) = requestRandomnessPayInNative(
      100_000,                         // callbackGasLimit
      0,                               // requestConfirmations
      1,                               // numWords (max 10)
      ArcVRFClient.nativeExtraArgs()
    );
  }

  function fulfillRandomWords(uint256 requestId, uint256[] memory words) internal override {
    bool heads = words[0] % 2 == 0;
    // ...
  }

  receive() external payable {}
}

If your callback reverts, the wrapper emits WrapperFulfillmentFailed instead of reverting. There is no refund.

How a request works

  1. Request. Your contract calls requestRandomWords (or the wrapper does it for you). The coordinator checks your contract is allowed to use the subscription, stores a commitment to the request and emits RandomWordsRequested. You get a requestId back immediately.
  2. Seed. The node sees the event. The seed combines a value fixed by your request with the hash of the block your request landed in, which nobody knew in advance.
  3. Prove. The node computes the random value from the seed with its secret key, plus a proof that it used the key registered on-chain.
  4. Verify. The node submits the proof. The coordinator checks it against the stored commitment and the registered key. A wrong or altered value fails here.
  5. Deliver. The coordinator expands the value into numWords numbers and calls your fulfillRandomWords with exactly callbackGasLimit gas. The commitment is deleted, so a request can only be answered once.
  6. Charge. The subscription pays for the gas used plus the premium, whether or not your callback succeeded.

If the node is offline, requests simply wait on-chain and are answered when it returns. If an answer fails (for example the subscription is empty), the node keeps retrying, so funding the subscription is enough to unblock it.

How the randomness is made

Two ingredients nobody controls alone go into each result: the node’s secret key, committed in advance by its registered public key, and the hash of the block your request landed in. The node computes γ = sk · hashToCurve(pk, seed) and a proof (Goldberg et al., secp256k1 + Keccak). The coordinator verifies the proof with VRF.sol and derives the randomness itself as keccak256(3, γ). A different number would need a different γ, which fails verification. Every request page in this dashboard shows these steps with the real values.

Block hashes older than 256 blocks (about 2 minutes on Arc) come from Arc’s EIP-2935 history contract (about 8191 blocks), then from the BlockhashStore, so slow answers still verify.

What you pay

All amounts are native USDC (18 decimals). Arc’s base fee is priced in USDC and smoothed, so costs stay stable in dollars.

Subscription, charged after each fulfilment

payment = gasPrice × (gasAfterPaymentCalculation + gasUsed) × (100 + premium%) / 100
        + flatFeePPM × 10¹²

Direct funding, quoted at request time

price = gasPrice × wrapperGasOverhead
      + gasPrice × (callbackGasLimit + coordinatorOverhead + numWords × perWordOverhead) × (100 + premium%) / 100
      + flatFeePPM × 10¹²

Arc’s mempool drops transactions with maxFeePerGas below 20 gwei, so quotes use at least 20 gwei. The current premium and flat fee are shown under Network on the Overview page.

Subscriptions

Subscriptions lists the subscriptions your connected wallet created and lets you create a new one. Open a subscription to manage it:

  • Balance: current USDC balance, owner, number of fulfilled requests, and whether requests are pending. Anyone can add funds.
  • Consumers: the contracts allowed to request against this balance (up to 100). The owner adds and removes them. Removal is blocked while requests are pending.
  • How far the balance goes: enter your callback gas limit to see the worst-case cost per request and the minimum number of requests the balance covers. Real charges are usually much lower.
  • Ownership: offer the subscription to another address (they must accept), or cancel it and refund the balance. Cancelling is permanent and waits until no requests are pending.
  • Requests: the latest 50 requests with the consumer, words, amount charged and status. Click a request to trace it.
StatusMeaning
Waiting for proofRequested, not answered yet. Usually takes a few seconds.
DeliveredProof verified and your callback ran successfully.
Callback revertedProof verified, but your fulfillRandomWords reverted. The request is charged and not retried.

Direct funding

Direct funding shows whether the wrapper is accepting requests and its configuration. The fee calculator prices a request for a given callback gas limit and number of words at the current gas price, so you know how much USDC your contract must hold or send. Below it is a list of recent direct-funding requests.

Tracing a request

Every request has a page at /requests/<requestId>, linked from subscription histories and the playground. It shows who asked and with what parameters, the answer and what it cost, and a step-by-step derivation of the number: seed, block hash, γ and the final randomness, each with the real on-chain value and a check that they match. Share the link with anyone who wants to verify a result.

Playground

Playground runs two sample contracts so you can see a full round-trip before writing any code. Hi-Lo uses a subscription: guess whether the next ball (1 to 20) is higher or lower; the game’s subscription pays and you pay only gas. Dice uses direct funding: each roll pays the wrapper about the quoted price and refunds your change. Both sources are in contracts/src/examples.

Request parameters

FieldTypeMeaning on Arc
keyHashbytes32Picks the node’s key and the gas lane (max gas price for fulfilment). An unknown key hash is accepted but never fulfilled.
subIduint256Subscription that pays. Your contract must be one of its consumers.
requestConfirmationsuint16Blocks the node waits. Arc has instant finality and no reorgs, so 0 is safe. Max 200.
callbackGasLimituint32Gas for your callback, up to the coordinator’s max (2,500,000). For direct funding, the wrapper adds its own overhead on top.
numWordsuint32How many numbers. Max 500 for subscriptions, 10 through the wrapper.
extraArgsbytesEmpty, or ExtraArgsV1({nativePayment: true}). nativePayment: false reverts with LinkPaymentNotSupported.

Porting from Chainlink VRF v2.5

ChainlinkArc VRF
VRFConsumerBaseV2PlusArcVRFConsumerBase
VRFV2PlusWrapperConsumerBaseArcVRFWrapperConsumerBase (native path only)
VRFV2PlusClientArcVRFClient, same structs and same 0x92fd1338 extraArgs tag
fundSubscription with LINKfundSubscriptionWithNative with USDC
Empty extraArgs means LINKEmpty extraArgs means USDC
requestRandomness (LINK)Removed; use requestRandomnessPayInNative
3+ confirmations typical0 confirmations

Security guidance

  • Your fulfillRandomWords must not revert. Do heavy work in a later transaction.
  • Never re-request because an answer is slow. Re-requesting lets an operator pick between outcomes.
  • Lock user inputs (bets, entries) before you request, not after.
  • Use requestId to match responses to requests; answers can arrive in any order.
  • Only the coordinator (or wrapper) can call your callback; the base contracts enforce this.
  • Trust model at launch: one operator and one key. The operator can delay an answer but can’t choose it. The coordinator owner can change fees and keys. The contracts are not yet audited.

Troubleshooting

My request is stuck on “Waiting for proof”

  • Subscription balance too low. The charge is taken at delivery, so an empty subscription accepts requests but can’t pay for answers. Fund it; the node retries automatically.
  • Wrong key hash. A request with a key hash the node doesn’t serve is accepted but never answered. Use the key hash under Addresses.
  • Gas price above the lane. If Arc’s gas price is above the key’s maximum, the answer waits until it drops.
  • Node offline. Requests wait on-chain and are answered when it returns. The Overview shows recent fulfilments.

The request reverted

  • InvalidConsumer: the calling contract isn’t a consumer of that subscription. Add it on the subscription page.
  • InvalidSubscription: wrong subscription ID, or it was cancelled.
  • LinkPaymentNotSupported: extraArgs sets nativePayment: false. Use ArcVRFClient.nativeExtraArgs() or empty bytes.
  • GasLimitTooBig, NumWordsTooBig or NumWordsTooHigh (wrapper): see the limits under Request parameters.
  • FeeTooLow (direct funding): the contract sent less than the quoted price. Quote with calculateRequestPriceNative in the same transaction, as requestRandomnessPayInNative does.

Shows “Callback reverted”

Your fulfillRandomWords ran out of gas or reverted. The request was charged and won’t be retried. Raise callbackGasLimit or move work out of the callback, then make a new request.

I can’t remove a consumer or cancel a subscription

Both are blocked while the subscription has pending requests. Wait for them to be answered.

My cancellation refund didn’t arrive

If the refund couldn’t be sent to your address, it’s held for you. Open the subscription’s page with that wallet connected and use Withdraw to my address.

The dashboard says Arc VRF isn’t deployed

Your wallet is on a network without a deployment. Switch to Arc Testnet.

Addresses

Anvil (local)

Coordinator0xe7f1725e7734ce288f8367e1bb143e90bb3f0512
Wrapper0xa513e6e4b8f2a923d98304ec87f64353c4d5c853
Key hash0xea861df8969ac2eb069eafe2740a3a6e40c52d2b7e32eccffe643c4d9daabb5b
BlockhashStore0x5fbdb2315678afecb367f032d93f642f64180aa3
Batch helper0xdc64a140aa3e981100a9beca4e685f962f0cf6c9
HiLoGame sample0xa51c1fc2f0d1a1b8494ed1fe312d7c3a78ed91c0
DiceDirect sample0x9a676e781a523b5d0c0e43731313a708cb607508

Arc Testnet

Coordinator0xc97f22a52ecb0f8400a2e44a710f141a572471ae
Wrapper0x5c0fa592b86102e0f82ececcd61f0e04d6cb9ab7
Key hash0xcf39e27191d1d13c8fec1a175eda831392ef974fe21a5a0a0680c3a22c6deb88
BlockhashStore0xe1bbc1c64add044ce831869c89afef02ab2d48d5
Batch helper0xbf6c5ea4af36b372ebef9ebb5c864b5babb374dc
HiLoGame sample0x48d1edbec40ecc53c9d5a32d58dff757b244a4ed
DiceDirect sample0x7c2a846107e101973339b903ff9ffe42841742b4

Running your own node? See the deployment guide and the architecture overview.