Author

Topic: Problems importing private key from paper wallet to bitcoin-qt (Read 776 times)

newbie
Activity: 14
Merit: 9
Thanks, you're the man! Very helpful!
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
You emphasize the before, importing an address cannot be done after funding the paper wallet?
Of course you can always import any watch-only address. The only benefit from doing it before funding it, is that you don't need a rescan.
If the address is funded already, any import requires a rescan to show an accurate balance. Importing unfunded watch-only addresses saves time, that's all.

Quote
And if I hold private keys with some UTXOs at the corresponding address in the bitcoin-qt wallet and one or several watch-only addresses as well and this is all intermingled together to a single balance, how can I differentiate what values are spendable from the bitcoin-qt wallet and what belongs to the paper wallets?
Bitcoin Core adds a new column "Watch-only", like this:
newbie
Activity: 14
Merit: 9
More questions to this:

2. Before funding a paper wallet, import the address (not the private key!) into Bitcoin Core:
    importaddress 1addy PaperWallet1addy false
    The "false" prevents a rescan. If you fund the paper wallet after this, it shows up as Watch-only and the balance is nicely updated. Since Bitcoin Core now knows your balance, you can later import the private key without a rescan.

You emphasize the before, importing an address cannot be done after funding the paper wallet?

And if I hold private keys with some UTXOs at the corresponding address in the bitcoin-qt wallet and one or several watch-only addresses as well and this is all intermingled together to a single balance, how can I differentiate what values are spendable from the bitcoin-qt wallet and what belongs to the paper wallets?

Thx!
newbie
Activity: 14
Merit: 9
Thanks for the tip, will try this!
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Why didn't the bitcoin-qt show that immediately after the rescan?
All I can think of is that somehow your Bitcoin Core wasn't synced completely. I've done this same procedure before, and it always worked out just fine.

I do have two recommendations for the future:
1. Use smaller amounts to get familiar with paper wallets. Instead of testing things with $800, use $2.
2. Before funding a paper wallet, import the address (not the private key!) into Bitcoin Core:
    importaddress 1addy PaperWallet1addy false
    The "false" prevents a rescan. If you fund the paper wallet after this, it shows up as Watch-only and the balance is nicely updated. Since Bitcoin Core now knows your balance, you can later import the private key without a rescan.
newbie
Activity: 14
Merit: 9
I used the debug window -> console to run the commands. The $key was fine and beginning with a 5 and the node was fully synced.

After a good nights sleep I opened my bitcoin-qt again and the display had changed.

Ok, originally I did the following:

Sent from my bitstamp account to bitcoin-qt:
0.29498000
received in bitcoin-qt:
0.29498000
where's the fee gone here? Why does this tx not show any fee?

Then sent to my paperwallet:
0.20000000
what cost me a fee of
0.00032399
this tx showing up in my bitcoin-qt as, well I don't remember exactly, I should have taken a screenshot
Anyway, there ended up on my paper wallet address
0.01967601
then I imported the private key as written in my OP and all that changed was the display of the paper wallet address as $label that I assigned when doing the import

Today, after ~12 hours I restarted the bitcoin-qt and now it shows the fee of the tx to the paper wallet as a payment to myself
-0.00032399
and the balance of my wallet is now
0.29465601

So everything adds up as it should. Why didn't the bitcoin-qt show that immediately after the rescan?

When I look at the tx of the "payment to myself" with "gettransaction" in the console, I see the fee, the amount on the paper wallet once as "spend" and once as "receive" and the address of the paper wallet.

So obviously everything is ok, I'm only confused, partially by my lack of understanding of bitcoin transactions, partially by the weird interface of bitcoin-qt.

Thanks for your help.

Edit:

Now I spent everything in my bitcoin-qt wallet to a new address making another payment to myself, just to be sure that bitcoin-qt really controls the paper wallet key, and the balance of the paper wallet is now zero on the blockchain explorer, and everything is moved to the new address (minus fee). So everything works as expected, except the bitcoin-qt UI, that's a bit weird.
HCP
legendary
Activity: 2086
Merit: 4361
Since that address is now part of your wallet after the import... Could it be that Bitcoin Core is now treating it as though you just sent the funds to yourself??

Does the "outgoing" transaction now show in the transaction list as type "Payment to yourself" with a net value of just the transaction fee? Something like this:



staff
Activity: 3458
Merit: 6793
Just writing some code
What are you using to run this command?

Are you sure that $key refers to the actual private key string? Does the private key begin with a '5', 'K', or 'L'?

Is Bitcoin Core fully synced?
newbie
Activity: 14
Merit: 9
For testing purposes I sent some BTC to a paper wallet from my bitcoin-qt client and later, after ~50 confirmations I imported the private key from the paper wallet back into bitcoin-qt with the command

Code:
importprivkey $key $label rescan

and after finishing the rescan it doesn't show anything. Well, almost nothing, it renamed the paperwallet address I sent to in the first place to "$label" in the outgoing transaction, but no other sign of the imported private key, especially the balance didn't change. The Blockchain explorer shows that the funds are still under the associated paper wallet address.

Can anybody explain why the funds don't show up under balance, what I did wrong, and how importing a private key into bitcoin-qt is done correctly?

Thanks!
Jump to: