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

1 Answer 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
    Commented Mar 5, 2018 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.
    Commented Mar 6, 2018 at 11:00

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