简体   繁体   中英

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

1. Dry run deploy

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

That's $83.83

2. Do I have $83.83? Yes I do. 在此处输入图像描述

3. Double check mainNet configs ( truffle-config.js ):

  • Current gas in Gwei 105 (105000000000 Wei)
  • Final cost was 0.058258696 ETH (58258696000000000 Wei)

Plug these numbers in:

 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. Time to deploy

truffle migrate --network mainnet


Result:

Error:  *** Deployment Failed ***

"Migrations" could not deploy due to insufficient funds

So, I've...

  1. Run the dry run, gotten the estimate cost of deploying the contract. Plugged that value in.
  2. Got the current cost of Gas. Plugged that in.
  3. Ran the contract
  4. The deployment fails

Is there anything I'm missing here?

Your Gas value looks incorrect. Check Dry Run Output , you will see > gas used: 4390736 (example number) or deploy contract to a test network or https://remix.ethereum.org to have an idea of gas used, then update gas in truffle-config.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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