Lesson 7: SmartContract Lottery__ Chainlink VRFv2DirectFundingConsumer #1840
-
In lesson 7 , 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 VRFv2DirectFundingConsumer contract, and deployed it using Remix. However, whenever I try to request a random number using the requestRandomWords() function, the transaction fails with a "out of gas" error. Here's the code I used:
At the beginning, I set the callbackGasLimit to 100000, but it was not successful, so I went to stackoverflow to ask questions, and someone told me to change it to 300000. But I tried 300000, 500000, 1000000, and even 3000000, but it was not successful. The hash of the transaction failure: 0x126f1828085fc2fa95cd0e65a3a4e79d8e3e7ae3e17ef1e859c43d4c6c512a74 Thank you in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hello @Laidoffworkerlearnstocode It is caused because of incorrect |
Beta Was this translation helpful? Give feedback.
Hello @Laidoffworkerlearnstocode
It is caused because of incorrect
link
orwrapper
addresses or you are just do not fund correct contract with enough amount of ETH/LINK. You should checkout my solution for VRFV2 Lottery here: https://github.com/Neftyr/Lottery-On-VRFConsumerBaseV2-Python