我正试图从链链接神谕中得到一个随机数,但不知道两种方法之间的区别。链链接文档说,使用RandomNumberConsumer是VRFConsumerBase来获得一个链接,但我在链接松露盒中找到了一个替代方案。
第一条路:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
/**
* THIS IS AN EXAMPLE CONTRACT WHICH USES HARDCODED VALUES
我试着用Chainlink的VRF来产生一个随机数。我遵循了指南,并为此生成了一个基本契约,但是getRandomNumber()不起作用。我在使用Sepolia测试网络。
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.17;
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
contract Test is VRFConsumerBase {
uint256 public _randomSeed;
bytes32 inter
错误:
ValueError:气体评估失败:‘执行恢复’。此事务可能会恢复。如果你想广播,你必须手动设置气体限制。
// SPDX-License-Identifier: MIT
// An example of a consumer contract that relies on a subscription for funding.
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@chainlink/
我在遵循帕特里克·柯林斯的课程。在第9章,当我们在rinkeby上做测试时。事件不是开火。我正在使用chainlink Keeper和VRF运行代码,详情如下。
控制台错误日志
fulfillRandomWords
works with live Chainlink Keepers and Chainlink VRF, we get a random winner:
Error: Timeout of 500000ms exceeded. For async tests and hooks, ensure "done()" is called; if r
我对稳固和Blockchain非常陌生,虽然我有where的背景,但我也有很多人是通过freeCodeCamp.org频道关注这些技术的视频的,VRF v1就是在这里实现的。然后我将它更新到我的合同中的VRF v2,我可以说我理解它的周期,并且它通过Remix和订阅管理器工作得很好。
虽然我在尝试用Brownie(Python)在Rinkeby或ganache-cli与Infura端点分叉上编程实现它时有一些问题。
createSubscription():
function createNewSubscription() private onlyOwner {
// Create a s
我正在完成高级NFT的免费freecodecamp稳固教程,并且在部署到rinkeby时返回:
ValueError: Gas estimation failed: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.
当我使用fund_with_link令牌时,我的合同得到了资助,但如果不返回错误消息,就无法调用create_collectible函数。我的元问题帐户中有足够的链接。
以下