How to generate bitcoin address from XPUB, I am looking for pointers on how to use an XPUB to generate addresses. I would like to perform address generation offline with the XPUB.
Asked
Active
Viewed 1,278 times
-1
-
Related: https://bitcoin.stackexchange.com/a/98919/ – Prayank Aug 13 '21 at 14:27
-
Maybe the Bitcoin bible might help? → https://github.com/mrkskwsnck/bitcoinbook/blob/develop/ch04.asciidoc – mrkskwsnck Aug 29 '21 at 17:33
2 Answers
0
I сreated a library for bitcoin address generation from xpub. After installation you can write:

Community
- 1
- 1

Anton Masanavets
- 51
- 1
- 3
-1
An Xpub key can be broken into 2 parts.
The first 32 bytes, is the key and the last 32 bytes is the chaincode.
You can use the key part to create addresses by hashing it with ripemd160(sha256(key))
and then encoding the resulting 20 byte hash with Base58 for legacy P2PKH addresses or Bech32 for Segwit P2WPKH addresses.

nlanson
- 357
- 1
- 3
- 14