LogoLogo
Cryptum.ioGitHub
  • 🌐Cryptum
    • What is Cryptum
    • DeFi Market
    • Ecosystem
      • Bitcoin
      • Ethereum
      • Polygon
      • Avalanche C-Chain
      • BNB Chain
      • Cardano
      • Celo
      • Hathor
      • Solana
      • Stellar
      • XRP Ledger
      • Stratus
      • Hyperledger Besu
  • 👝Products
    • Dashboard Analytics
    • Tokenization
    • Crypto Checkout
      • Overview
      • Getting started
      • Checkout Dashboard
        • Creating your Store
        • Customer Checkout screens
        • Analytics
        • Managing Wallets
        • Creating Collections and NFTs
        • Linking Products to NFTs
        • Monitoring Orders
      • Checkout API
        • Authentication
        • Store
        • Orders
          • Handling Orders
    • Wallets
    • DeFi-as-a-Service
    • On & Off Ramp (soon)
    • E-commerce Plugins
      • Wordpress NFT Plugin
        • How to install NFT Plugin
        • Connect your Credentials to NFT Plugin
      • Wordpress Checkout Plugin
        • How to install Checkout Plugin
        • Connect your Credentials to Checkout Plugin
      • Plugins Guides
        • Creating your Store
        • Manage your Wallets
        • Creating Collections and NFTs
        • Linking Products to NFTs
        • Monitoring Orders
        • Monitoring Store (Analytics)
  • 💻Community Edition
    • Overview
    • Architecture
    • Start for free
    • Getting started
    • Dashboard guide
      • 🔑Creating a Project (API Key)
      • 🛠️Start building!
      • 📊Monitoring your Project
      • 📈Monitoring Requests
    • SDK guides
      • Get test currencies
      • Chainlink
        • 📈Price Feeds
        • ⚙️Automation
        • 🎲VRF
        • 🛤️CCIP
        • 🛤️CCIP
        • Project Examples
          • Lottery
          • Send Message CCIP
      • Wallets
      • Balances
      • Prices
      • Tokens
        • EVM Tokens (ERC-20)
        • Solana Tokens (SPL)
        • Cardano Tokens
        • Stellar Tokens
        • XRP Tokens
        • Hathor Tokens
      • NFTs
        • EVM NFTs (Ethereum, Polygon and others)
        • NFTs on Solana
        • NFTs on Hathor Network
      • Queries
        • Wallet information
        • Get transaction by hash
        • Get block information
        • Get transaction receipt by hash
        • Get fees information
        • Get NFT data
        • Get NFT balance
        • Get UTXOs (Unspent transaction outputs)
      • Uniswap
      • Staking
      • Smart Contracts
        • Deploy custom Smart Contracts
        • Loot Box
    • Features and credits
      • Avalanche C Chain
      • Bitcoin
      • BNB Chain
      • Cardano
      • Celo
      • Ethereum
      • Hathor
      • Polygon
      • Solana
      • Stellar
      • XRP Ledger
      • Stratus
    • API guides
      • API Cryptum
      • API Connector
  • 📃GLOSSARY
    • Blockchain terms
    • Cryptum terms
Powered by GitBook
On this page
  1. Community Edition
  2. SDK guides
  3. Chainlink

VRF

PreviousAutomationNextCCIP

Last updated 9 months ago

VRF

Chainlink VRF (Verifiable Random Function) is a provably fair and verifiable random number generator (RNG) that enables smart contracts to access random values without compromising security or usability. For each request, Chainlink VRF generates one or more random values and cryptographic proof of how those values were determined. The proof is published and verified on-chain before any consuming applications can use it. This process ensures that results cannot be tampered with or manipulated by any single entity including oracle operators, miners, users, or smart contract developers.

Create VRF

Deploy contract responsible for request and managing random words.

// This contract is compatible with Upkeep Automation
// To use the "updateIntervalUpkeep" parameter
// "updateIntervalUpkeep" == Number of blocks
// Each "updateIntervalUpkeep" block will perform the action of requesting a random word
const { hash } = await sdk.chainlink.createVRF({
    protocol,
    wallet,
    updateIntervalUpkeep // default: 0
})

const { contractAddress } = await sdk.transaction.getTransactionReceiptByHash({
    protocol,
    hash
})

Get Subscription

Get the subscription ID and more information about the generated contract.

sdk.chainlink.getSubscriptionVRF({
    protocol,
    address
})

Get Subscription By Id

Retrieve additional information about the subscription by searching for it using its ID.

sdk.chainlink.getSubscriptionByIdVRF({
    protocol,
    id: 6329
})

TopUp Subscription

Add funds to your subscription.

sdk.chainlink.topUpVRF({
    protocol,
    address,
    wallet,
    amount: 10
})

Request RandomWords

Request new random words, and you can pass the quantity of words to be generated as a parameter. Ensure that there are sufficient funds in your wallet.

sdk.chainlink.requestRandomWordsVRF({
    protocol,
    address,
    wallet,
    numWords: 2
})

List requests

List all the IDs of the requests made through the provided contract.

sdk.chainlink.requestsVRF({
    protocol,
    address
})

Get Latest Request

Return the ID of the last request made.

sdk.chainlink.latestRequestVRF({
    protocol,
    address
})

Get Randomwords

Through the requestID, you can query whether the random words have already been generated or not. In case of true, all requested random words will be returned according to the numWords argument passed.

sdk.chainlink.getRandomWordsVRF({
    protocol,
    address,
    requestId
})

Cancel Subscription

sdk.chainlink.cancelVRF({
     protocol,
     address,
     wallet
})
💻
🎲
Read more about Chainlink VRF