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

Closed
dooglus opened this Issue Mar 20, 2012 · 1 comment

2 participants

@dooglus

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".

@Serjster

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

@laanwj laanwj added a commit that closed this issue Dec 24, 2013
@laanwj laanwj Explicitly ensure that wallet is unlocked in `importprivkey`
This makes for a more useful error reply (fixes #957).
d78f35a
@laanwj laanwj closed this in d78f35a Dec 24, 2013
@luke-jr luke-jr added a commit to luke-jr/bitcoin that referenced this issue Feb 12, 2014
@laanwj laanwj Explicitly ensure that wallet is unlocked in `importprivkey`
This makes for a more useful error reply (fixes #957).
4175de7
@pooler pooler added a commit to litecoin-project/litecoin that referenced this issue Mar 26, 2014
@laanwj 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
@wtogami wtogami added a commit to litecoin-project/litecoin that referenced this issue Mar 27, 2014
@laanwj 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
@wtogami wtogami added a commit to litecoin-project/litecoin that referenced this issue Apr 4, 2014
@laanwj 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
@MathyV MathyV added a commit to reddcoin-project/reddcoin that referenced this issue May 9, 2014
@laanwj 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