1

Would be grateful to be pointed to any resources that would allow me to do this. Thanks!

closed as too broad by Achala Dissanayake, eth Mar 6 '18 at 2:23

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

You need to first parse all the accounts in your HD wallet.

For example, if you have a Ledger Nano, there is a script here.

Or you can just generate addresses from a predefined mnemonic with ethereumjs-wallet as described here.

Finally, once you have the Nth address generated by the HD wallet you can just use:

web3.eth.sendTransaction ( { from: nthaddress, to: singleaddress, value: web3.eth.getBalanceOf( nthaddress ) - fee } )

to do the transaction

where nthaddress is the deriveAccount with the path m/xx'/yy'/0'/.. ( e.g.: "m/44'/60'/0'/0/0" )

  • Thank you so much, Andrei! I'm attempting this, but am hitting the following error: CONNECTION ERROR: Couldn't connect to node mainnet.infura.io. at Object.InvalidConnection (/home/ubuntu/server/node_modules/web3/lib/web3/errors.js:31:16) at HttpProvider.send (/home/ubuntu/server/node_modules/web3/lib/web3/httpprovider.js:87:18) at Eth.send [as getBalance] (/home/ubuntu/server/node_modules/web3/lib/web3/method.js:145:58) ....etc. Could you advise? I'm quite new; apologies if the solution is obvious. – Rachel Mar 5 '18 at 17:53
  • I don't know much about infura.io , all I can suggest is to run your own node (eventually a light node like this redd.it/6lzw8y ), sorry... – Andy B. Mar 6 '18 at 11:00

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