<p>I have to deserialize xpub key then use its derivation path to get a child path or normal key. From a normal key, it is easy to convert the public key to address.<br />
You can refer to this source code.
<a href="https://github.com/tatumio/tatum-java/blob/master/src/main/java/io/tatum/wallet/Address.java#L24" rel="nofollow noreferrer">https://github.com/tatumio/tatum-java/blob/master/src/main/java/io/tatum/wallet/Address.java#L24</a></p>
<p>Thanks</p>

CC BY-SA 4.0
2020-12-25T14:52:03.363Z
Whilst this may theoretically answer the question, [it would be preferable](//meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
Glorfindel
CC BY-SA 4.0
2020-12-25T15:42:18.717Z
Thanks. I updated my answer.
tiennv
CC BY-SA 4.0
2020-12-25T09:21:37.680Z
2020-12-25T15:41:55.280Z
2020-12-25T15:41:55.280Z
tiennv
<p>I have an xpub key with which I want to generate all addresses which have been used or will be used and then find out the keys which have balance.</p>

<p>Here's a sample xpubkey with balance- xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz</p>

CC BY-SA 4.0
2019-04-24T15:26:33.743Z
Possible duplicate of [generate wallet addresses from extended public key](https://bitcoin.stackexchange.com/questions/73013/generate-wallet-addresses-from-extended-public-key)
Ugam Kamat
CC BY-SA 4.0
2019-04-24T17:21:52.010Z
Hi Ugam, I tried the method but it doesn't work for me. :)
Parth Gargava
CC BY-SA 4.0
2024-01-10T09:24:37.007Z
I’m voting to close this question because it shows low to no investigation effort.
Antoine Poinsot
<bitcoin-core><public-key><bitcoinj><java><xpub>
How can I generate public address from an xpub key in Java?
Parth Gargava
# How can I generate public address from an xpub key in Java?

(Asked by: username_0 on 2019-04-24)

I have an xpub key with which I want to generate all addresses which have been used or will be used and then find out the keys which have balance.

Here's a sample xpubkey with balance- xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz

**Tags:** bitcoin-core, public-key, bitcoinj, java, xpub

> **Comments:**
> **username_1**: Possible duplicate of [generate wallet addresses from extended public key](https://bitcoin.stackexchange.com/questions/73013/generate-wallet-addresses-from-extended-public-key)  
> **username_0**: Hi username_1, I tried the method but it doesn't work for me. :)  
> **username_2**: I’m voting to close this question because it shows low to no investigation effort.  

---

## 1 answers

### Answer by username_3 on 2020-12-25. Score: 0

I have to deserialize xpub key then use its derivation path to get a child path or normal key. From a normal key, it is easy to convert the public key to address.  
You can refer to this source code.
<https://github.com/tatumio/tatum-java/blob/master/src/main/java/io/tatum/wallet/Address.java#L24>

Thanks

> **Comments:**
> **username_4**: Whilst this may theoretically answer the question, [it would be preferable](//meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.  
> **username_3**: Thanks. I updated my answer.  

---

