<p>To go from account xpub to address, you must first derive an xpub at the External index (0) or Internal index (1), then derive another xpub from the External/Internal xpub. Take the public key from the resulting xpub and this is the public key used for the address.</p>
<p>For a detailed explanation of extended public keys and how to derive child public keys, take a look at the <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#public-parent-key--public-child-key" rel="nofollow noreferrer">BIP32 documentation</a>. For a not-as-in-depth breakdown of deriving addresses from an extended public key (which is exactly what you're trying to do), I have written <a href="https://github.com/EAWF/BTC-Toolbox/blob/old-master/Address-Derivation.md" rel="nofollow noreferrer">this writeup</a>.</p>

CC BY-SA 4.0
2020-01-19T05:05:27.907Z
can you explain it further more, see what steps i have followed to derive Address Node Public Key.
is there anything wrong in my implementation or pseudo code ?
Amish Sharma
CC BY-SA 4.0
2020-01-19T14:45:09.940Z
@AmishSharma Your implementation/pseudocode is very wrong and not even close to what actually happens. Please read my answer, specifically the [second link.](https://github.com/EAWF/Bitcoin-Merchants-Toolbox/blob/master/Address-Derivation.md)
Septem151
CC BY-SA 4.0
2020-01-19T15:05:12.277Z
Sorry, but i i have done some mistake due to which i was not able to derive right address ..
My Pseudocode is perfectly fine .. By mistake i called hdnode_private_ckd() instead of hdnode_public_ckd()..
Amish Sharma
CC BY-SA 4.0
2020-01-19T15:05:42.223Z
Thanks for your time and feedback..  appreciate it
Amish Sharma
CC BY-SA 4.0
2020-01-19T15:11:26.433Z
@AmishSharma Please be careful with whatever you are doing. Your pseudocode does not do what you are asking in your question.
Septem151
CC BY-SA 4.0
2020-01-21T08:10:45.130Z
then how i got the desired result..
can you just tell me the your PseudoCode for Get Address Node Public key from Account Node XPUB. that would be appreciated
Amish Sharma
CC BY-SA 4.0
2020-01-21T19:27:19.080Z
@AmishSharma See answer please...
Septem151
CC BY-SA 4.0
2020-01-18T21:59:11.090Z
2021-02-12T09:53:53.850Z
2021-02-12T09:53:53.850Z
Septem151
<p>I am little bit confused or not able to get the right Address Node Public key from Account XPUB.</p>
<p>What I have done :</p>
<ol>
<li><p>Get the Account XPUB [78Bytes]</p>
</li>
<li><p>SHA-256</p>
</li>
<li><p>SHA-256 Again</p>
</li>
<li><p>Created Extended XPUB (XPUB + 4 Start Byte of Step 3)</p>
</li>
<li><p>Base 58 ENC</p>
</li>
<li><p>hdnode_deserialize()</p>
</li>
<li><p>Account Node  Change Node</p>
</li>
<li><p>Change Node  Address Node.</p>
</li>
</ol>
<p>But am not able to get the right Public Address.</p>
<p>Please let me know if I have done something wrong.</p>

CC BY-SA 4.0
2020-01-18T15:41:31.207Z
What you want to achieve (derivation protocol) is precisely described and detailed in BIP32 https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#public-parent-key--public-child-key ...
Antoine Poinsot
CC BY-SA 4.0
2020-01-18T15:58:01.967Z
I just want to get the Address Node Public Address by Account XPUB ..
Amish Sharma
CC BY-SA 4.0
2020-01-18T15:58:39.113Z
i am writing my own application and somehow not able to get the right result and seek someone help
Amish Sharma
<address><nodes><address-generation><xpub>
How To get Address Public Key from Account XPUB?
Amish Sharma
# How To get Address Public Key from Account XPUB?

(Asked by: username_0 on 2020-01-18)

I am little bit confused or not able to get the right Address Node Public key from Account XPUB.

What I have done :

1. Get the Account XPUB [78Bytes]
2. SHA-256
3. SHA-256 Again
4. Created Extended XPUB (XPUB + 4 Start Byte of Step 3)
5. Base 58 ENC
6. hdnode\_deserialize()
7. Account Node Change Node
8. Change Node Address Node.

But am not able to get the right Public Address.

Please let me know if I have done something wrong.

**Tags:** address, nodes, address-generation, xpub

> **Comments:**
> **username_1**: What you want to achieve (derivation protocol) is precisely described and detailed in BIP32 https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#public-parent-key--public-child-key ...  
> **username_0**: I just want to get the Address Node Public Address by Account XPUB ..  
> **username_0**: i am writing my own application and somehow not able to get the right result and seek someone help  

---

## 1 answers

### Answer by username_2 on 2020-01-18. Score: 1

To go from account xpub to address, you must first derive an xpub at the External index (0) or Internal index (1), then derive another xpub from the External/Internal xpub. Take the public key from the resulting xpub and this is the public key used for the address.

For a detailed explanation of extended public keys and how to derive child public keys, take a look at the [BIP32 documentation](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#public-parent-key--public-child-key). For a not-as-in-depth breakdown of deriving addresses from an extended public key (which is exactly what you're trying to do), I have written [this writeup](https://github.com/EAWF/BTC-Toolbox/blob/old-master/Address-Derivation.md).

> **Comments:**
> **username_0**: can you explain it further more, see what steps i have followed to derive Address Node Public Key. is there anything wrong in my implementation or pseudo code ?  
> **username_2**: @username_0 Your implementation/pseudocode is very wrong and not even close to what actually happens. Please read my answer, specifically the [second link.](https://github.com/EAWF/Bitcoin-Merchants-Toolbox/blob/master/Address-Derivation.md)  
> **username_0**: Sorry, but i i have done some mistake due to which i was not able to derive right address .. My Pseudocode is perfectly fine .. By mistake i called hdnode_private_ckd() instead of hdnode_public_ckd()..  
> **username_0**: Thanks for your time and feedback..  appreciate it  
> **username_2**: @username_0 Please be careful with whatever you are doing. Your pseudocode does not do what you are asking in your question.  
> **username_0**: then how i got the desired result.. can you just tell me the your PseudoCode for Get Address Node Public key from Account Node XPUB. that would be appreciated  
> **username_2**: @username_0 See answer please...  

---

