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 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.