<p>If you have just a pair of private and public keys, you would need a little more information.</p>

<p>A single public key can control Bitcoin in a number of ways:</p>

<ol>
<li>A direct p2pk output</li>
<li>A p2pkh output paying the hash of the public key</li>
<li>A p2sh output paying a script controlled by a set of public keys that may include keys other than the one you have</li>
<li>A p2wpkh segwit output paying the hash of the public key</li>
<li>A p2wsh output paying a script controlled by a set of public keys that may include keys other than the one you have</li>
</ol>

<p>Without knowing which type of output you are looking for, the public key alone is not sufficient, especially for p2sh and p2wsh outputs where other keys are required to construct the address.</p>

<p>Once you know which output type to look for, you can use the <code>scantxoutset</code> RPC method of a node, or construct your own index similar to an explorer or Electrum server and query balances.</p>

CC BY-SA 4.0
2019-12-17T10:14:06.880Z
Thanks @Raghav. Can you please tell whether bitcoin-core support derivation path other than m/0'/0'/i. Is there any possibility for m/1'/0'/i or m/k'/0/i' where k: 1,2,3....& so on ?
Jvd
CC BY-SA 4.0
2019-12-17T10:17:56.500Z
It does not, as far as I'm aware
Raghav Sood
CC BY-SA 4.0
2019-12-17T10:35:54.107Z
As far as i know bitcoincore support HD wallet creation but how we can create derivartion like m/1'/0' as m/0'/0' which is for default account 0 because i want to maintain user account in bitcoincore HD wallet.
Jvd
CC BY-SA 4.0
2019-12-17T10:43:24.740Z
You can't, you need to maintain a user->address mapping outside of bitcoind
Raghav Sood
CC BY-SA 4.0
2019-12-17T10:54:47.037Z
yes. that's true but how we can calculate unspent of user->address mapping outside of bitcoind from any node?
Jvd
CC BY-SA 4.0
2019-12-17T11:31:15.677Z
You can use the `scantxoutset` RPC method if you are operating a Bitcoin node, or use a database synced against a Bitcoin node such as ElectrumX or Bitcore
Raghav Sood
CC BY-SA 4.0
2019-12-17T12:36:24.670Z
Will check.Thanks @Raghav for the info.
Jvd
CC BY-SA 4.0
2019-12-16T23:51:14.157Z
2019-12-16T23:51:14.157Z
Raghav Sood
<p>Can we calculate unspent of addresses which are generated from other node server if we are having private/public key of those addresses?</p>

<bitcoin-core><address><balance><listunspent>
Calculate Unspent using private keys
Jvd
# Calculate Unspent using private keys

(Asked by: username_0 on 2019-12-16)

Can we calculate unspent of addresses which are generated from other node server if we are having private/public key of those addresses?

**Tags:** bitcoin-core, address, balance, listunspent


---

## 1 answers

### Answer by username_1 on 2019-12-16. Score: 1

If you have just a pair of private and public keys, you would need a little more information.

A single public key can control Bitcoin in a number of ways:

1. A direct p2pk output
2. A p2pkh output paying the hash of the public key
3. A p2sh output paying a script controlled by a set of public keys that may include keys other than the one you have
4. A p2wpkh segwit output paying the hash of the public key
5. A p2wsh output paying a script controlled by a set of public keys that may include keys other than the one you have

Without knowing which type of output you are looking for, the public key alone is not sufficient, especially for p2sh and p2wsh outputs where other keys are required to construct the address.

Once you know which output type to look for, you can use the `scantxoutset` RPC method of a node, or construct your own index similar to an explorer or Electrum server and query balances.

> **Comments:**
> **username_0**: Thanks @Raghav. Can you please tell whether bitcoin-core support derivation path other than m/0'/0'/i. Is there any possibility for m/1'/0'/i or m/k'/0/i' where k: 1,2,3....& so on ?  
> **username_1**: It does not, as far as I'm aware  
> **username_0**: As far as i know bitcoincore support HD wallet creation but how we can create derivartion like m/1'/0' as m/0'/0' which is for default account 0 because i want to maintain user account in bitcoincore HD wallet.  
> **username_1**: You can't, you need to maintain a user->address mapping outside of bitcoind  
> **username_0**: yes. that's true but how we can calculate unspent of user->address mapping outside of bitcoind from any node?  
> **username_1**: You can use the `scantxoutset` RPC method if you are operating a Bitcoin node, or use a database synced against a Bitcoin node such as ElectrumX or Bitcore  
> **username_0**: Will check.Thanks @Raghav for the info.  

---

