Chainlink VRF API Reference [v1]
API reference for
|constructor||Initialize your consuming contract.|
|requestRandomness||Make a request to the VRFCoordinator.|
|fulfillRandomness||Called by VRFCoordinator when it receives a valid VRF proof.|
Initialize your consuming contract.
constructor(address _vrfCoordinator, address _link)
_vrfCoordinator: Address of the Chainlink VRF Coordinator. See Chainlink VRF Addresses for details.
_link: Address of the LINK token. See LINK Token Addresses for details.
_seedhas recently been deprecated.
Make a request to the VRF coordinator.
function requestRandomness(bytes32 _keyHash, uint256 _fee) public returns (bytes32 requestId)
_keyHash: The public key against which randomness is generated. See Chainlink VRF supported networks for details.
_fee: The fee, in LINK, for the request. Specified by the oracle.
RETURN: The ID unique to a single request.
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) internal virtual;
requestId: The ID initially returned by
randomness: The random number generated by Chainlink VRF.
Chainlink VRF provides powerful security guarantees and is easy to integrate. However, smart contract security is a nuanced topic. You can read about the top security considerations for VRF.