<p>For modern &quot;descriptor&quot; wallets, you need to convert whatever you want to import to the <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md" rel="nofollow noreferrer">output descriptor language</a>, and import that using the <code>importdescriptors</code> RPC.</p>
<p>For an individual address, the descriptor is just <code>addr(ADDR)</code>, where <code>ADDR</code> is the address you want to import. The <code>importdescriptors</code> RPC requires descriptors to have a checksum, of the form <code>#CHECK</code>, where <code>CHECK</code> is the checksum. You can compute the necessary checksum using the <code>getdescriptorinfo</code> RPC.</p>

CC BY-SA 4.0
2023-04-21T22:11:00.917Z
bitcoin-cli -testnet  importDescriptors '[{"desc": "addr(tb1qxhx5gq5gwaju2lh0pxnp7....)", "timestamp": "now"}]' still fails. Error message is Method not found. Bitcoin Core RPC client version v24.0.1
att
CC BY-SA 4.0
2023-04-21T22:33:59.957Z
Do not capitalize the D in importdescriptors.
Pieter Wuille
CC BY-SA 4.0
2023-04-21T22:42:42.373Z
bitcoin-cli -testnet  importdescriptors '[{"desc": "addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)", "checksum": "h8rwjq0n", "timestamp": "now"}]'

[
  {
    "success": false,
    "error": {
      "code": -5,
      "message": "Missing checksum"
    }
  }
]
att
CC BY-SA 4.0
2023-04-21T22:49:52.100Z
I told you you need to compute and add the checksum, for example using `getdescriptorinfo`.
Pieter Wuille
CC BY-SA 4.0
2023-04-21T22:53:44.207Z
Got it. Changed it to bitcoin-cli -testnet - importdescriptors '[{"desc": "addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)#h8rwjq0n", "timestamp": "now"}]'
att
CC BY-SA 4.0
2023-04-21T22:55:40.807Z
The error message has changed to

  {
    "success": false,
    "error": {
      "code": -4,
      "message": "Cannot import descriptor without private keys to a wallet with private keys enabled"
    }
  }
]
att
CC BY-SA 4.0
2023-04-21T23:06:21.763Z
You'll need to create a wallet for watching, without private keys, using the `createwallet` RPC, and import into that.
Pieter Wuille
CC BY-SA 4.0
2023-04-21T23:17:01.947Z
Thank you! I'm able to import it into wallet test4. Then I deposited some testnet bitcoin into it. Should I supposed to see it with the `bitcoin-cli -testnet -rpcwallet=test4 listunspent `
att
CC BY-SA 4.0
2023-04-21T20:50:19.147Z
2023-04-21T20:50:19.147Z
Pieter Wuille
<p>Thank you @Pieter I'm able to import and segwit address into a wallet.</p>
<ul>
<li>Created a wallet without private keys.</li>
</ul>
<pre class="lang-bash prettyprint-override"><code>~$ bitcoin-cli -testnet createwallet test4 true
{
  &quot;name&quot;: &quot;test4&quot;,
  &quot;warning&quot;: &quot;&quot;
}
</code></pre>
<ul>
<li>Get descriptor info to obtain hash</li>
</ul>
<pre><code>~$ bitcoin-cli -testnet getdescriptorinfo &quot;addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)&quot;
{
 &quot;descriptor&quot;: &quot;addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)#h8rwjq0n&quot;,
 &quot;checksum&quot;: &quot;h8rwjq0n&quot;,
 &quot;isrange&quot;: false,
 &quot;issolvable&quot;: false,
 &quot;hasprivatekeys&quot;: false
}
</code></pre>
<ul>
<li>Imported the address</li>
</ul>
<pre class="lang-bash prettyprint-override"><code>~$ bitcoin-cli -testnet -rpcwallet=test4 importdescriptors '[{&quot;desc&quot;: &quot;addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)#h8rwjq0n&quot;, &quot;timestamp&quot;: &quot;now&quot;}]'
[
  {
    &quot;success&quot;: true
  }
]
</code></pre>
<p>After a couple of minutes, the testnet bitcoins I've sent to the address appeared in the wallet.</p>
<pre><code>bitcoin-cli -testnet -rpcwallet=test4 listunspent 
[
  {
    &quot;txid&quot;: &quot;c50321fa5a86a281882283b507f33529682158998d32bb335c125ed2e2b6e614&quot;,
    &quot;vout&quot;: 0,
    &quot;address&quot;: &quot;tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza&quot;,
    &quot;label&quot;: &quot;&quot;,
    &quot;scriptPubKey&quot;: &quot;001435cd4402887765c57eef09a61f0033ae8f4c3990&quot;,
    &quot;amount&quot;: 0.00001000,
    &quot;confirmations&quot;: 1,
    &quot;spendable&quot;: true,
    &quot;solvable&quot;: false,
    &quot;parent_descs&quot;: [
      &quot;addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)#h8rwjq0n&quot;
    ],
    &quot;safe&quot;: true
  }
]
</code></pre>

CC BY-SA 4.0
2023-04-21T23:14:35.003Z
2023-04-21T23:26:36.400Z
2023-04-21T23:26:36.400Z
att
<p>I must fetch utxos for a native segwit address from the local Bitcoin node.
First I wanted to import the segwit address. However, it fails.</p>
<p>How can I import a native segwit address? I'm using latest <code>bitcoind</code> version <code>240001</code></p>
<pre class="lang-bash prettyprint-override"><code># bitcoin-cli -testnet importmulti '[{&quot;scriptPubKey&quot;: {&quot;address&quot;: &quot;bc1qerwt7v72j0w70ezw09keaqzcsss.......&quot;}, &quot;timestamp&quot;: &quot;now&quot;}]'
error code: -4
error message:
Only legacy wallets are supported by this command
</code></pre>
<p>Thank you!</p>

<bitcoind><segregated-witness><importaddress><importmulti>
importmulti native segwit address to fetch utxos of p2wpkh native segwit address
att
# importmulti native segwit address to fetch utxos of p2wpkh native segwit address

(Asked by: username_0 on 2023-04-21)

I must fetch utxos for a native segwit address from the local Bitcoin node.
First I wanted to import the segwit address. However, it fails.
How can I import a native segwit address? I'm using latest bitcoind version 240001
# bitcoin-cli -testnet importmulti '[{"scriptPubKey": {"address": "bc1qerwt7v72j0w70ezw09keaqzcsss......."}, "timestamp": "now"}]'
error code: -4
error message:
Only legacy wallets are supported by this command

Thank you!

**Tags:** bitcoind, segregated-witness, importaddress, importmulti


---

## 2 answers

### Answer by username_1 on 2023-04-21. Score: 2 | Accepted answer

For modern "descriptor" wallets, you need to convert whatever you want to import to the [output descriptor language](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md), and import that using the `importdescriptors` RPC.

For an individual address, the descriptor is just `addr(ADDR)`, where `ADDR` is the address you want to import. The `importdescriptors` RPC requires descriptors to have a checksum, of the form `#CHECK`, where `CHECK` is the checksum. You can compute the necessary checksum using the `getdescriptorinfo` RPC.

> **Comments:**
> **username_0**: bitcoin-cli -testnet  importDescriptors '[{"desc": "addr(tb1qxhx5gq5gwaju2lh0pxnp7....)", "timestamp": "now"}]' still fails. Error message is Method not found. Bitcoin Core RPC client version v24.0.1  
> **username_1**: Do not capitalize the D in importdescriptors.  
> **username_0**: bitcoin-cli -testnet  importdescriptors '[{"desc": "addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)", "checksum": "h8rwjq0n", "timestamp": "now"}]'  [   {     "success": false,     "error": {       "code": -5,       "message": "Missing checksum"     }   } ]  
> **username_1**: I told you you need to compute and add the checksum, for example using `getdescriptorinfo`.  
> **username_0**: Got it. Changed it to bitcoin-cli -testnet - importdescriptors '[{"desc": "addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)#h8rwjq0n", "timestamp": "now"}]'  
> **username_0**: The error message has changed to    {     "success": false,     "error": {       "code": -4,       "message": "Cannot import descriptor without private keys to a wallet with private keys enabled"     }   } ]  
> **username_1**: You'll need to create a wallet for watching, without private keys, using the `createwallet` RPC, and import into that.  
> **username_0**: Thank you! I'm able to import it into wallet test4. Then I deposited some testnet bitcoin into it. Should I supposed to see it with the `bitcoin-cli -testnet -rpcwallet=test4 listunspent `  

---

### Answer by username_0 on 2023-04-21. Score: 1

Thank you @Pieter I'm able to import and segwit address into a wallet.

Created a wallet without private keys.

~$ bitcoin-cli -testnet createwallet test4 true
{
  "name": "test4",
  "warning": ""
}


Get descriptor info to obtain hash

~$ bitcoin-cli -testnet getdescriptorinfo "addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)"
{
 "descriptor": "addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)#h8rwjq0n",
 "checksum": "h8rwjq0n",
 "isrange": false,
 "issolvable": false,
 "hasprivatekeys": false
}


Imported the address

~$ bitcoin-cli -testnet -rpcwallet=test4 importdescriptors '[{"desc": "addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)#h8rwjq0n", "timestamp": "now"}]'
[
  {
    "success": true
  }
]

After a couple of minutes, the testnet bitcoins I've sent to the address appeared in the wallet.
bitcoin-cli -testnet -rpcwallet=test4 listunspent 
[
  {
    "txid": "c50321fa5a86a281882283b507f33529682158998d32bb335c125ed2e2b6e614",
    "vout": 0,
    "address": "tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza",
    "label": "",
    "scriptPubKey": "001435cd4402887765c57eef09a61f0033ae8f4c3990",
    "amount": 0.00001000,
    "confirmations": 1,
    "spendable": true,
    "solvable": false,
    "parent_descs": [
      "addr(tb1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvsfuejza)#h8rwjq0n"
    ],
    "safe": true
  }
]


---

