Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: DannyHamilton on January 04, 2013, 05:12:24 PM



Title: Odd importprivkey behavior?
Post by: DannyHamilton on January 04, 2013, 05:12:24 PM
I'm not sure if this is:

  • A known issue with 0.7.1
  • Something I did wrong
  • Something I'm misunderstanding

In the Debug window Console, I entered:
Code:
importprivkey 5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF "This is a test"

Issue 1
After the client finished scanning the blockchain, the "This is a test" label showed up in the "Address Book" tab in my client?  I expected to see it in my "Receive coins" tab.

I selected the "This is a test" row from the "Address Book" and clicked the "Delete" button on the bottom of the window.  The "This is a test" row disappeared from the window as expected.

In the Debug window Console, I then entered:
Code:
dumpprivkey 1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj

I received the previously imported 5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF key as output.  I assumed that this means that the private key and address are still in my wallet even though the address no longer shows up in either the "Address Book" window nor the "Receive coins" window.  I figured maybe the client was recognizing the address the way it does a change address.

In the Debug window Console, I then entered:
Code:
listreceivedbyaddress 0 true

Issue 2
I expected this to list ALL addresses in my wallet.  However, I didn't see the 1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj in the list at all?

Any explanations as to what is going on here would be appreciated.


Title: Re: Odd importprivkey behavior?
Post by: CIYAM on January 05, 2013, 03:56:26 PM
Actually in playing around with the "raw tx's" API and then using "importprivkey" for an "offline" generated address I experienced a similar problem (didn't see the address in the "receive" list but did see the unspent output in the "listunspent" list).

I resolved my problem by sending another tx from the unspent output to another address that *was* in my "receive" list but still don't quite understand why the problem happened.


Title: Re: Odd importprivkey behavior?
Post by: 247saver on January 05, 2013, 05:20:10 PM
There's definitely something quirky.  I tried previously in the GUI and had to restart it sometimes to get the newly imported addresses to appear.


Title: Re: Odd importprivkey behavior?
Post by: rickylford on February 06, 2013, 12:16:41 AM
This is a semi-old thread, but I wanted to report to you all what happened to me.

I imported a private key, and as stated in the OP, it showed up in my "Address Book", not my "Receive Coins" list. Well, what I did was shut down the Bitcoin-QT client and re-opened it. When I re-opened it, it told me the wallet was out of sync, and after it finished getting IN sync (hahaha) it showed up in my "Receive Coins" list like I expected it to from the get-go.

I haven't tested sending money to it and sending money out of it, but I'll do that later on when I have enough coins to lost in case something goes wrong.


Title: Re: Odd importprivkey behavior?
Post by: Rygon on February 06, 2013, 08:11:12 PM
I've haven't used that function previous to 0.7.1, so I don't know if it's new. Same thing happened to me. Just had to restart bitcoin-qt before it showed up in the right spot. I figure that it adds it to the wallet.dat file, but doesn't re-import it to the program. Or something. It's on my growing list of user unfriendly features of Bitcoin-qt.


Title: Re: Odd importprivkey behavior?
Post by: PoorGirl on April 07, 2013, 06:35:30 PM
If a new private key is added it ends up in the address book first. Well, we see only its address.

When the next new block is received and processed that new address is scanned against the new block (transaction list) and the address moves to "receive coins".

Still a rescan is needed if that address has old coins sitting around as without a rescan you will never see them.