How to generate address from xpub in JS? Should i use BIP39 or 44? If yes, how exactly?


You can use ethereumjs-wallet, from their unit tests

var xpub = 'xpub661MyMwAqRbcGout4B6s29b6gGQsowyoiF6UgXBEr7eFCWYfXuZDvRxP9zEh1Kwq3TLqDQMbkbaRpSnoC28oWvjLeshoQz1StZ9YHM1EpcJ'
var addr = Wallet.fromExtendedPublicKey(xpub).getAddressString()
assert(addr, '0xb800bf5435f67c7ee7d83c3a863269969a57c57c')

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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