<p>Generally, the wallet shipped with Bitcoin Core only keeps copies of any transactions that directly involve the wallet. When you import a key, your node scans the entire blockchain to see if any transactions involved that key.</p>
<p>A pruned node has processed the whole blockchain, but only keeps the tail end of the data. This means that when you import a private key in a pruned node, the pruned node does not have the data to check for relevant transactions. That's why it is incompatible with the <code>rescan</code> requirement. To find the transactions related to the key, you will need to repeat the initial synchronization of the blockchain.</p>
<p>As <a href="https://bitcoin.stackexchange.com/a/99689/5406">Prayank already stated</a> in his answer, you could use</p>
<pre><code>importprivkey &quot;&lt;key&gt;&quot; &quot;&quot; false
</code></pre>
<p>to import one or multiple private keys. The &quot;false&quot; in the third argument skips the usual rescan triggered by the import. This should avoid the error you are seeing.</p>
<p>After you have imported all relevant keys, you restart your node with the <code>-reindex</code> commandline option to start over with the initial sync. Your wallet will scan for relevant transactions during the synchronization and rediscover the funds and transaction history of the wallet.</p>
<p>If you wish to avoid performing another synchronization with your node, you could instead import the key into a light-client such as Electrum as <a href="https://bitcoin.stackexchange.com/a/99682/5406">suggested by RedGrittyBrick</a> in another answer.</p>

CC BY-SA 4.0
2021-08-23T20:53:33.710Z
Should "getbalance" work before the full reindex is complete?  For example, if my imported private key received Bitcoin in 2010 and Bitcoin Core has finished reindexing up to 2011, should gebalance show the balance as of 2011?  This seems reasonable, but it's not the behavior I'm seeing and I'd like to avoid a long reindex to find out the import didn't work as expected.
Rich Remer
CC BY-SA 4.0
2021-08-23T21:06:11.213Z
Hi Rich, I asked here for you: https://bitcoin.stackexchange.com/q/108258/5406
Murch
CC BY-SA 4.0
2021-08-23T21:08:29.567Z
@RichRemer Ah, I realize that you are an experienced user from another site. You're asking a good question, please create a new topic. You can use the text of your comment verbatim for the question.--I've deleted the question I created, assuming that you will post one.
Murch
CC BY-SA 4.0
2024-02-11T21:50:08.643Z
Wondering is it theoretically possible for a pruned node to just scan for any UTXO for a private key without reindexing the entire chain? Seems like for any private key we import, we may not care about funds a private key used to have, only the funds it currently has. This seems like it might be a much faster tradeoff that is useful for most applications. Is there a reason bitcoin core does not have this option?
user1748155
CC BY-SA 4.0
2024-02-11T22:20:21.743Z
Does https://github.com/bitcoin/bitcoin/pull/15946 help this issue?
user1748155
CC BY-SA 4.0
2024-02-12T17:00:48.190Z
@user1748155: Only once https://github.com/bitcoin/bitcoin/issues/29183 also gets shipped
Murch
CC BY-SA 4.0
2024-03-31T09:17:23.513Z
try importprunedfunds after import.
foolbear
CC BY-SA 4.0
2020-11-05T14:09:00.657Z
2020-11-05T14:16:47.773Z
2020-11-05T14:16:47.773Z
Murch
<p>I think your choices are</p>
<ul>
<li>Restart your Bitcore-core node with adequate diskspace and pruning mode <em>disabled</em>, wait for it to sync all over again and then use <code>importprivkey</code> or</li>
<li>Import or sweep your private key into a different wallet such as Electrum. Optionally transfer the money back to your Bitcoin-core wallet. This might be quicker but you won't get the full transaction history back into Bitcoin-core</li>
</ul>

CC BY-SA 4.0
2020-10-28T01:41:01.587Z
Thanks for the response, I restared but I am not sure how to disable the pruning.
Rohan
CC BY-SA 4.0
2020-10-28T09:59:33.140Z
Check the configuration file
RedGrittyBrick
CC BY-SA 4.0
2020-10-27T23:49:11.537Z
2020-10-27T23:49:11.537Z
RedGrittyBrick
<p>Try this trick:</p>
<ol>
<li>Remove all local block data.</li>
<li>Disable Prune. Create a Wallet with disabled private keys(watch only) and disabled Descriptor. importaddress bcrt1xxxxx.</li>
<li>Enable prune, restart app, sync blockchains, keep trace its transcation. will show the balance.</li>
<li>Create a new legacy wallet, Importprivkey “***” false, will show the same balance.</li>
</ol>

CC BY-SA 4.0
2024-04-03T07:36:46.327Z
2024-04-03T07:48:06.780Z
2024-04-03T07:48:06.780Z
foolbear
<p>I am trying to restore my Bitcoin Core wallet, but I only have the private key and passphrase, I don't have a <code>wallet.dat</code> file.</p>
<p>I tried using</p>
<pre><code>importprivkey privatekey xxxxxxxxxxxxxxxxxxxx
</code></pre>
<p>which gave me the error <code>Rescan is disabled when blocks are pruned (code -4)</code>.</p>
<p>How can I import the key?</p>

<bitcoin-core><wallet-recovery><wallet.dat><pruning><rescan>
How can I import a private key into a pruned node?
Rohan
# How can I import a private key into a pruned node?

(Asked by: username_0 on 2020-10-27)

I am trying to restore my Bitcoin Core wallet, but I only have the private key and passphrase, I don't have a wallet.dat file.
I tried using
importprivkey privatekey xxxxxxxxxxxxxxxxxxxx

which gave me the error Rescan is disabled when blocks are pruned (code -4).
How can I import the key?

**Tags:** bitcoin-core, wallet-recovery, wallet.dat, pruning, rescan


---

## 3 answers

### Answer by username_1 on 2020-11-05. Score: 4

Generally, the wallet shipped with Bitcoin Core only keeps copies of any transactions that directly involve the wallet. When you import a key, your node scans the entire blockchain to see if any transactions involved that key.
A pruned node has processed the whole blockchain, but only keeps the tail end of the data. This means that when you import a private key in a pruned node, the pruned node does not have the data to check for relevant transactions. That's why it is incompatible with the rescan requirement. To find the transactions related to the key, you will need to repeat the initial synchronization of the blockchain.
As Prayank already stated in his answer, you could use
importprivkey "" "" false

to import one or multiple private keys. The "false" in the third argument skips the usual rescan triggered by the import. This should avoid the error you are seeing.
After you have imported all relevant keys, you restart your node with the -reindex commandline option to start over with the initial sync. Your wallet will scan for relevant transactions during the synchronization and rediscover the funds and transaction history of the wallet.
If you wish to avoid performing another synchronization with your node, you could instead import the key into a light-client such as Electrum as suggested by username_5 in another answer.

> **Comments:**
> **username_2**: Should "getbalance" work before the full reindex is complete?  For example, if my imported private key received Bitcoin in 2010 and Bitcoin Core has finished reindexing up to 2011, should gebalance show the balance as of 2011?  This seems reasonable, but it's not the behavior I'm seeing and I'd like to avoid a long reindex to find out the import didn't work as expected.  
> **username_1**: Hi Rich, I asked here for you: https://bitcoin.stackexchange.com/q/108258/5406  
> **username_1**: @RichRemer Ah, I realize that you are an experienced user from another site. You're asking a good question, please create a new topic. You can use the text of your comment verbatim for the question.--I've deleted the question I created, assuming that you will post one.  
> **username_3**: Wondering is it theoretically possible for a pruned node to just scan for any UTXO for a private key without reindexing the entire chain? Seems like for any private key we import, we may not care about funds a private key used to have, only the funds it currently has. This seems like it might be a much faster tradeoff that is useful for most applications. Is there a reason bitcoin core does not have this option?  
> **username_3**: Does https://github.com/bitcoin/bitcoin/pull/15946 help this issue?  
> **username_1**: @username_3: Only once https://github.com/bitcoin/bitcoin/issues/29183 also gets shipped  
> **username_4**: try importprunedfunds after import.  

---

### Answer by username_5 on 2020-10-27. Score: 0

I think your choices are

* Restart your Bitcore-core node with adequate diskspace and pruning mode *disabled*, wait for it to sync all over again and then use `importprivkey` or
* Import or sweep your private key into a different wallet such as Electrum. Optionally transfer the money back to your Bitcoin-core wallet. This might be quicker but you won't get the full transaction history back into Bitcoin-core

> **Comments:**
> **username_0**: Thanks for the response, I restared but I am not sure how to disable the pruning.  
> **username_5**: Check the configuration file  

---

### Answer by username_4 on 2024-04-03. Score: 0

Try this trick:

1. Remove all local block data.
2. Disable Prune. Create a Wallet with disabled private keys(watch only) and disabled Descriptor. importaddress bcrt1xxxxx.
3. Enable prune, restart app, sync blockchains, keep trace its transcation. will show the balance.
4. Create a new legacy wallet, Importprivkey “\*\*\*” false, will show the same balance.


---

