Truffle

嘗試使用 HDWallet 連接到 infura 時出錯

  • May 3, 2020

我想使用 truffle 和 infura 調試交易。

truffle debug --network=infurarinkeby 0x7...

松露-config.js:

   infurarinkeby: {
       provider: function() {
           return new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/<my api key>")
       },
       network_id: 4,
       gas: 6e6,
       gasPrice: 5e10,
       from: "0xc491c11f6c2e031e99d7c93300baced83019041d"
   },

錯誤:

Could not connect to your Ethereum client. Please check that your Ethereum client:
   - is running
   - is accepting RPC connections (i.e., "--rpc" option is used in geth)
   - is accessible over the network
   - is properly configured in your Truffle configuration file (truffle.js)

似乎 infura 不支持調試 API:

https://github.com/trufflesuite/truffle/issues/890

確保您使用的是 Infura 項目 ID,而不是項目密碼。

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