1

I've installed bitcoin wallet on my phone and had some transactions. I backed up my wallet and after backing up did some other transactions. I supposed that the back up just would restore my wallet state until the back-up time. But when I restored my back-up the later transactions were loaded.

My question arises by noting the fact that for every time I want request bitcoin, my wallet generates a new address randomly (in fact it generates a randomly private-key and then using that private-key constructs the public-key and address). So my back-up should Only have private-keys which were generated until the back-up time. How it predicts the later private-keys?

I guess that it may have a fixed seed for generating random numbers and using that fixed seed it has a chain of random numbers but if this is true, it's not secure because by just stealing that seed, one can have all private-keys I would ever have in the future.

Though I'm not sure my background knowledge about bitcoin is correct or not. So if I have wrong assumptions let me know. Thanks in advance.

1 Answer 1

2

The wallet is a Hierarchical Deterministic (HD) wallet. This means that the keys it generates from the initial seed are pseudo-random, they look completely random but the sequence of keys can be completely replicated by starting with the same seed.

After restoring a wallet from backup, the software will generate keys and corresponding addresses in sequence and check each to see if it was involved in any transactions. They typically do so until they find a series of addresses with no transactions. The length of this is called the gap limit. After the number of unused addresses exceeds the gap limit the wallet will stop generating addresses.

This is why the restored wallet was able to find later transactions affecting your balance.

So you are completely right, the security of your money is completely dependent on the security of that seed number. The only truly important data in the wallet is the seed number. All other significant data can be recreated or obtained from other nodes.

See

2
  • how is that seed generated? is that really random? (I'm aware that truly random doesn't exist, I mean does it uses some other resources such as microphone or webcam to generate an unpredictable seed) Commented May 29, 2022 at 19:21
  • 1
    Typically the software will use libraries which provide a method of collecting randomness from a variety of sources available to the device. it might include noise from a microphone, fractional seconds since last power-on, or since last input device use, or any other essentially unpredictable events available on a specific device. Commented May 29, 2022 at 19:38

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.