<p>In Pycoin you have to change the parmeter in the subkey method, the account type</p>
<pre><code> xpub = network.parse(key)
 lookup(xpub, 0)
 lookup(xpub, 1)
</code></pre>
<p>Like this you will get all address from your xpub where bitcoin where sent to.</p>

CC BY-SA 4.0
2024-09-05T06:28:51.903Z
2024-09-06T06:22:17.853Z
2024-09-06T06:22:17.853Z
donbolli
<p>I have a little App for me that uses the xpub to scan for all received coins. I am using <a href="https://blockchain.info/rawaddr/" rel="nofollow noreferrer">Blockchain</a> to collect the info. This is working fine, now I am facing the issue that when coins are spent, i have a wrong balance if i just spend part of my utxo. I looked into the outputs, how can I figure out what was payed to myself? the json looks not different for the outputs. can i check if the address is part of my xpub?</p>
<p><strong>Edit</strong></p>
<p>It is an Extend Public Key as a zpub</p>

CC BY-SA 4.0
2024-09-04T18:59:09.663Z
Are you asking about spending part of one UTXO or a subset of your UTXOs? A single UTXO cannot be spent partially. All UTXO are spent completely and the remainder must be assigned to a change output to be returned to the sender. Also see [How does change work in a bitcoin transaction?](https://bitcoin.stackexchange.com/q/736/5406)
Murch
<utxo><xpub><pycoin>
Pycoin/Python spending part UTXO
donbolli
# Pycoin/Python spending part UTXO

(Asked by: username_0 on 2024-09-04)

I have a little App for me that uses the xpub to scan for all received coins. I am using [Blockchain](https://blockchain.info/rawaddr/) to collect the info. This is working fine, now I am facing the issue that when coins are spent, i have a wrong balance if i just spend part of my utxo. I looked into the outputs, how can I figure out what was payed to myself? the json looks not different for the outputs. can i check if the address is part of my xpub?

**Edit**

It is an Extend Public Key as a zpub

**Tags:** utxo, xpub, pycoin

> **Comments:**
> **username_1**: Are you asking about spending part of one UTXO or a subset of your UTXOs? A single UTXO cannot be spent partially. All UTXO are spent completely and the remainder must be assigned to a change output to be returned to the sender. Also see [How does change work in a bitcoin transaction?](https://bitcoin.stackexchange.com/q/736/5406)  

---

## 1 answers

### Answer by username_0 on 2024-09-05. Score: 0 | Accepted answer

In Pycoin you have to change the parmeter in the subkey method, the account type

```
 xpub = network.parse(key)
 lookup(xpub, 0)
 lookup(xpub, 1)

```

Like this you will get all address from your xpub where bitcoin where sent to.


---

