Seipex Finance
DiscordDragonSwapAstroportOpenSeaPallet
  • Seipex Finance
  • Seipex Digital Assets
    • Seipex Credits (SPEX)
    • Founder's Pass NFT
  • Seipex VRF
    • Integration
      • VRF Consumer Interface
      • Request Randomness
      • Randomness Callback
      • Simplified Example
      • Proof Validation
      • Extended VRF Consumer Interface
      • Extended Randomness Callback
      • Verify Proof
      • Complete Example
      • Security Considerations
      • Gas Cost Considerations
  • Seipex API
    • Available Endpoints
  • Seipex Mercury
    • Available Endpoints
Powered by GitBook
On this page
  1. Seipex VRF
  2. Integration

Request Randomness

The official Seipex VRF Consumer deployment address is 0x7efDa6beA0e3cE66996FA3D82953FF232650ea67on Sei mainnet.

Once you have the interface declared you can call the contract to request the random number. The only argument this function takes is a seed which you can generate. In this example, the seed is a hash of the previous block timestamp and the address of the caller.

function requestRandomNumber() external {

    // Perform your game functions here possibly and
    // request your random number at the end

    bytes32 seed = keccak256(
        abi.encodePacked(block.timestamp, msg.sender)
    );
    IVRFConsumer vrfConsumer = IVRFConsumer(0x7efDa6beA0e3cE66996FA3D82953FF232650ea67);
    uint256 requestId = vrfConsumer.requestRandomness(seed);
}

You should store the requestId in your contract if you want to match the response callback to the original request.

PreviousVRF Consumer InterfaceNextRandomness Callback

Last updated 9 months ago