Ether

遷移到測試網,但不遷移到主網

  • April 23, 2022

我正在嘗試將我的合約部署到 ETH 主網/livenet。

測試網一切正常,主網試執行也正常,但實際遷移卻不行。

這是輸出:

truffle migrate --network live                                                                                                                                                                                                     1 ⨯

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.



Migrations dry-run (simulation)
===============================
> Network name:    'live-fork'
> Network id:      1
> Block gas limit: 30029267 (0x1ca35d3)


1_migration.js
======================

  Deploying 'TestContract'
  ----------------------
  > block number:        13060683
  > block timestamp:     1629442749
  > account:             <my_account>
  > balance:             0.086514396
  > gas used:            3742802 (0x391c52)
  > gas price:           2 gwei
  > value sent:          0 ETH
  > total cost:          0.007485604 ETH

  -------------------------------------
  > Total cost:         0.007485604 ETH


Summary
=======
> Total deployments:   1
> Final cost:          0.007485604 ETH





Starting migrations...
======================
> Network name:    'live'
> Network id:      1
> Block gas limit: 29970705 (0x1c95111)


1_migration.js
======================

  Deploying 'TestContract'
  ----------------------


Error:  *** Deployment Failed ***

"TestContract" could not deploy due to insufficient funds
  * Account:  <my_account>
  * Balance:  94000000000000000 wei
  * Message:  insufficient funds for gas * price + value
  * Try:
     + Using an adequately funded account
     + If you are using a local Geth node, verify that your node is synced.

   at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
   at runMicrotasks (<anonymous>)
   at processTicksAndRejections (internal/process/task_queues.js:97:5)
   at Migration._deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:70:1)
   at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:56:1)
   at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:217:1)
   at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
   at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
   at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
   at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:258:1)
   at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:221:1)
   at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:172:1)
Truffle v5.4.5 (core: 5.4.5)
Node v12.21.0

我的錢包裡有 0.09 ETH,應該足以支付遷移費用。

有人可以在這裡幫助我嗎?

這是錯誤:

* Try:
     + Using an adequately funded account
     + If you are using a local Geth node, verify that your node is synced.

我認為你應該添加更多的 ETH 來覆蓋遷移。測試網的汽油費遠低於主網,所以不要拿這個值來證明主網部署的合理性。

我在這個 Discord 組中找到了一些有用的資源:https ://discord.gg/MffMqPF3 。社區也很有幫助。

引用自:https://ethereum.stackexchange.com/questions/107453