1

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?

1
  • 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? Jul 15, 2023 at 11:29

1 Answer 1

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.

2
  • 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
    Jul 15, 2023 at 18:03
  • 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". Jul 15, 2023 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.