Code 4 Error - importing private key

I have set up a paper wallet with 10 ppc, and want to do a test import into my Peercoin desktop client

I have unlocked the client by typing walletpassphrase followed by my password - the padlock in the bottom right opened

I then typed importprivkey into the console line, followed by my paper wallet private key

However, I get the message "Error adding key to wallet (code -4)

According to this link (http://www.devtome.com/doku.php?id=Creating_and_Importing_Paper_Wallets), code 4 relates to the client being locked - but my client is unlocked

Help needed, thanks

The most likely is the key is already in the wallet.

try the old way using hte daemon in the daemon directory

ppcoind importprivkey ....

If you have hte address of the paperwallet you can check if the wallet already has it by (from memory)

validateaddress <the address>

either in the console or using the ppcoind

try closing the wallet, and starting it with ppcoin-qt --rescan

youll have to download the whole blockchain again, i think the client just didnt update for some reason (and ill have to change my tutorial, which im glad to see people getting use from)

The correct command would be:

walletpassphrase [yourpassphrase] 600

(This would unlock the wallet for 10 minutes, or 600 seconds)

If you added the word “true” to the end, then you’ve unlocked it for minting purposely only.

If you did not specify a time (like 600 seconds), then you may have unlocked it, and it automatically re-locked itself.

Once a wallet is properly unlocked, you should be able to just run the command:

walletpassphrase

(With no parameters, and you should get an error saying “the wallet is already unlocked”)

Many thanks - I have discovered that I got my test private key mixed up with a previous test private key - so, I was trying to import a private key that had already been imported ::slight_smile:

When I tried to import the new private key, it worked fine

[quote=“RobertLloyd, post:6, topic:2084”]Many thanks - I have discovered that I got my test private key mixed up with a previous test private key - so, I was trying to import a private key that had already been imported ::slight_smile:

When I tried to import the new private key, it worked fine[/quote]

Glad you got it figured out :slight_smile: