Chainlink Developers

Welcome to the Chainlink documentation site. You'll find comprehensive guides and documentation to help you start working with Chainlink as quickly as possible, as well as support if you get stuck. Click here for an introductory walkthrough on how to create a Chainlink request on the Ropsten test network!

Building on Chainlink? Click here to get started!

Get Started

API Reference

API reference for VRFConsumerBase.



constructorInitialize your consumer contract.


requestRandomnessMake a request to the VRFCoordinator.
fulfillRandomnessCalled by VRFCoordinator when it receives a valid VRF proof.


Initialize your consumer contract.

constructor(address _vrfCoordinator, address _link) public



Make a request to the VRF coordinator.

function requestRandomness(bytes32 _keyHash, uint256 _fee, uint256 _seed)
    public returns (bytes32 requestId)
  • _keyHash: The public key against which randomness is generated. See Chainlink VRF Addresses for details.
  • _fee: The fee, in LINK, for the request. Specified by the oracle.
  • _seed: This is the seed from which output randomness is determined. Provided by you.
  • RETURN: The ID unique to a single request.

️ Choosing a seed

It is vital that you choose a seed that is difficult to anticipate. See Choosing a Seed for more details.


Called by VRFCoordinator when it receives a valid VRF proof. Override this function to act upon the random number generated by Chainlink VRF.

function fulfillRandomness(bytes32 requestId, uint256 randomness)
    external virtual;
  • requestId: The Id initially returned by requestRandomness.
  • randomness: Random number generated by Chainlink VRF.


Choosing A Seed

The source of your seeds should be hard for anyone to influence or predict. Any party who can influence them could in principle collude with the oracle (who can instantly compute the VRF output for any given seed) to bias the outcomes from your contract in their favor.

For example, the block hash is a natural choice of seed for many applications, but miners in control of a substantial fraction of hashing power and with access to VRF outputs could check the result of prospective block hashes as they are mined, and decide not to publish a block if they don't like the outcome it will lead to.

On the other hand, using block hashes as the seed makes it particularly easy to estimate the economic cost to a miner for this kind of cheating (namely, the block reward and transaction fees they forgo by refraining from publishing a block.)

Maximizing security

Chainlink VRF provides powerful security guarantees and is easy to integrate. However, smart contract security is a nuanced topic. If you have specific questions about your integration, please contact [email protected]

Updated 21 days ago

API Reference

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.