2

Importing a private using the debug console causes a crash, I always have to kill from shell the bitcoin-qt app and restart it. Is there any way to prevent this? Is there a way to import the private key into qt client from shell?

1
  • 1
    Which version are you using? On which operating system?
    – Emre K.
    Commented Jul 17, 2014 at 9:46

2 Answers 2

2

To supplement George's answer:

It would help if you would clarify what you mean by "crash" and describe exactly what happens. (To many people, "crash" means a segfault or similar abnormal termination, but it sounds like that's not what you mean.)

If the issue is that the program appears unresponsive, this is normal: it's a well-known annoyance (perhaps not exactly a bug) in bitcoin-qt. The program needs to rescan the transaction ledger (block chain) to find any previous transactions involving the newly imported address. Unfortunately, while doing so it does not accept input from the GUI, report its progress, or redraw its window, which makes it look like the program has hung. However, it should finish eventually if you don't kill it.

On my computer (laptop circa 2012 with SSD), rescanning takes 5-10 minutes. Depending on the performance of your computer and especially your hard drive, it could take substantially longer. I would give it at least an hour or two before assuming it is really hung. You may also be able to see in your system's status monitor that the bitcoin-qt client is using CPU and/or doing disk I/O, which should indicate it is still working on the rescan.

As George suggests, you can disable the rescan using the rescan=false option. However, this is usually not a good idea. If you do so, bitcoin-qt will not know about any previous transactions on this address; in particular, if the address contains coins, bitcoin-qt will not know about this, will not update your balance to include them, and will not let you spend them. Since the most common reason to import a private key is to claim coins that it contains, this would defeat the purpose.

If you know the address has never been used before (e.g. it is a vanity address you have just generated), then it is fine to use rescan=false, since there are no previous transactions to be found.

If you have several private keys to import, you can use rescan=false for all but the last one, to save time. When a rescan is done, it searches for transactions for all addresses in the wallet, both old and new. You can also force a rescan later by quitting bitcoin-qt and restarting it with the -rescan flag; again, it will appear to be hung for a while as it rescans, and the GUI window may not appear until it is done.

1
  • That's a great explanation.
    – user11221
    Commented Aug 21, 2014 at 23:46
1

Importing a private key causes a rescan (so that the correct balance will be displayed in your wallet once the import is through), which can make the UI unresponsive until it completes, when executed through the debug console.

Importing your key(s) with rescan set to false should fix this:

importprivkey bitcoinprivkey label rescan=false

1
  • I'll be testing this as soon as possible, thanks! Commented Jul 20, 2014 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.