<p>The keypool (currently) is not an address pool, it does not hold individual addresses, it holds keys. Those keys are then converted to addresses when you want them. Because of this, you cannot import P2SH or P2WSH addresses into the keypool as you are trying to do.</p>

CC BY-SA 4.0
2019-07-17T01:10:30.930Z
2019-07-17T01:10:30.930Z
Ava Chow
<p>I'm trying to fill my wallet's internal/change address keypool by passing a multisig descriptor to <code>importmulti</code>, but the wallet's internal keypool is 0 before and after running the following shell script:</p>

<pre><code>keypoolinitial=$(bitcoin-cli -testnet getwalletinfo | jq -r '.keypoolsize_hd_internal')
echo "internal keypool initial: $keypoolinitial"

rawdescriptor="wsh(multi(2,tpubD6NzVbkrYhZ4YgUWMmeBh1b7hrYyHwXowUrMn3mQ6QRxJNaLiVEA3jGLJDdaSpzEMTCgNF2JRukSqUxEkgX3J8Mf8tMParwTWABsjFzTsUA/*,tpubD6NzVbkrYhZ4XaWhpCwqSPgdnmqHxjPksHjdt6sgsBmQ37ohNNUFnyykgstn1UTKz21SzdKM6C3V7qEiXHkeEKWRALWMb1am8voLW72ZXDr/*,tpubD6NzVbkrYhZ4X3DR4FgNdjBjmdxvnX2TjmbkoNWquXaXQz6uMfF7kUF6rsXA26vRMzW3WP4iQgP1A8gJCSYD47qAQbsCCtnvhtRiD57jAEw/*))"

descriptor=$(bitcoin-cli -testnet getdescriptorinfo $rawdescriptor | jq -r '.descriptor')

bitcoin-cli -testnet importmulti '[{"desc": "'$descriptor'", "timestamp": "now", "range": [0, 10], "watchonly": true, "keypool": true, "internal": true}]' &gt;&gt; /dev/null

keypoolfinal=$(bitcoin-cli -testnet getwalletinfo | jq -r '.keypoolsize_hd_internal')
echo "internal keypool final: $keypoolfinal"
</code></pre>

<p>Running it gives me:</p>

<pre><code>internal keypool initial: 0
internal keypool final: 0
</code></pre>

<p>But the same script works if I change the <code>rawdescriptor</code> line to use a simple P2PKH descriptor such as:</p>

<pre><code>rawdescriptor="pkh(tpubD6NzVbkrYhZ4YgUWMmeBh1b7hrYyHwXowUrMn3mQ6QRxJNaLiVEA3jGLJDdaSpzEMTCgNF2JRukSqUxEkgX3J8Mf8tMParwTWABsjFzTsUA/*)"
</code></pre>

<p>Then it outputs:</p>

<pre><code>internal keypool initial: 0
internal keypool final: 11
</code></pre>

<wallet><json-rpc>
Import multisig change addresses into Bitcoin Core using "importmulti" + descriptor
justinmoon
# Import multisig change addresses into Bitcoin Core using "importmulti" + descriptor

(Asked by: username_0 on 2019-07-16)

I'm trying to fill my wallet's internal/change address keypool by passing a multisig descriptor to `importmulti`, but the wallet's internal keypool is 0 before and after running the following shell script:

```
keypoolinitial=$(bitcoin-cli -testnet getwalletinfo | jq -r '.keypoolsize_hd_internal')
echo "internal keypool initial: $keypoolinitial"

rawdescriptor="wsh(multi(2,tpubD6NzVbkrYhZ4YgUWMmeBh1b7hrYyHwXowUrMn3mQ6QRxJNaLiVEA3jGLJDdaSpzEMTCgNF2JRukSqUxEkgX3J8Mf8tMParwTWABsjFzTsUA/*,tpubD6NzVbkrYhZ4XaWhpCwqSPgdnmqHxjPksHjdt6sgsBmQ37ohNNUFnyykgstn1UTKz21SzdKM6C3V7qEiXHkeEKWRALWMb1am8voLW72ZXDr/*,tpubD6NzVbkrYhZ4X3DR4FgNdjBjmdxvnX2TjmbkoNWquXaXQz6uMfF7kUF6rsXA26vRMzW3WP4iQgP1A8gJCSYD47qAQbsCCtnvhtRiD57jAEw/*))"

descriptor=$(bitcoin-cli -testnet getdescriptorinfo $rawdescriptor | jq -r '.descriptor')

bitcoin-cli -testnet importmulti '[{"desc": "'$descriptor'", "timestamp": "now", "range": [0, 10], "watchonly": true, "keypool": true, "internal": true}]' >> /dev/null

keypoolfinal=$(bitcoin-cli -testnet getwalletinfo | jq -r '.keypoolsize_hd_internal')
echo "internal keypool final: $keypoolfinal"

```

Running it gives me:

```
internal keypool initial: 0
internal keypool final: 0

```

But the same script works if I change the `rawdescriptor` line to use a simple P2PKH descriptor such as:

```
rawdescriptor="pkh(tpubD6NzVbkrYhZ4YgUWMmeBh1b7hrYyHwXowUrMn3mQ6QRxJNaLiVEA3jGLJDdaSpzEMTCgNF2JRukSqUxEkgX3J8Mf8tMParwTWABsjFzTsUA/*)"

```

Then it outputs:

```
internal keypool initial: 0
internal keypool final: 11

```

**Tags:** wallet, json-rpc


---

## 1 answers

### Answer by username_1 on 2019-07-17. Score: 4 | Accepted answer

The keypool (currently) is not an address pool, it does not hold individual addresses, it holds keys. Those keys are then converted to addresses when you want them. Because of this, you cannot import P2SH or P2WSH addresses into the keypool as you are trying to do.


---

