Bitcoin-QT 0.8.1 Windows client freezing when importing private-key. #2389

issue Herodes-otc opened this issue on March 20, 2013
  1. Herodes-otc commented at 3:39 AM on March 20, 2013: none
    Problem: Bitcoin-QT crash when importing a private key.
    
    Bug report.
    
    Bitcoin-QT version 0.8.1
    Windows version:  Windows 7 professional 32-bit
    Block-chain not downloaded completely - about 7K blocks left.
    
    Action that cause the issue:
    
    Help -> Debug window -> Console
    
    Write help to get info about commands.
    
    then
    
    
    importprivkey privatekeyhere labelhere
    
    or
    
    importprivkey privatekeyhere
    
    both makes the Debug window unresponsive when clicking it after the commands have finished. After clicking the X in the far right corner, windows says the program is non-responsive and asks if it should be shut down. I've tried waiting for a long time (several minutes) to see if it resolved itself, it didn't.
    
    However after forcing a closedown of the program through the windows close down feature, and restarting the bitcoin client, the address appears to have been imported just fine. I haven't tried to send or receive any coins with the imported adresses yet. But I assume that would work.
    
    When bitcoin-QT starts again, it takes a while and gives a message about verifying the block database integrity or something like that, I didn't note down exactly what it said.
    

    Could the reason be that the client is rescanning ? I didn't ask it to rescan.

  2. Diapolo commented at 12:07 PM on March 20, 2013: none

    Can you try what happens with this, when you are fully synced with the network and report back.

  3. Herodes-otc commented at 3:03 PM on March 20, 2013: none
    Bitcoin-QT running, sitting in Overview pane.
    
    Fully synched
    
    Help -> Debug Window -> Console
    
    Doing:
    
    importprivkey privkey label
    <enter>
    
    No error message or ok message shown.
    
    Closing Debug window
    
    Going to Receive coins pane, the adress I imported is not showing up.
    
    Closing down client.
    
    Client wouldn't shut down, so I forcefully shut it down with task-manager.
    
    Restarting Bitcoin-QT
    
    Message: Verifying block database integrity...
    
    Stands there for a while
    
    Client done loading, clicking on Receive coins
    
    The imported adress is now visible with the label I assigned to it.
    
    Tried to send some coins to the recently imported adress, shows up in the client immediately, so it works.
    
    Conclusion: This appears not to be a serious bug, and I'm aware that this 
    

    is something that's done through the

    Help -> Debug Window -> Console
    
    so perhaps it's not meant to be a streamlined process ?
    
    However - if this issue is not closed as a non-bug, I propose that when the blockchain 
    

    is not in synch, that the client is prevented from crashing in regards to this issue. Also it would be good to give some kind of feedback like 'Private key [key label] successfully imported', you may need to restart the client for it to be visible. Also the error message given when trying to importing the same private key twice gives an error message:

    Error adding key to wallet (code -4).
    
    Perhaps it would be possible to give a more human readable message that says: 
    

    "The private key for [bitcoinaddress] is already imported."

    I'm aware these are not serious issues, so let me know what you think.
    

    Forgive me for this poorly formatted message, I'm unfamiliar with the github issue system.

  4. Herodes-otc closed this on Mar 20, 2013

  5. Herodes-otc commented at 3:04 PM on March 20, 2013: none

    Hah - I managed to accidentally close the issue as well - well I reopened it now - I need input from others, please.

  6. Herodes-otc reopened this on Mar 20, 2013

  7. qubez commented at 6:39 PM on March 22, 2013: none

    Importing a private key does immediately start a rescan, which when executed through the debug console will make the UI unresponsive until it completes. This is so the new balance will be shown correctly after importing a key. A progress or busy indicator would be useful when Bitcoin is performing an operation, even if started via RPC, so users don't shut down Bitcoin-Qt while it is performing some database operation.

    There is an option that allows you to disable the automatic rescan, if for example you have many keys to import before you wish the rescan to happen.

    importprivkey <bitcoinprivkey> [label] [rescan=true]

  8. Viceroy commented at 2:59 AM on June 17, 2013: none

    Same problem.

    Windows Vista Sometime on import all is well. Sometimes on import the wallet freezes. Chain is up to date. v0.8.1-beta

    1 private key ! 2 private keys ! 3 priv ____ BREAK (not responding)

    force "close program"

    Looking for newer... now trying 8.2...

    Nope. Same problem. Locked up after the third import.

    So the solution is to wait? Is there any other way to import a batch of addresses? This seems awfully inefficient for a merchant.

  9. sipa commented at 9:02 AM on June 17, 2013: member

    After importing a new key, the blockchain is rescanned for missing transactions. This may take 10 minutes or so, depending on hardware. You can disable rescanning by passing an extra 'false' argument to the RPC call, so for example

    importprivkey 5wkf297rdkhviutt29423587y764928468725 false
    

    I've also been working on an "entire wallet" key export/import function, which would export all wallet keys to a file, or import such a file at once.

    May I ask why you need to import many keys, though?

  10. Viceroy commented at 3:19 PM on June 18, 2013: none

    So I've imported the private keys per sipa's method and while the solution worked perfectly I later realized that the addresses show up differently in my wallet that I had expected... they show up under the "addresses" tab. ;-)

    Perhaps I am not doing what I should be doing. My entire purpose is to create a new public address for each transaction the same way mt gox appears to do each time I deposit btc into my account. If the key system is any type of modulus system is it not true that a single private key could have many public solutions? If that is the case... how to I create a batch new public keys from the "original" private key within or outside my wallet? I would like to create:

    1publicaddress12345 1sumutherpublicaddress12345 1sumutherpublicaddress12346 1sumutherpublicaddress12347

    I expected these to show up under "Receive" so I'm now thinking that I wanted to create new public addresses from the existing key instead of new keys which seem to be called addresses. Is this right?

    My solution was to use vanitygen + import the newly pressed keys. But I don't think I want/need all the private keys. Thoughts? Better place to ask? (I don't need vanity addresses, just unique ones with a zero balance).

  11. sipa commented at 3:28 PM on June 18, 2013: member

    Every private key has exactly one corresponding public key and address.

    But why are you importing keys at all? Just do a getnewaddress every time you need a new receive address?

  12. Viceroy commented at 3:33 PM on June 18, 2013: none

    "Just do a getnewaddress every time you need a new receive address"

    This is the information I needed, thank you.

  13. laanwj commented at 11:04 AM on October 24, 2013: member

    Closing this as it appears to be sufficiently answered.

  14. laanwj closed this on Oct 24, 2013

  15. staplezjay commented at 2:34 PM on May 29, 2014: none

    how do i get my coins if i closed because i thought it froze

  16. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC