<p>Take a look on <a href="https://github.com/wemeetagain/go-hdwallet" rel="nofollow noreferrer">https://github.com/wemeetagain/go-hdwallet</a></p>

<pre><code>// Generate a random 256 bit seed
seed, err := hdwallet.GenSeed(256)

// Create a master private key
masterprv := hdwallet.MasterKey(seed)

// Convert a private key to public key
masterpub := masterprv.Pub()

// Generate new child key based on private or public key
childprv, err := masterprv.Child(0)
childpub, err := masterpub.Child(0)

// Create bitcoin address from public key
address := childpub.Address()

// Convenience string -&gt; string Child and ToAddress functions
walletstring := childpub.String()
childstring, err := hdwallet.StringChild(walletstring,0)
childaddress, err := hdwallet.StringAddress(childstring)
</code></pre>

CC BY-SA 4.0
2018-07-06T21:23:17.490Z
2018-07-06T21:23:17.490Z
Tailer
<p>i'm trying to derive HD address of bitcoin using Golang. I have extended private/public key. The problem is i'm unable to find any library in Golang that can generate/derive address from the xpubkey/xprivkey. any advice? </p>

<bip32-hd-wallets><go-lang>
Golang how to derive address from bip32's xpubkey?
user1420716
# Golang how to derive address from bip32's xpubkey?

(Asked by: username_0 on 2018-07-06)

i'm trying to derive HD address of bitcoin using Golang. I have extended private/public key. The problem is i'm unable to find any library in Golang that can generate/derive address from the xpubkey/xprivkey. any advice?

**Tags:** bip32-hd-wallets, go-lang


---

## 1 answers

### Answer by username_1 on 2018-07-06. Score: 0 | Accepted answer

Take a look on <https://github.com/wemeetagain/go-hdwallet>

```
// Generate a random 256 bit seed
seed, err := hdwallet.GenSeed(256)

// Create a master private key
masterprv := hdwallet.MasterKey(seed)

// Convert a private key to public key
masterpub := masterprv.Pub()

// Generate new child key based on private or public key
childprv, err := masterprv.Child(0)
childpub, err := masterpub.Child(0)

// Create bitcoin address from public key
address := childpub.Address()

// Convenience string -> string Child and ToAddress functions
walletstring := childpub.String()
childstring, err := hdwallet.StringChild(walletstring,0)
childaddress, err := hdwallet.StringAddress(childstring)

```


---

