<p>Modern wallets will pre-generate a lot of keys instead of generating them when you ask for them. For example, you might have used 10 addresses from your wallet, but your wallet actually has 110 addresses because it pre-generated 100 of them. When you ask for a new address, it gives you the oldest one it has pre-generated, and schedules to have a replacement for that address to be generated and added to the lookahead pool at a later time.</p>
<p>This serves two functions. When restoring a backup, your backup may be out of date and you may have used some of the pre-generated addresses. With the pre-generated addresses, your wallet can scan the blockchain for those addresses and be able to see all of your funds.</p>
<p>The second is when the private keys are encrypted. When a new key is generated, it will need to be encrypted, and so your passphrase will need to be provided. With the pre-generated lookahead pool, your wallet can retrieve a pre-generated address and provide it to you without needing to enter your passphrase. Then the next time you enter your passphrase, the lookahead pool can be topped up.</p>
<p>With that in mind, what happened is that exporting your private keys from Electrum also exported all of the keys that are in the pre-generated lookahead pool. These were then imported to Bitcoin Core. When you asked for a new address, an address was taken from the lookahead and so Bitcoin Core was able to see the transaction because the entire lookahead was imported. If you had imported private keys, you would have been able to spend those funds.</p>
<p>If you keep requesting addresses from Electrum, eventually you will reach a point where the lookahead at the time of your import to Bitcoin Core is exhausted and you will start getting addresses which Bitcoin Core does not know about.</p>

CC BY-SA 4.0
2022-05-04T03:58:54.237Z
That makes sense. There were about 100 of them; I didn't ask for 100 addresses, so Electrum must've pre-generated them.
Geremia
CC BY-SA 4.0
2022-05-03T23:39:51.193Z
2022-05-03T23:39:51.193Z
Ava Chow
<p>Using <code>importprvkey</code>, I imported all the private keys of an Electrum wallet into a Bitcoin Core wallet (courtesy the <a href="https://electrum2core.github.io/" rel="nofollow noreferrer">electrum2core</a> script; <a href="https://bitcoin.stackexchange.com/a/87438/4334">-tip: somedude</a>). Then, in Electrum, I created a new bech32 receiving address and sent funds to it. This address then appeared in the Bitcoin Core wallet, despite my not having run an <code>importprvkey</code> for this address's private key.</p>
<p>How did the Bitcoin Core wallet know about this address?</p>
<p>I spent from this address using Electrum. Could've I spent from it using Bitcoin Core, or not, because I don't have its corresponding private key in Bitcoin Core?</p>
<hr>
<p>Running <code>getaddressinfo</code> on the address returns</p>
<pre><code>&quot;solvable&quot;: true,
</code></pre>
<p><code>help getaddressinfo</code>:</p>
<pre><code>&quot;solvable&quot; : true|false,          (boolean) If we know how to spend coins sent to this address, ignoring the possible lack of private keys.
</code></pre>
<p>Could've I spent from that address, &quot;ignoring the possible lack of private keys&quot;?</p>

<bitcoin-core><electrum><segregated-witness><bech32-address>
How does Bitcoin Core know about a new address created in a different wallet?
Geremia
# How does Bitcoin Core know about a new address created in a different wallet?

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

Using `importprvkey`, I imported all the private keys of an Electrum wallet into a Bitcoin Core wallet (courtesy the [electrum2core](https://electrum2core.github.io/) script; [-tip: somedude](https://bitcoin.stackexchange.com/a/87438/4334)). Then, in Electrum, I created a new bech32 receiving address and sent funds to it. This address then appeared in the Bitcoin Core wallet, despite my not having run an `importprvkey` for this address's private key.

How did the Bitcoin Core wallet know about this address?

I spent from this address using Electrum. Could've I spent from it using Bitcoin Core, or not, because I don't have its corresponding private key in Bitcoin Core?

---

Running `getaddressinfo` on the address returns

```
"solvable": true,

```

`help getaddressinfo`:

```
"solvable" : true|false,          (boolean) If we know how to spend coins sent to this address, ignoring the possible lack of private keys.

```

Could've I spent from that address, "ignoring the possible lack of private keys"?

**Tags:** bitcoin-core, electrum, segregated-witness, bech32-address


---

## 1 answers

### Answer by username_1 on 2022-05-03. Score: 1 | Accepted answer

Modern wallets will pre-generate a lot of keys instead of generating them when you ask for them. For example, you might have used 10 addresses from your wallet, but your wallet actually has 110 addresses because it pre-generated 100 of them. When you ask for a new address, it gives you the oldest one it has pre-generated, and schedules to have a replacement for that address to be generated and added to the lookahead pool at a later time.

This serves two functions. When restoring a backup, your backup may be out of date and you may have used some of the pre-generated addresses. With the pre-generated addresses, your wallet can scan the blockchain for those addresses and be able to see all of your funds.

The second is when the private keys are encrypted. When a new key is generated, it will need to be encrypted, and so your passphrase will need to be provided. With the pre-generated lookahead pool, your wallet can retrieve a pre-generated address and provide it to you without needing to enter your passphrase. Then the next time you enter your passphrase, the lookahead pool can be topped up.

With that in mind, what happened is that exporting your private keys from Electrum also exported all of the keys that are in the pre-generated lookahead pool. These were then imported to Bitcoin Core. When you asked for a new address, an address was taken from the lookahead and so Bitcoin Core was able to see the transaction because the entire lookahead was imported. If you had imported private keys, you would have been able to spend those funds.

If you keep requesting addresses from Electrum, eventually you will reach a point where the lookahead at the time of your import to Bitcoin Core is exhausted and you will start getting addresses which Bitcoin Core does not know about.

> **Comments:**
> **username_0**: That makes sense. There were about 100 of them; I didn't ask for 100 addresses, so Electrum must've pre-generated them.  

---

