# Migrate from Chainlink VRF v2.5

The Randoo coordinator also serves the native-payment side of Chainlink's VRF v2.5 wrapper (direct funding). A consumer built on Chainlink's `VRFV2PlusWrapperConsumerBase` runs on Randoo when you point its wrapper address at `0xC66eB2e7EE91145875000Ad46B55600000000001`. It pays each request in the network's native token: ETH on Base and Robinhood, RON on Ronin. There is no subscription and no LINK.

The wrapper interface is live on Base, Base Sepolia, Robinhood, Robinhood Testnet, Ronin Mainnet and Ronin Saigon, at the same address on each. [Contracts](/docs/contracts) lists their chain IDs. [VRF on Base](/docs/base) compares what a request costs on Randoo and on Chainlink's wrapper. On Robinhood, where Chainlink VRF is not deployed, [VRF on Robinhood](/docs/robinhood) compares the providers that are.

## Chainlink VRF v1 and v2 shut down in November 2026

Chainlink's [supported networks page](https://docs.chain.link/vrf/v2-5/supported-networks) says VRF v1 shuts down on November 18, 2026 and VRF v2 on November 30, 2026, and that after those dates neither fulfills requests. Chainlink's own path is VRF v2.5.

Neither version ran on Ronin, Base or Robinhood. As of 2026-11-17, Chainlink lists [v1](https://docs.chain.link/vrf/v1/supported-networks) on Ethereum, BNB Chain and Polygon, and [v2](https://docs.chain.link/vrf/v2/subscription/supported-networks) on Arbitrum, Avalanche, BNB Chain, Ethereum, Fantom and Polygon. A Chainlink consumer on Ronin or Base is already on v2.5, so the shutdown does not touch it. Randoo is not deployed on any v1 or v2 network, so a v1 or v2 consumer can use Randoo only if the game moves to Ronin, Base or Robinhood.

A v1 `VRFConsumerBase` or v2 `VRFConsumerBaseV2` consumer changes code either way. If you move it to v2.5 direct funding, built on `VRFV2PlusWrapperConsumerBase` as below, the same contract runs against Chainlink's wrapper or against Randoo. Only the wrapper address differs. Randoo has no subscriptions, so a v2.5 subscription consumer built on `VRFConsumerBaseV2Plus` does not run on Randoo.

## Consumer

Take Chainlink's `DirectFundingConsumer` sample and change one line:

```solidity The one line that changes
address public constant wrapperAddress = 0xC66eB2e7EE91145875000Ad46B55600000000001;
```

The sample declares `wrapperAddress` as a plain state variable and passes it to the `VRFV2PlusWrapperConsumerBase` constructor. Under via-IR, that constructor runs before the variable is set, reads the zero address, and the deploy reverts. A constant has its value from the start.

Randoo's tests deploy and fulfill this copy. `linkAddress` and `withdrawLink` do nothing on Randoo.

```solidity DirectFundingConsumer.sol
// SPDX-License-Identifier: MIT
// An example of a consumer contract that directly pays for each request.
pragma solidity ^0.8.20;

import {ConfirmedOwner} from "@chainlink/contracts@1.5.0/src/v0.8/shared/access/ConfirmedOwner.sol";
import {LinkTokenInterface} from "@chainlink/contracts@1.5.0/src/v0.8/shared/interfaces/LinkTokenInterface.sol";
import {VRFV2PlusWrapperConsumerBase} from "@chainlink/contracts@1.5.0/src/v0.8/vrf/dev/VRFV2PlusWrapperConsumerBase.sol";
import {VRFV2PlusClient} from "@chainlink/contracts@1.5.0/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol";

/**
 * Request testnet LINK and ETH here: https://faucets.chain.link/
 * Find information on LINK Token Contracts and get the latest ETH and LINK faucets here:
 * https://docs.chain.link/docs/link-token-contracts/
 */

/**
 * THIS IS AN EXAMPLE CONTRACT THAT USES HARDCODED VALUES FOR CLARITY.
 * THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE.
 * DO NOT USE THIS CODE IN PRODUCTION.
 */
contract DirectFundingConsumer is VRFV2PlusWrapperConsumerBase, ConfirmedOwner {
  event RequestSent(uint256 requestId, uint32 numWords);
  event RequestFulfilled(uint256 requestId, uint256[] randomWords, uint256 payment);

  struct RequestStatus {
    uint256 paid; // amount paid in link
    bool fulfilled; // whether the request has been successfully fulfilled
    uint256[] randomWords;
  }

  mapping(uint256 => RequestStatus) public s_requests; /* requestId --> requestStatus */

  // past requests Id.
  uint256[] public requestIds;
  uint256 public lastRequestId;

  // Depends on the number of requested values that you want sent to the
  // fulfillRandomWords() function. Test and adjust
  // this limit based on the network that you select, the size of the request,
  // and the processing of the callback request in the fulfillRandomWords()
  // function.
  uint32 public callbackGasLimit = 100_000;

  // The default is 3, but you can set this higher.
  uint16 public requestConfirmations = 3;

  // For this example, retrieve 2 random values in one request.
  // Cannot exceed VRFV2Wrapper.getConfig().maxNumWords.
  uint32 public numWords = 2;

  // Address LINK - hardcoded for Sepolia
  address public linkAddress = 0x779877A7B0D9E8603169DdbD7836e478b4624789;

  // address WRAPPER - hardcoded for Sepolia
  address public constant wrapperAddress = 0xC66eB2e7EE91145875000Ad46B55600000000001;

  constructor() ConfirmedOwner(msg.sender) VRFV2PlusWrapperConsumerBase(wrapperAddress) {}

  function requestRandomWords(
    bool enableNativePayment
  ) external onlyOwner returns (uint256) {
    bytes memory extraArgs =
      VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: enableNativePayment}));
    uint256 requestId;
    uint256 reqPrice;
    if (enableNativePayment) {
      (requestId, reqPrice) = requestRandomnessPayInNative(callbackGasLimit, requestConfirmations, numWords, extraArgs);
    } else {
      (requestId, reqPrice) = requestRandomness(callbackGasLimit, requestConfirmations, numWords, extraArgs);
    }
    s_requests[requestId] = RequestStatus({paid: reqPrice, randomWords: new uint256[](0), fulfilled: false});
    requestIds.push(requestId);
    lastRequestId = requestId;
    emit RequestSent(requestId, numWords);
    return requestId;
  }

  function fulfillRandomWords(
    uint256 _requestId,
    uint256[] memory _randomWords
  ) internal override {
    require(s_requests[_requestId].paid > 0, "request not found");
    s_requests[_requestId].fulfilled = true;
    s_requests[_requestId].randomWords = _randomWords;
    emit RequestFulfilled(_requestId, _randomWords, s_requests[_requestId].paid);
  }

  function getRequestStatus(
    uint256 _requestId
  ) external view returns (uint256 paid, bool fulfilled, uint256[] memory randomWords) {
    require(s_requests[_requestId].paid > 0, "request not found");
    RequestStatus memory request = s_requests[_requestId];
    return (request.paid, request.fulfilled, request.randomWords);
  }

  /**
   * Allow withdraw of Link tokens from the contract
   */
  function withdrawLink() public onlyOwner {
    LinkTokenInterface link = LinkTokenInterface(linkAddress);
    require(link.transfer(msg.sender, link.balanceOf(address(this))), "Unable to transfer");
  }

  /// @notice withdrawNative withdraws the amount specified in amount to the owner
  /// @param amount the amount to withdraw, in wei
  function withdrawNative(
    uint256 amount
  ) external onlyOwner {
    (bool success,) = payable(owner()).call{value: amount}("");
    // solhint-disable-next-line gas-custom-errors
    require(success, "withdrawNative failed");
  }

  event Received(address, uint256);

  receive() external payable {
    emit Received(msg.sender, msg.value);
  }
}
```

## Request

1. Deploy the consumer and send it the network's native token. It pays each request from its own balance.
2. Call `requestRandomWords(true)`. `true` selects native payment. The consumer base quotes `calculateRequestPriceNative` and sends that amount with `requestRandomWordsInNative` in the same transaction.
3. After `requestConfirmations` blocks (3 in the sample), the oracle fulfills and `fulfillRandomWords` runs with the words.

`requestRandomWords(false)` asks to pay in LINK, which Randoo does not take. The LINK quote reverts with `LinkNotSupported` before any value moves, and `link()` returns the zero address. A direct `requestRandomWordsInNative` call whose extra args do not select native payment reverts with `LINKPaymentInRequestRandomWordsInNative`.

## `requestRandomWordsInNative` reference

`requestRandomWordsInNative` is the VRF v2.5 wrapper's request for direct funding paid in the native token. The calling contract is the consumer. It sends the price as `msg.value`, gets a request ID back, and later receives the words in `rawFulfillRandomWords(requestId, randomWords)`.

```solidity Signature, as IVRFV2PlusWrapper in @chainlink/contracts 1.5.0
function requestRandomWordsInNative(
    uint32 callbackGasLimit,
    uint16 requestConfirmations,
    uint32 numWords,
    bytes calldata extraArgs
) external payable returns (uint256 requestId);
```

| Input | Meaning | On Randoo |
| --- | --- | --- |
| `callbackGasLimit` | Gas for your `fulfillRandomWords` | 50,000 to 2,500,000, else `GasLimit`. The callback gets exactly this much, so keep the limit you used on Chainlink ([how to set it](/docs/callback-gas)). |
| `requestConfirmations` | Blocks to wait before fulfilling; on Robinhood, Robinhood blocks, not `block.number` ([why](/docs/block-number)) | 1 to 200, else `InvalidConfirmations`. Chainlink's Base wrapper also takes 0, so change a 0 to 1 ([how many to use](/docs/request-confirmations)). |
| `numWords` | Random words to return | 1 to 10, else `TooManyWords`. Does not change the price. |
| `extraArgs` | `VRFV2PlusClient._argsToBytes(ExtraArgsV1({nativePayment: true}))`: a 4-byte tag and one ABI-encoded bool, 36 bytes | Empty, or `nativePayment` false, reverts with `LINKPaymentInRequestRandomWordsInNative`. Shorter than 36 bytes reverts with `IncorrectExtraArgsLength(36, length)`. These are the checks of Chainlink's `checkPaymentMode`. |
| `msg.value` | The prepayment | At least `calculateRequestPriceNative(callbackGasLimit, numWords)` in the same transaction, else `InsufficientFee`. The unused part goes back to the consumer after the callback, or to the treasury if the consumer cannot receive it. |
| returns `requestId` | The ID `rawFulfillRandomWords` will carry | From Randoo's request counter, shared with the other interfaces on that network |

`VRFV2PlusWrapperConsumerBase.requestRandomnessPayInNative` makes this call for you. Without the base contract, it is three lines, and the consumer must also expose `rawFulfillRandomWords` and accept calls only from `0xC66eB2e7EE91145875000Ad46B55600000000001`:

```solidity Calling the wrapper directly
bytes memory extraArgs = VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: true}));
uint256 price = IVRFV2PlusWrapper(wrapper).calculateRequestPriceNative(callbackGasLimit, numWords);
uint256 requestId = IVRFV2PlusWrapper(wrapper).requestRandomWordsInNative{value: price}(callbackGasLimit, requestConfirmations, numWords, extraArgs);
```

To see the price before you send anything, quote at the current gas price. A plain `cast call` of `calculateRequestPriceNative` runs at a zero gas price and leaves out the gas part, so use `estimateRequestPriceNative`:

```bash Quote a 100,000-gas request on Base
GAS=$(cast gas-price --rpc-url https://base-rpc.publicnode.com)
cast call 0xC66eB2e7EE91145875000Ad46B55600000000001 "estimateRequestPriceNative(uint32,uint32,uint256)(uint256)" 100000 1 $GAS --rpc-url https://base-rpc.publicnode.com
```

## Limits

- Each request returns up to 10 random words. Zero words, or more than 10, reverts with `TooManyWords`.
- A request waits 1 to 200 confirmations. Outside that range it reverts with `InvalidConfirmations`.
- `callbackGasLimit` is 50,000 to 2,500,000. Outside that range it reverts with `GasLimit`.

The words come from one VRF seed. Word `i` is `keccak256(abi.encode(seed, i))`, the same expansion as Chainlink's `VRFCoordinatorV2_5`.

## Price

`calculateRequestPriceNative(callbackGasLimit, numWords)` prices at `tx.gasprice`, so it is exact inside the requesting transaction. A plain `eth_call` runs with a zero `tx.gasprice`, so off chain you quote with `estimateRequestPriceNative(callbackGasLimit, numWords, gasPriceWei)`. Both return the same amount as the Ronin interface's `estimateRequestRandomFee(callbackGasLimit, gasPrice)`, and `numWords` does not change it.

Sending less than the quote reverts with `InsufficientFee`. A gas price under the network's floor reverts with `InvalidGasPrice`. [Fees and failures](/docs/gas) has the formula and the floor.

## Differences from Chainlink's wrapper

- Randoo takes native payment only. LINK quotes revert, and there are no subscriptions.
- Randoo returns unused prepayment to the consumer if it accepts the native token, as the sample's `receive()` does. A consumer that cannot receive it forfeits it to the network's treasury. Chainlink's wrapper keeps it.
- Randomness comes from Randoo's oracle keys. Chainlink's own `VRF.sol` verifies each proof on chain.
- Request IDs come from Randoo's own counter, which the other interfaces' requests on the same network share. `lastRequestId()` returns the latest.
- If `fulfillRandomWords` reverts or runs out of gas, the request still counts as fulfilled and nobody retries it. `requests(requestId)` returns the stored seed, and you can expand it into words as above. On Chainlink's own coordinator the words survive only in the fulfillment event ([when a VRF callback reverts](/docs/failed-callback)).

_Updated 2026-11-27._
