Author

Topic: How do I import privkeys if my blockchain is pruned? (Read 265 times)

member
Activity: 143
Merit: 82
There is the public server which can be used for the gettxoutproof RPC: https://bitcoinexplorer.org/rpc-terminal.

The gettxoutproof RPC result could also be obtained from: https://blockstream.info/api/tx/86639c0c9bdb83f467f2c07910367929171196c8907743a5915d555de5bc27eb/merkleblock-proof (replace 86639c0c9bdb83f467f2c07910367929171196c8907743a5915d555de5bc27eb with your txid in the URL).
member
Activity: 143
Merit: 82
There's a command that specifically designed for nodes with pruned blockchain to work with importprivkey with false rescan flag.
But the required arguments defeat the purpose since you'll need the blockchain to get them Tongue
That is:
Code:
importprunedfunds "rawtransaction" "txoutproof"

There is the Bitcoin Knots 27.1 with a patch that makes txoutproof argument optional instead of required: https://github.com/GregTonoski/bitcoin/releases/tag/v27.1.importprunedfunds-bypass.
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
What should I do if I need import a new private keys in my new wallet but my blockchain is pruned?
Private key is private key and you can import it to a Bitcoin full node or Bitcoin prune node wallet or with even SPV wallet too.
The issue was: it is pointless if he can't rescan for older transactions due to having a pruned blockchain.
It can be imported without triggering a rescan yes, but it wont be able to scan for transactions inside the already deleted blocks.
Check his second reply to see that his goal isn't just to import the private key.

Note: I used "was" because it may be solved already because there's no reply since OP posted that in 2021.
hero member
Activity: 1722
Merit: 801
What should I do if I need import a new private keys in my new wallet but my blockchain is pruned?
Private key is private key and you can import it to a Bitcoin full node or Bitcoin prune node wallet or with even SPV wallet too.

Full node, Prune node or SPV, it is only about how small or less, full or part of Bitcoin blockchain stored on your node and device to verify past Bitcoin blocks and UTXOs. If you don't have a Bitcoin full node, you will have to connect your wallet to servers and nodes that are not belong to you and rely on their operations to get blockchain data.

https://developer.bitcoin.org/reference/rpc/importprivkey.html

There is the public server which can be used for the gettxoutproof RPC: https://bitcoinexplorer.org/rpc-terminal.
https://developer.bitcoin.org/reference/rpc/gettxoutproof.html
member
Activity: 143
Merit: 82
There is the public server which can be used for the gettxoutproof RPC: https://bitcoinexplorer.org/rpc-terminal.
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
There's a command that specifically designed for nodes with pruned blockchain to work with importprivkey with false rescan flag.
But the required arguments defeat the purpose since you'll need the blockchain to get them :P
That is:
Code:
importprunedfunds "rawtransaction" "txoutproof"
Quote
importprunedfunds "rawtransaction" "txoutproof"

Imports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.

Arguments:
1. rawtransaction    (string, required) A raw transaction in hex funding an already-existing address in wallet
2. txoutproof        (string, required) The hex output from gettxoutproof that contains the transaction
To get the rawtransaction, use this online tool: https://chainquery.com/bitcoin-cli/getrawtransaction
To get the txoutproof, you need to ask someone with "-txindex" to use the command:
Code:
gettxoutproof "[\"TXID\"]"
TXID of the transaction that you want to import through importpunedfunds, you can include many as long as they all belong to the same block.

Use that complicated method to import the imported addresses' transactions to your wallet or disable pruning to use rescan.
HCP
legendary
Activity: 2086
Merit: 4363
What should I do if I need import a new private keys in my new wallet but my blockchain is pruned?
You either don't import new private keys... or you don't run in pruned mode. Attempting to do both is going to cause issues.

If you import to a pruned wallet, you will need to either rescan (which will require redownloading and reprocessing the entire blockchain) or accept that your wallet may not show an accurate transaction history/balance for that particular address or addresses.

If you think you're going to be importing private keys often (multiple times), get more storage and don't run pruned... or use a different wallet like Electrum that will allow you to import keys without storage/rescan penalty.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
What should I do if I need import a new private keys in my new wallet but my blockchain is pruned?
The trick is to import the address (watch-only) before it's funded. That way, your pruned Bitcoin Core keeps track of the balance already, and you can import the private key later. Use the option "false" for the rescan-flag when importing.
legendary
Activity: 3472
Merit: 3217
Playbet.io - Crypto Casino and Sportsbook

If I will turn off prune mode then I import privkeys and then I would to load blockchain and rescan that. Would I see history and able to see balance of the wallet after whole that steps?

Yes, it should show your balance after fully synced.

Are you sure that the wallet has a balance? Use some block explorer like this http://blockchain.com/ to check if that wallet has a balance before you proceed running a full node with Bitcoin core and import the private key.

If you don't know the BTC address of that wallet you can use this tool https://coinb.in/#verify download the page then turn off the internet and paste the private key.

It will show you the address of your private key. Now after that go to blockchain.com or here https://blockchair.com/ and then paste the address to check if it has a balance.
sr. member
Activity: 840
Merit: 254
I love BTC
You can't able to import privkey if it was pruned mode you need to disable pruned mode before you can import it then after you import you can enable pruned mode again.

The only problem it won't show the latest data like transaction history or the current balance of that wallet.

If your purpose is to make a transaction right away Electrum is the best choice without downloading or -rescan the whole blockchain.

If I will turn off prune mode then I import privkeys and then I would to load blockchain and rescan that. Would I see history and able to see balance of the wallet after whole that steps?
legendary
Activity: 3472
Merit: 3217
Playbet.io - Crypto Casino and Sportsbook
You can't able to import privkey if it was pruned mode you need to disable pruned mode before you can import it then after you import you can enable pruned mode again.

The only problem it won't show the latest data like transaction history or the current balance of that wallet.

If your purpose is to make a transaction right away Electrum is the best choice without downloading or -rescan the whole blockchain.
sr. member
Activity: 840
Merit: 254
I love BTC
What should I do if I need import a new private keys in my new wallet but my blockchain is pruned?

Jump to: