<p>I'm trying to generate unused receiving Bitcoin address from xPub using <a href="https://github.com/ranaroussi/pywallet" rel="nofollow noreferrer">PyWallet</a> python library .
I got the xPub from my BIP32 Electrum wallet.</p>

<p>Here is what I tried</p>

<pre><code>from pywallet import wallet

WALLET_PUBKEY = 'xpub....'

# Generate a random address, based on timestamp
rand_addr = wallet.create_address(network="BTC", xpub=WALLET_PUBKEY)

print("Random Address\n", rand_addr)
</code></pre>

<p>I sent a few cents worth of Bitcoin to it's printed address but I didn't receive it.
What is wrong here and what is the solution ?</p>

CC BY-SA 4.0
2019-11-02T08:20:42.840Z
For starters, you should test this on testnet instead of with actual BTC.
Pieter Wuille
CC BY-SA 4.0
2019-11-02T08:21:50.797Z
@PieterWuille How to do that?
user8481790
CC BY-SA 4.0
2019-11-02T09:41:36.880Z
@PieterWuille Ok. I just figured out how to use testnet wallet but I don’t know how to use testnet network with PyWallet
user8481790
<address><address-generation><xpub>
Trying to programmically generate unused receiving address from a xPub
user8481790
# Trying to programmically generate unused receiving address from a xPub

(Asked by: username_0 on 2019-11-02)

I'm trying to generate unused receiving Bitcoin address from xPub using [PyWallet](https://github.com/ranaroussi/pywallet) python library .
I got the xPub from my BIP32 Electrum wallet.

Here is what I tried

```
from pywallet import wallet

WALLET_PUBKEY = 'xpub....'

# Generate a random address, based on timestamp
rand_addr = wallet.create_address(network="BTC", xpub=WALLET_PUBKEY)

print("Random Address\n", rand_addr)

```

I sent a few cents worth of Bitcoin to it's printed address but I didn't receive it.
What is wrong here and what is the solution ?

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

> **Comments:**
> **username_1**: For starters, you should test this on testnet instead of with actual BTC.  
> **username_0**: @username_1 How to do that?  
> **username_0**: @username_1 Ok. I just figured out how to use testnet wallet but I don’t know how to use testnet network with PyWallet  

---

## 0 answers

