1

I want to execute signed Ethereum transactions from a NodeJS program. I am creating a web3_provider like this

var contract = require("truffle-contract");

var provider = new HDWalletProvider("nemonic", "https://rinkeby.infura.io/xxxxx");
// if I change the above line to: var provider = new Web3.providers.HttpProvider("https://rinkeby.infura.io/xxxxx");
// Everything works fine
var web3 = new Web3(provider); 

var myContract = contract(myABI);
myContract.setProvider(web3.currentProvider);

When I try to execute transactions w/ HDWalletProvider, I get the error: "Account not found". Has anyone been able to use HDWalletProvider to successfully execute signed transactions? Or am I using it incorrectly?

0

Ensure that var HDWalletProvider = require("truffle-hdwallet-provider"); is installed correctly and required. npm install truffle-hdwallet-provider --save will install the module.

Secondly you "nemonic" phrase is improperly formatted. A seed nemonic should look like this: retreat attack lift winter amazing noodle interest dutch craft old solve save and is likely the cause of you error.

  • I replaced my seed phrase with the word "nemonic" because I didn't want to post it publicly. And HDWalletProvider is installed correctly. – Test1 Test2 Jul 22 '18 at 23:40
  • That's smart, I should have recognized that. I see the problem. You can't setProvider on a contract object. The contract is either already deployed in which case you provide an address. Or you need to deploy the contract. – dangerousfood Jul 22 '18 at 23:56
  • Could you also check your version of web3js? Thank you – dangerousfood Jul 23 '18 at 0:02
  • That's not a contract object, its truffle contract- npmjs.com/package/truffle-contract. I am using: "truffle-contract":"^3.0.5", "truffle-hdwallet-provider": "0.0.3", "web3": "^1.0.0-beta.26", – Test1 Test2 Jul 23 '18 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.