Questions tagged [chainlink-vrf]
The chainlink-vrf tag has no usage guidance.
48
questions
0
votes
0
answers
20
views
VRFV2Wrapper::onTokenTransfer reverts, although it shouldnt
I'm trying to test a contract "BrewBurner" which inherits VRFV2WrapperConsumerBase and should receive a a callback to the fulfillRandomWords() function. I deploy all the contracts on the ...
0
votes
1
answer
13
views
How to guarantee or ensure uniqueness based on Chainlink VRF?
I am using Chainlink VRF V2 to generate 10 random numbers.
Assuming VRF generated something like this below.
[ 111.., 222.., 333.., 444.., 555.. 666.., 777.., 888.., 999.., 000..]
As best practice to ...
1
vote
0
answers
48
views
ChainLink VRF requestRandomnes() failing
Here is the txn on sepolia: https://sepolia.etherscan.io/tx/0xb530e49bb505fad002923e957d784a4fa18084b65d79eabd4fc29b326a7e797e
Given below is the Factory contract that deploys a Raffle contract.
...
1
vote
0
answers
58
views
Chainlink performUpkeep not being executed
I am trying to implement a decentralized raffle that works with custom tokens and randomly select the winner using chainlink automated keepers. I selected a time-based keeper so that "...
0
votes
1
answer
18
views
Restricting External Adapter Access to a Specific Smart Contract: Is it Feasible?
How can I ensure that my external adapter is only accessible by a specific contract? Does the Post express middleware in the external adapter have a header key indicating the calling smart contract? I'...
0
votes
0
answers
8
views
why/ how does VRFCoordinatorV2 automatically fulfill randomness when LINK is deposited?
0
In my smart contract I've created an instances of both the LINK and VRFCoordinatorV2.sol contracts. I am also listening for the 'RandomWordsFulfilled' event which is emitted when 'fulfillRandomWords'...
1
vote
1
answer
17
views
Is paying to an API provider the only way to get reliable events notifications?
I am new to Blockchain development. I am developing a game that depends heavily in random numbers. My first naive implementation was flagged by the auditor as I was generating them on-chain. So I ...
1
vote
1
answer
29
views
Is it possible to wait for one block in order to get the VRF requested Number of words ? CoinFlip program
I am trying to create a CoinFlip program and using VRF Chainlink subscription funding method. In VRF we need to define two functions in order to get first the request ID and then the random number of ...
0
votes
1
answer
35
views
Facing errors with contract invocation ( Unable to access a function stating only owner can access it , even tho I am the owner)
(sorry for structuring the question in a wrong way as I am not sure what term to use precisely) I am facing issue while trying to call the function flip in the program below , I am using chainlinks ...
0
votes
1
answer
11
views
How can I get randomNumber from chainlinkVRF?
this is RandomNumberConsumer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
contract RandomNumberConsumer is ...
0
votes
0
answers
20
views
Using inherited constructors with a proxy factory
I am attempting to use Chainlink VRF along with OpenZeppelin's upgradable contracts to generate a random number. In order to use VRF, I must inherit the constructor from VRFV2WrapperConsumerBase. ...
0
votes
0
answers
21
views
Chainlink PriceFeed Not Working
I'm writing a smart contract for school fee management. but when I call
get pay
the function is showing this. why they not converting ether to USD with price feed chain link contract!.
Contract is ...
0
votes
1
answer
19
views
What are the chances the Chainlink oracle will respond to a non-existent request?
The Chainlink documentation specifies that you should check that a request for a given _requestId exists before continuing.
Chainlink Docs
I'm curious to further understand why this is, is it wrong to ...
1
vote
1
answer
57
views
Unable to fetch a random number from chainlink VRF. Can someone help
array of randomWords is set 0 in the function requestRandomWords()
s_requests[requestId] = RequestStatus({
randomWords: new uint256[](0),
exists: true,
fulfilled: ...
0
votes
1
answer
38
views
Can I send ETH to Chainlink's fulfillRandomWords callback function?
I have this function that requests random words from Chainlink VRF...
function requestNFTs(
address[] memory _variants,
uint256 _variantsType,
uint32 _amount,
address _paymentToken
) ...
1
vote
2
answers
117
views
Chainlink VRF2, Automation - Raffle Game
i am writing a raffle game contract, I integrated Chainlink keepers to check how much time has passed and pick the winner to move on to next round.
function checkUpkeep(
bytes calldata
...
1
vote
0
answers
55
views
Is VRFCoordinatorV2Mock working on mainnet forking or only in local network?
I'm testing my contracts, where I use Chainlink's VRF. I use the mainnet forking in a hardhat. I deployed VRFCoordinatorV2Mock, although it doesn't seem to work. Is VRFCoordinatorV2Mock supposed to ...
0
votes
1
answer
40
views
Random words generation using Chainlink VRF
If the Total request cost lets say 190 gwei which is the sum of verification gas cost + callback gas cost, exceeds the specified Gas Lane ( we define it as keyhash in consumer contract and it ...
0
votes
1
answer
72
views
Address to String in Chainlink Request is giving error?
When i am using
req.add("publicKey","any_public_key_here_as_string");
I have 2 steps mentioned in our job specification
decode_cbor [type=cborparse data="$(decode_log.data)&...
1
vote
1
answer
177
views
Remix Testing ChainLink VRF v2 Direct Funding Method
I'm using ChainLink VRF V2 Direct Funding method to generate random number.
I'm facing problem while generate random number, that my random number request is not getting full-filled after confirming ...
0
votes
0
answers
57
views
Getting "out of gas" error when requesting random numbers using Chainlink VRFv2DirectFundingConsumer in a Solidity contract deployed on Sepolia
I am trying to use Chainlink VRF to generate random numbers in a Solidity contract deployed on the Sepolia testnet. I copied the code from the Chainlink documentation, specifically the ...
1
vote
2
answers
129
views
How can I add consumers to a Chainlink VRF2 subscription with an external smart contract?
When I try to add a consumer to my VRF2 subscription via the Subscription Manager, the transaction completes successfully. This also works when interacting with the chainlink contract directly on ...
1
vote
1
answer
52
views
Hardhat Lottery test is failing
const { deployments, getNamedAccounts, ethers, network } = require("hardhat")
const { assert, expect } = require("chai")
const {
developmentChains,
networkConfig,
} = require(&...
1
vote
0
answers
39
views
VRFV2MockCoordinator contract deploy
const { network, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../helper-hardhat-config")
const { verify } = require("../utils/verify&...
1
vote
1
answer
77
views
VRFConsumerBaseV2, fulfillRandomWords can't transfer ERC721
I was surprised, I can't call safe transfer in fulfillRandomWords, I didn't find any documentation about that or exception. I did a lot of googled, I've found nothing.
My code is
/**
* Callback ...
0
votes
2
answers
215
views
VRFCoordinatorV2Mock contract error
const { network, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../helper-hardhat-config")
const { verify } = require("../utils/verify&...
1
vote
0
answers
30
views
I want to run my algo game via fulfillRandomWords is VRF2 Chainlink
function fulfillRandomWords(uint256 requestId, uint256[] memory randomness)
internal
override
{
//_requestIdToGameId already has gameId, a function who requests randomness, set it
...
0
votes
1
answer
117
views
How to generate secure and pure Randomness number without Chainlink VRF?
I found that the Chainlink VRF do not really support all the networks.
So, I am considering to use off-chain and make my oracle to generate random number.
I have a vague idea just down below
Create a ...
0
votes
2
answers
105
views
VRFCoordinatorV2Mock's fulfillRandomWords not being called in hardhat local deployment
I'm building a smart contract that generates 3 random numbers using Chainlink VRF. My contract (SlotMachine.sol) implements the VRFConsumerBaseV2 and the constructor has 2 parameters: _subscriptionId ...
1
vote
0
answers
244
views
How to calculate chainlink VRF V2 fee cost?
I'm developing a contract on testnet using Chainlink's VRF V2.
I want to calculate the cost incurred when running on mainnet.
As shown in the picture above, a fee of 0.000523300633249633 LINK was ...
1
vote
3
answers
62
views
Why Does This Chainlink Example Code Revert?
I seem to be doing everything exactly as stated in the docs and example code I am following.
When I deploy this to polygon mumbai though and call "generateRandomNumber" it just reverts with ...
0
votes
0
answers
49
views
Locally testing Chainlink VRFV2 Direct Funding Method
I needed to generate a random number in order to pick a random winner in my solidity smart contract. That's why I used Chainlink VRFV2 direct funding method.
I tested everything on Remix, now I want ...
0
votes
1
answer
27
views
Allowance failed when attempting to transfer LINK tokens
I'm creating a smart contract where users can create NFT raffles. I will be using Chainlink VRF for getting provably fair results. For this, the user who creates the raffle needs to supply the ...
1
vote
0
answers
59
views
Call the _mint function of an ERC1155 contract in the fulfillRandomWords callback
I want to call the _mint function of an ERC1155 contract in the fulfillRandomWords callback but i'm getting an error, i guess is due to max fee reached.
How can i solve this?
function ...
0
votes
0
answers
149
views
Calling chainlink VRFCoordinatorV2.sol contract from a local hardhat network (Goerli fork)
The goal is to work with the real VRFV2Coordinator contract: https://github.com/smartcontractkit/chainlink/blob/e1e78865d4f3e609e7977777d7fb0604913b63ed/contracts/src/v0.8/VRFCoordinatorV2.sol
That is ...
0
votes
0
answers
250
views
Why does Chainlink VRFv2 not support L2 rollup chain like arbitrum or optimism?
All the popular L2 rollup chains are not listed in the supported networks per doc: https://docs.chain.link/vrf/v2/direct-funding/supported-networks/.
Meanwhile, Aribitrum and Optimism do have ...
0
votes
1
answer
200
views
VRFV2WrapperConsumerBase function requestRandomness with error undeclared identifier
Working on migrating VRF to V2 but met with error that requestRandomness function is undeclared identifier.
Previous V1 the VRF was implemented using 'VRFConsumerBase.sol'. Currently using V2 '...
0
votes
2
answers
91
views
Chainlink VRF V2 - TypeError: Wrong argument count for function call: 2 arguments given but expected 1
I tried to use Chainlink VRF V2 on my contract but got errors like shown picture below. Does anyone know how to solve this?
My Chainlink VRFV2 Oracle function
/// @dev chainlink oracle function to ...
0
votes
0
answers
471
views
Error processing <UnrecognizedContract>.<unknown>
I try to create a subscription programmatically for Chainlink VRF through a script with hardhat. I go into an issue when I try to call a function related to the LINK Token :
Here is my script :
const ...
0
votes
1
answer
212
views
Chainlink VRFV2 fulfillRandomWords() not being called after requestRandomWords()
Hi I want to get a random number using Chainlink VRFConsumerBaseV2 but the fulfillRandomWords() isn't being called after calling VRFCoordinatorV2Interface.requestRandomWords(). I can confirm that as &...
6
votes
1
answer
1k
views
Using block.prevrandao as randomness for Miller-Rabin Primality test
I am interested in using the new PREVRANDAO value as a source of pseudo-randomness in calculating the Miller-Rabin probabilistic primality test on-chain. Chainlink VRF is an option but ideally I would ...
0
votes
1
answer
125
views
How do I allow a contract to use ChainlinkVRF to request a random number?
I'm writing a little roulette contract that requires a random number to work. I set up a ChainlinkVRF subscription and am using a slightly modified version of Chainlink's example random number oracle ...
1
vote
0
answers
108
views
Chainlink Random Number failing with Gas error
I am trying to test a simple contract that uses chainlink VRF, but it fails with a GAS-related error.
Deployed my contract to Goerli testnet
Sent 60 $LINK tokens to my contract
Trying to call Get ...
1
vote
0
answers
51
views
Chainlink VRF - How I solve this issues?
I'm learning how to use Chain Link VFR to get some random numbers.
I have a Localhost Mainnet Forked by Hardhat and Alchemy.
I'm using the example contract, I can deploy on my localhost normally, I ...
0
votes
1
answer
59
views
Need for rawFulfillRandomWords in ChainLink's VRFConsumerBaseV2
In VRFConsumerBaseV2 the fullfillRandomWords function is made internal and is called via the rawFulfillRandomWords function.
function rawFulfillRandomWords(uint256 requestId, uint256[] memory ...
0
votes
2
answers
64
views
How to keep track of the original msg.sender on Chainlink VRF fullfillRandomWords function?
I'm using Chainlink VRF to get a random number, but I need to keep track of the msg.sender that calls requestRandomWords when the fulfillRandomWords is fired. In other words I need the same msg.sender ...
0
votes
1
answer
191
views
Adding subscription address to chainlink vrf v2 inside of the contract
So I'm writing this lottery smart contract which is pretty straight forward, and since I want to test this on the goerli test net, I want to be able to add the contract as a subscriber to my VRF every ...
0
votes
1
answer
138
views
Which blockhash is used as seed in Chainlink VRF?
Chainlink VRF is a service using the VRF(Verifiable random function) to generate verifiable randomness on-chain, a smart contract supplies a seed (which should be unpredictable to the oracles to whom ...