1

Hi I am trying to implement a feature where a user can enter their xpub key and get a list of their transactions and their balance. To do this I think I need to get all the wallet addresses from the xpub key and then loop over them using an api like chain.so

Does anyone know of a good api or library that can be used to derive all addresses from an xpub key?

Also for context I use node js on the server.

Thank you!

1 Answer 1

1

Does anyone know of a good api or library that can be used to derive all addresses from an xpub key?

I suspect you can do this using the bx tool.

The linked page describes how to create hd public keys and convert those to addresses.

bx seed > seed
bx hd-new < seed > master
bx hd-private --hard < master > account
bx hd-public --index 0 < account | bx hd-to-ec | bx ec-to-address
bx hd-public --index 1 < account | bx hd-to-ec | bx ec-to-address
bx hd-public --index 2 < account | bx hd-to-ec | bx ec-to-address

The above seems to work for me.

Since bx is supplied as part of libbitcoin, I imagine that library can be used to produce addresses.

The libbitcoin toolkit is a set of cross platform C++ libraries for building bitcoin applications. The toolkit consists of several libraries, most of which depend on the foundational libbitcoin library. Each library's repository can be cloned and built using common Automake instructions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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