<p>Recovering a wallet by scanning the entire blockchain isn't all that problematic. It might take a few hours, but it only needs to be done once when importing a wallet from backup. Also, while the blockchain size is indeed over 500 GB, you just need to look at output scripts to see if a transaction sends funds to your wallet, and then check whether or not a subsequent transaction spends an output from your wallet.</p>
<p>If you don't care about your transaction history and only want to know your current balance, you can just scan the UTXO set (which is a few gigabytes in size), though depending on what kind of backup you have you need to take the gap limit into account (otherwise you might fail to detect some funds).</p>
<p>If you use a light wallet like Electrum, the process of detecting your funds is delegated to an external service (such as an Electrum server), in which case you send it your addresses or an extended public key, not a private key. The service usually indexes output scripts (addresses) for fast lookup, meaning your backup can be restored in seconds, though possibly with a trust and privacy trade-off.</p>

CC BY-SA 4.0
2023-07-15T18:03:42.240Z
Can you elaborate on the method it uses? It can't possibly generate every address, how does it know if a specific transaction is to your wallet?
trex005
CC BY-SA 4.0
2023-07-15T18:23:21.670Z
Wallets typically derive keys (and subsequently addresses) from a master seed using BIP32. There are many resources on this topic, helpful search terms include "hierarchical deterministic wallet" and "extended public key".
Vojtěch Strnad
CC BY-SA 4.0
2023-07-15T11:42:28.407Z
2023-07-15T11:48:43.140Z
2023-07-15T11:48:43.140Z
Vojtěch Strnad
<p>I have tried searching for this answer but I must not know the right keywords or something because I can't find an explanation anywhere.</p>
<p>There are 2^96 addresses per private key and ~865,000,000 transactions.</p>
<p>If I have a private key and want to recover my transactions, it would seem that I would have to either scan the ~500GB Blockchain to see if any of my addresses are used, or if any of the transactions were encrypted by my private key.</p>
<p>Even if I had the Blockchain on my local machine, this would be an incalculable amount of math.</p>
<p>With wallet software, like electrum, where I don't have the Blockchain stored locally, I don't even see how it is possible.</p>
<p>Yet somehow, if I put my private key into wallet software it is able to recover all of my transactions.</p>
<p>How does it technically work? When I use a wallet like electrum, does it have to send my private key to some super computer somewhere?</p>

CC BY-SA 4.0
2023-07-15T11:29:39.987Z
There is only one public key per private key, and a few ways to turn a public key into an address. Many private keys can be generated from a seed or master key, though, but you never expand them all. Where does you number 2^96 come from?
Pieter Wuille
<blockchain><wallet><wallet-recovery>
Technically speaking, how are transactions recovered with a private key?
trex005
# Technically speaking, how are transactions recovered with a private key?

(Asked by: username_0 on 2023-07-15)

I have tried searching for this answer but I must not know the right keywords or something because I can't find an explanation anywhere.

There are 2^96 addresses per private key and ~865,000,000 transactions.

If I have a private key and want to recover my transactions, it would seem that I would have to either scan the ~500GB Blockchain to see if any of my addresses are used, or if any of the transactions were encrypted by my private key.

Even if I had the Blockchain on my local machine, this would be an incalculable amount of math.

With wallet software, like electrum, where I don't have the Blockchain stored locally, I don't even see how it is possible.

Yet somehow, if I put my private key into wallet software it is able to recover all of my transactions.

How does it technically work? When I use a wallet like electrum, does it have to send my private key to some super computer somewhere?

**Tags:** blockchain, wallet, wallet-recovery

> **Comments:**
> **username_1**: There is only one public key per private key, and a few ways to turn a public key into an address. Many private keys can be generated from a seed or master key, though, but you never expand them all. Where does you number 2^96 come from?  

---

## 1 answers

### Answer by username_2 on 2023-07-15. Score: 1

Recovering a wallet by scanning the entire blockchain isn't all that problematic. It might take a few hours, but it only needs to be done once when importing a wallet from backup. Also, while the blockchain size is indeed over 500 GB, you just need to look at output scripts to see if a transaction sends funds to your wallet, and then check whether or not a subsequent transaction spends an output from your wallet.

If you don't care about your transaction history and only want to know your current balance, you can just scan the UTXO set (which is a few gigabytes in size), though depending on what kind of backup you have you need to take the gap limit into account (otherwise you might fail to detect some funds).

If you use a light wallet like Electrum, the process of detecting your funds is delegated to an external service (such as an Electrum server), in which case you send it your addresses or an extended public key, not a private key. The service usually indexes output scripts (addresses) for fast lookup, meaning your backup can be restored in seconds, though possibly with a trust and privacy trade-off.

> **Comments:**
> **username_0**: Can you elaborate on the method it uses? It can't possibly generate every address, how does it know if a specific transaction is to your wallet?  
> **username_2**: Wallets typically derive keys (and subsequently addresses) from a master seed using BIP32. There are many resources on this topic, helpful search terms include "hierarchical deterministic wallet" and "extended public key".  

---

