error: {"code":-4,"message":"Error adding key to wallet"} #3456

issue devilankur18 opened this issue on December 23, 2013
  1. devilankur18 commented at 3:51 AM on December 23, 2013: none

    I am not able to import a private key using the importpvtkey command. I tried with with and without passphase set, it always throw the error

    error: {"code":-4,"message":"Error adding key to wallet"}
    

    Here is the getinfo about my setup.

    {
        "version" : 80600,
        "protocolversion" : 70001,
        "walletversion" : 60000,
        "balance" : 0.00000000,
        "blocks" : 276480,
        "timeoffset" : -3,
        "connections" : 8,
        "proxy" : "",
        "difficulty" : 1180923195.25802612,
        "testnet" : false,
        "keypoololdest" : 1387767080,
        "keypoolsize" : 101,
        "paytxfee" : 0.00000000,
        "unlocked_until" : 1387806110,
        "errors" : ""
    }
    

    I am on ubuntu 12.04. Any suggestions ?

  2. laanwj commented at 6:03 AM on December 23, 2013: member

    What version of bitcoin? From the GUI or directly from RPC? Any more specific error in debug.log?

  3. devilankur18 commented at 6:20 AM on December 23, 2013: none

    @laanwj Bitcoind version 8.6.

    No error messages in the debug.log but there some messages related to flushing the wallet

    2013-12-23 02:57:03 ThreadRPCServer method=importprivkey
    2013-12-23 02:57:04 AcceptToMemoryPool: 178.63.190.234:8333 /Satoshi:0.8.2.2/ : accepted c055ddde27996e3eb4370b37f3018cc517c173f51ec4091f3dbad1e25fcb6367 (poolsz 112)
    2013-12-23 02:57:05 Flushing wallet.dat
    2013-12-23 02:57:05 Flushed wallet.dat 5ms
    
  4. devilankur18 closed this on Dec 23, 2013

  5. devilankur18 reopened this on Dec 23, 2013

  6. laanwj commented at 6:57 AM on December 23, 2013: member

    My guess is that your wallet is still locked somehow and that you need to unlock it. importprivkey does not check for the wallet to be locked and gives a weird error message if that is still the case (see #957, #3457).

    The only other cause of this error (AFAIK) would be a database problem with your wallet, so let's first completely rule out the wallet lock status.

  7. sipa commented at 10:15 AM on December 23, 2013: member

    The most common cause of this error message is actually that one already has the key imported.

    IIRC, git head has a specific message for that.

  8. laanwj commented at 10:18 AM on December 23, 2013: member

    Yes, there is a check for that nowadays. Didn't know that wasn't in 0.8.

  9. devilankur18 commented at 2:36 PM on December 23, 2013: none

    @laanwj, Originally when I tried, the wallet does not even have the passphasse, so there we can rule out the case of locked. Later I added passphase and tried. I have posted getinfo, it has unlock_until set to 1387806110 which shows wallet is unlocked. @sipa @laanwj In 8.6, there is no check for existing keys, but I have tried with different keys, none of them worked https://github.com/bitcoin/bitcoin/blob/0.8.6/src/rpcdump.cpp#L35-L78

  10. laanwj commented at 8:20 AM on May 28, 2014: member

    Does this still happen with 0.9.1?

  11. laanwj closed this on May 18, 2015

  12. MarcoFalke locked this on Sep 8, 2021
Labels

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-03 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me