<p>The wallet is a Hierarchical Deterministic (HD) wallet. This means that the keys it generates from the initial seed are <a href="https://en.wikipedia.org/wiki/Pseudorandomness" rel="nofollow noreferrer">pseudo-random</a>, they look completely random but the sequence of keys can be completely replicated by starting with the same seed.</p>
<p>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.</p>
<p>This is why the restored wallet was able to find later transactions affecting your balance.</p>
<p>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.</p>
<p>See</p>
<ul>
<li><a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" rel="nofollow noreferrer">BIP-32</a></li>
<li><a href="https://github.com/bitcoin-wallet/bitcoin-wallet" rel="nofollow noreferrer">Bitcoin Wallet for Android - -source code</a></li>
<li><a href="https://bitcoinj.org/javadoc/0.14/org/bitcoinj/crypto/LinuxSecureRandom.html" rel="nofollow noreferrer">LinuxSecureRandom (Java)</a></li>
<li><a href="https://en.wikipedia.org/wiki//dev/random" rel="nofollow noreferrer">/dev/urandom</a></li>
</ul>

CC BY-SA 4.0
2022-05-29T19:21:09.107Z
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)
Amir reza Riahi
CC BY-SA 4.0
2022-05-29T19:38:28.707Z
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.
RedGrittyBrick
CC BY-SA 4.0
2022-05-29T19:00:40.880Z
2022-05-29T19:54:52.610Z
2022-05-29T19:54:52.610Z
RedGrittyBrick
<p>I've installed <a href="https://bitcoin.org/en/wallets/mobile/android/bitcoinwallet/" rel="nofollow noreferrer">bitcoin wallet</a> 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.</p>
<p>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?</p>
<p>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.</p>
<p>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.</p>

<wallet><private-key><backup><recover-private-key>
How does bitcoin wallet's backup restore forwarding transactions?
Amir reza Riahi
# How does bitcoin wallet's backup restore forwarding transactions?

(Asked by: username_0 on 2022-05-29)

I've installed [bitcoin wallet](https://bitcoin.org/en/wallets/mobile/android/bitcoinwallet/) 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.

**Tags:** wallet, private-key, backup, recover-private-key


---

## 1 answers

### Answer by username_1 on 2022-05-29. Score: 2 | Accepted answer

The wallet is a Hierarchical Deterministic (HD) wallet. This means that the keys it generates from the initial seed are [pseudo-random](https://en.wikipedia.org/wiki/Pseudorandomness), 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

* [BIP-32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
* [Bitcoin Wallet for Android - -source code](https://github.com/bitcoin-wallet/bitcoin-wallet)
* [LinuxSecureRandom (Java)](https://bitcoinj.org/javadoc/0.14/org/bitcoinj/crypto/LinuxSecureRandom.html)
* [/dev/urandom](https://en.wikipedia.org/wiki//dev/random)

> **Comments:**
> **username_0**: 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)  
> **username_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.  

---

