Integration Guide
1. Deploy Your Own VRFConsumerV2 Contract
The deployment parameters can be obtained from our official website: 🔗 APRO VRF Portal
Supported Chains
Steps to Deploy
Deploy your own VRFConsumerV2 contract
First, copy the contract code as follows to your local machine File 1 of 4 : LinkTokenInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface LinkTokenInterface {
function allowance(address owner, address spender) external view returns (uint256 remaining);
function approve(address spender, uint256 value) external returns (bool success);
function balanceOf(address owner) external view returns (uint256 balance);
function decimals() external view returns (uint8 decimalPlaces);
function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);
function increaseApproval(address spender, uint256 subtractedValue) external;
function name() external view returns (string memory tokenName);
function symbol() external view returns (string memory tokenSymbol);
function totalSupply() external view returns (uint256 totalTokensIssued);
function transfer(address to, uint256 value) external returns (bool success);
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool success);
function transferFrom(address from, address to, uint256 value) external returns (bool success);
}
File 2 of 4 : VRFCoordinatorV2Interface.sol
File 3 of 4 : VRFConsumerBaseV2.sol
File 4 of 4 : VRFConsumerV2.sol
Open the contract code using Remix, as shown below.

Switch to the compilation tab, select the compilation version, and compile the contract code.

Switch to the deployment tab, select the compilation version, and link your wallet address

In step 7 shown in the image above, enter the VRF Coordinator V2 address and link(Valueless Token) address and then click "transact" Finally,as shown in the image, you can copy your VRFConsumerV2 contract address in step nine, which will be used later.
2. Create a Subscription
Open the VRF Subscription Manager: 🔗 Subscription Manager
Connect your wallet (top-right corner) and click "Create Subscription".
The Admin Address field is auto-filled with your connected wallet address.
Once created, an alert will confirm the subscription, and you'll be redirected to the dashboard.
Locate your Subscription ID in the "My Subscriptions" list.
3. Add a Consumer
On the subscription details page, click "Add Consumer".
Enter the address of your consuming contract and confirm the addition.
Approve the transaction in MetaMask or your wallet extension.
4. Fund Your Subscription
To fund your subscription, provide:
Your wallet address
Your Subscription ID
Then, contact us via: 📧 Email: [email protected] 💬 Telegram: Head of Business Development
5. Request Randomness
Call the requestRandomness function in the VRFConsumerV2 contract
requestRandomness function in the VRFConsumerV2 contractExample Input
Retrieve Randomness
Call the s_randomWords function in the VRFConsumerV2 contract to get the random number.
Enter the index (starting from
0, max =numWords - 1).
6. VRF Information
6.1 JuChain Mainnet
Contracts
Valueless Token
0x95999b404aA3963E950bFE22A68cB973fFCC32DE
BlockHashStore
0xC6D770E144812985fe617CdB17E255a55653Cd7e
VRF Coordinator V2
0xA97de6a5AbaA9C2fA63e2d2A044B649B004C0151
VRF KeyHash Info
KeyHash 1 (Max Gas: 5 GWEI)
0x5aa3d37efe5614ab2d4e35edd79e215bac5b91698c78ce99da0f6419ba860998
KeyHash 2 (Max Gas: 10 GWEI)
0x19670c32fd942860259b58780c8855d24c7ea5d4b81dcc2433e0c54f9cc379fe
KeyHash 3 (Max Gas: 15 GWEI)
0xd8482d5aaa74155c245a2a2dde0f3c83d10797c742ccd025ae59034f5b6b0130
6.2 JuChain Testnet
Contracts
Valueless Token
0x4fdBbd424DB2959327c7764305afC31E86b87B5D
BlockHashStore
0x396861A1a9190CA43E1046a31eff98CF8492a265
VRF Coordinator V2
0xDcc49bF6415bd1dD639a42E87ef737e8d9288d06
VRF KeyHash Info
KeyHash 1 (Max Gas: 5 GWEI)
0x138eb5545472d2c19c8b6fa582ce5e9b6fdc37296e9aa87e6daad34d3df1cf64
KeyHash 2 (Max Gas: 10 GWEI)
0x742b53394213d3d8e598b0df333f5c20a5481829c5d5fbddd50a6694fa14042e
Last updated