I am in a special situation where I need to import my private key credentials and basically restore a wallet to bitcoind. bitcoind is running and I do have an rpc user/pass and server=1 in the bitcoind.conf, but no matter what I do, when I try and import the key I get the following error. There is no password nor encryption on the wallet.

root@coined:/home#  bitcoind importprivkey "5JxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxHjdCia9dt7" "root"
error: {"code":-4,"message":"Error adding key to wallet"}
  • Are there any useful messages in debug.log? Also, FYI, if you run this on the command line, your private key is probably now logged in your shell's history file (perhaps ~root/.bash_history). Feb 18, 2014 at 15:30
  • If you typed it up manually, you might have a typo in there or are missing a character? I once had a uppercase "S" instead of lowercase "s" in something and it took me forever to find it.
    – Murch
    Feb 19, 2014 at 10:23
  • @Murch copy/paste
    – dooode
    Feb 19, 2014 at 22:36

2 Answers 2


Without anything in the log, it's difficult to day. But here are a few suggestions what could try to find out the cause of the error:

  • Do you have write permission on the wallet.dat file in your .bitcoin directory?
  • Is the wallet locked with a passphrase? Then you need to unlock it (would probably give another error message but worth asking).
  • Did you set the disablewallet option either in command line or configuration file?
  • Is your wallet possibly locked due to a -reindex operation?

leave away the "" around the key (and the label)?

  • Same issue with or without the quotes.
    – dooode
    Feb 18, 2014 at 10:56
  • Not a trace of the error in /root/.bitcoin/debug.log :(
    – dooode
    Feb 18, 2014 at 20:05
  • I have tried with a new user as well.
    – dooode
    Feb 18, 2014 at 20:05

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.