P84
truffle migrate --network goerliを実行して、ガス代不足でデプロイ失敗。
$ truffle migrate --network goerli
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
Migrations dry-run (simulation)
===============================
> Network name: 'goerli-fork'
> Network id: 5
> Block gas limit: 8000000 (0x7a1200)
1_initial_migration.js
======================
Replacing 'Migrations'
----------------------
Error: *** Deployment Failed ***
"Migrations" could not deploy due to insufficient funds
* Account: 0x357D5b3B1527f642Da8765b98b4717e907a930eC
* Balance: 0 wei
* Message: sender doesn't have enough funds to send tx. The upfront cost is: 584634000000000 and the sender's account only has: 0
* Try:
+ Using an adequately funded account
+ If you are using a local Geth node, verify that your node is synced.
MetaMaskを確認したら、確かにETHが入っている。やっぱり、設定などの間違いか。。。
truffle-config.jsを調べたら、やっぱり、デプロイ先をローカルのGanache (http://127.0.0.1:8545
) に向いている。
goerli: {
provider: () => {
const mnemonic = process.env["MNEMONIC"]
return new HDWallterProvider(mnemonic, "http://127.0.0.1:8545");
},
network_id: "*",
},
MetaMaskのネットワーク設定を開き、goerliテストネットワークのRPCのURLをコピーして、GanacheのURLを置き換える。
goerli: {
provider: () => {
const mnemonic = process.env["MNEMONIC"]
return new HDWallterProvider(mnemonic, "https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161");
},
network_id: "*",
},
truffle migrate --network goerliを再実行、デプロイは上手くいった。