Skip to content
This repository

it's not obvious that wallet passphrase needs to be entered before importing a privkey #957

Closed
dooglus opened this Issue · 1 comment

2 participants

Chris Moore Sergey Sagan
Chris Moore

I was trying to import a private key into my wallet, and kept getting a generic error message:

$ bitcoind importprivkey $x mywallet
error: {"code":-4,"message":"Error adding key to wallet"}
$

I thought maybe the key I was using was in the wrong format, or that my wallet already had the key imported. But it turned out I just needed to supply the wallet passphrase first:

$ bitcoind walletpassphrase "$y" 60
$ bitcoind importprivkey $x mywallet
$

It would be better if the error message could be more specific: "Error adding key to locked encrypted wallet", for example.

If I try to add the key again, I get the same error message. This time I'd prefer to see "Key already exists in wallet".

Sergey Sagan

I also agree with this. The messages could be much more helpful.

Wladimir J. van der Laan laanwj closed this issue from a commit
Wladimir J. van der Laan laanwj Explicitly ensure that wallet is unlocked in `importprivkey`
This makes for a more useful error reply (fixes #957).
d78f35a
Luke-Jr luke-jr referenced this issue from a commit in luke-jr/bitcoin
Wladimir J. van der Laan laanwj Explicitly ensure that wallet is unlocked in `importprivkey`
This makes for a more useful error reply (fixes #957).
4175de7
Luke-Jr luke-jr referenced this issue from a commit in luke-jr/bitcoin
Wladimir J. van der Laan laanwj Explicitly ensure that wallet is unlocked in `importprivkey`
This makes for a more useful error reply (fixes #957).
869ea87
pooler pooler referenced this issue from a commit in litecoin-project/litecoin
Wladimir J. van der Laan laanwj Explicitly ensure that wallet is unlocked in `importprivkey`
This makes for a more useful error reply (fixes #957).

Rebased-from: 4175de7 0.8.x
878d5ef
Warren Togami wtogami referenced this issue from a commit in litecoin-project/litecoin
Wladimir J. van der Laan laanwj Explicitly ensure that wallet is unlocked in `importprivkey`
This makes for a more useful error reply (fixes #957).

Rebased-from: 4175de7 0.8.x
64885aa
Warren Togami wtogami referenced this issue from a commit in litecoin-project/litecoin
Wladimir J. van der Laan laanwj Explicitly ensure that wallet is unlocked in `importprivkey`
This makes for a more useful error reply (fixes #957).

Rebased-from: 4175de7 0.8.x
dab5519
Mathy Vanvoorden MathyV referenced this issue from a commit in reddcoin-project/reddcoin
Wladimir J. van der Laan laanwj Explicitly ensure that wallet is unlocked in `importprivkey`
This makes for a more useful error reply (fixes #957).

Rebased-from: 4175de7 0.8.x
d826acd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.