首页 > 解决方案 > 部署到以太坊 Ropsten 测试网失败

问题描述

我在这里尝试freecodecamp项目: https ://www.freecodecamp.org/news/how-to-make-an-nft/

我被这一步困住了

node ./scripts/deploy.js

但它未能部署到 Ropsten 测试网络。我是 NFT 和以太坊的初学者,我不知道如何调试它。

现在的错误信息是资金不足。但我现在在 Metamask 钱包中获得了 10 多个以太坊。

Error: insufficient funds for intrinsic transaction cost (error={"name":"ProviderError","code":-32000,"_isProviderError":true}, method="sendTransaction", transaction=undefined, code=INSUFFICIENT_FUNDS, version=providers/5.5.0)

我怎样才能知道我需要多少以太坊?我希望它就足够了,但当然不确定。失败的真正原因是什么?

这里是部署脚本:

// ethereum/scripts/deploy.js

async function main() {
  const EmotionalShapes = await ethers.getContractFactory("EmotionalShapes");
  const emotionalShapes = await EmotionalShapes.deploy();

  console.log("EmotionalShapes deployed:", emotionalShapes.address);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

标签: javascriptnode.jsdeploymentethereumnft

解决方案


推荐阅读