Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: thaten on January 17, 2023, 04:08:04 PM



Title: public master keys to addresses
Post by: thaten on January 17, 2023, 04:08:04 PM
Hello,
I am searching for a self Hosted (!!) solution to generate addresses from a public zpub key. It would be great, if it has an intigrated rest api inside. Maybe something for nodejs would be very nice.

This would be a nice solution for cold storage wallets.

I am currently using https://github.com/romanz/electrs for various stuff, but unfortunately I dont find any api details anymore.



Title: Re: public master keys to addresses
Post by: NeuroticFish on January 17, 2023, 04:14:12 PM
I am currently using https://github.com/romanz/electrs for various stuff, but unfortunately I dont find any api details anymore.

The documentation for the Electrum Server Protocol is the same as for ElectrumX, i.e. this one: https://electrumx-spesmilo.readthedocs.io/en/latest/protocol.html
Electrs most probably also follows that.


Title: Re: public master keys to addresses
Post by: n0nce on January 17, 2023, 10:07:19 PM
As you can see here (https://learnmeabitcoin.com/technical/extended-keys), generating addresses from an extended public key is not that hard.

https://learnmeabitcoin.com/technical/images/extended-keys/child-extended-public-key-normal.png

That being said, existing solutions can be found easily on GitHub. This one for example, seems to fit almost exactly your description; since it's in JavaScript it should be easy to embed it in a NodeJS application with API that you add yourself. https://github.com/swan-bitcoin/xpub-tool



Title: Re: public master keys to addresses
Post by: thaten on January 18, 2023, 06:53:27 AM
I am currently using https://github.com/romanz/electrs for various stuff, but unfortunately I dont find any api details anymore.

The documentation for the Electrum Server Protocol is the same as for ElectrumX, i.e. this one: https://electrumx-spesmilo.readthedocs.io/en/latest/protocol.html
Electrs most probably also follows that.
I am talking about the Rest API from Electrs. It differs from the ElectrumX protocoll.

As you can see here (https://learnmeabitcoin.com/technical/extended-keys), generating addresses from an extended public key is not that hard.

https://learnmeabitcoin.com/technical/images/extended-keys/child-extended-public-key-normal.png

That being said, existing solutions can be found easily on GitHub. This one for example, seems to fit almost exactly your description; since it's in JavaScript it should be easy to embed it in a NodeJS application with API that you add yourself. https://github.com/swan-bitcoin/xpub-tool
Thanks, I will look into that and update, once it is working.