繁体   English   中英

Truffle 部署资金不足(尽管使用了 Truffle 的总价格估算)

[英]Truffle deploy insufficient funds (despite using Truffle's total price estimates)

1. 试运行部署

Migrations dry-run (simulation)
.....
> Total deployments:   2
> Final cost:          0.058258696 ETH

那是 83.83 美元

2. 我有 83.83 美元吗? 是的,我愿意。 在此处输入图像描述

3. 仔细检查 mainNet 配置 (truffle truffle-config.js ):

  • Gwei 105中的当前气体(105000000000 Wei)
  • 最终成本为 0.058258696 ETH (58258696000000000 Wei)

将这些数字插入:

 mainnet: {
      provider: () =>
        new HDWalletProvider({
          mnemonic: { phrase: process.env.MNEMONIC },
          providerOrUrl: process.env.RPC_URL_1,
        }),
      network_id: 1,
      from: process.env.DEPLOYERS_ADDRESS,
      gas: 58258696000000000, 
      gasPrice: 105000000000,
      confirmations: 2, 
      timeoutBlocks: 200,
      skipDryRun: false, 
    },

4. 部署时间

truffle migrate --network mainnet


结果:

Error:  *** Deployment Failed ***

"Migrations" could not deploy due to insufficient funds

所以,我已经...

  1. 进行试运行,得到部署合约的估计成本。 插入该值。
  2. 得到当前的 Gas 成本。 插上那个。
  3. 履行合同
  4. 部署失败

我在这里有什么遗漏吗?

您的 Gas 值看起来不正确。 检查Dry Run Output ,您将看到> gas used: 4390736 (示例编号)或将合约部署到测试网络或https://remix.ethereum.org以了解使用的 gas,然后在truffle-config.js中更新gastruffle-config.js

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM