Hardhat Error: Transaction reverted: function call to a non-contract account

Please check you hardhat.config.js。

出现这个错误是因为节点环境问题,hardhat默认是本地环境,那么需要启动本地节点。

如果是相应的测试网,需要启动的之后指定网络环境。 --network xxxx

或者在hardhat.config.js 中指定默认的网络环境

例如:


defaultNetwork: "rinkeby",

networks: {
    
    
hardhat: {
    
    
},

rinkeby: {
    
    
url: "https://rinkeby.infura.io/v3/xxxx",

accounts: ["xxxx"]

},

猜你喜欢

转载自blog.csdn.net/qq_36838406/article/details/119246100
今日推荐