Author Topic: importprivkey error code -4  (Read 1150 times)

Zeroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
importprivkey error code -4
« on: April 23, 2017, 12:01:58 pm »
Hi,

I'm getting "Error adding key to wallet (code -4)" when I importprivkey?

Thanks,

Zeroth

georgem

  • Tech Admin
  • ******
  • Posts: 919
    • View Profile
Re: importprivkey error code -4
« Reply #1 on: April 23, 2017, 01:14:42 pm »
You can't import into an encrypted wallet, it needs to be unlocked.

Zeroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: importprivkey error code -4
« Reply #2 on: April 23, 2017, 03:10:55 pm »
Hi,

Thanks for your reply. I didn't think my wallet was encrypted as it was a fresh install. In trying to unlock it a few minutes ago I went to Settings > Encrypt Wallet and entered a password, but now I don't know how to unlock it? Would it have been locked after a fresh install? How do I unlock it now it's definitely locked?

Zeroth

georgem

  • Tech Admin
  • ******
  • Posts: 919
    • View Profile
Re: importprivkey error code -4
« Reply #3 on: April 23, 2017, 03:33:10 pm »
but now I don't know how to unlock it? Would it have been locked after a fresh install? How do I unlock it now it's definitely locked?

Zeroth

Well, once a wallet is in encrypted mode it isn't possible to turn it back to unencrypted (no password use).
The only thing you can do now is use your password to temporarily unlock it.

So, did the error -4 go away?

EDIT: if you want to go back to a fresh "no-password" wallet you would need to dump all your privkeys and import them into your fresh wallet.

Zeroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: importprivkey error code -4
« Reply #4 on: April 23, 2017, 05:53:51 pm »
I'm getting the same error with the wallet encrypted. The only place I could find to unlock the wallet was in the Vanity Gen tab. After doing that I'm still getting the same error... :(

Zeroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: importprivkey error code -4
« Reply #5 on: April 23, 2017, 05:57:34 pm »
My privkey begins 7S4... if that makes a difference.

georgem

  • Tech Admin
  • ******
  • Posts: 919
    • View Profile
Re: importprivkey error code -4
« Reply #6 on: April 23, 2017, 06:26:36 pm »
My privkey begins 7S4... if that makes a difference.

Yes that's correct.

georgem

  • Tech Admin
  • ******
  • Posts: 919
    • View Profile
Re: importprivkey error code -4
« Reply #7 on: April 23, 2017, 06:29:17 pm »
I'm getting the same error with the wallet encrypted. The only place I could find to unlock the wallet was in the Vanity Gen tab. After doing that I'm still getting the same error... :(

When in the debug console, use

Code: [Select]
walletpassphrase <password> <seconds>
to unlock your wallet for x seconds.

Zeroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: importprivkey error code -4
« Reply #8 on: April 23, 2017, 06:54:45 pm »
Thanks again but even after unlocking it successfully I'm getting the same error...

georgem

  • Tech Admin
  • ******
  • Posts: 919
    • View Profile
Re: importprivkey error code -4
« Reply #9 on: April 23, 2017, 07:13:33 pm »
So where does your private key come from?
Did you create it online somewhere (online wallet or something?)?
Or is it from the internal Vanitygen?

georgem

  • Tech Admin
  • ******
  • Posts: 919
    • View Profile
Re: importprivkey error code -4
« Reply #10 on: April 23, 2017, 07:18:08 pm »
Do you have your wallet on some encrypted harddrive?
Or on a shared network drive or something?

Zeroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: importprivkey error code -4
« Reply #11 on: April 23, 2017, 08:15:54 pm »
I've downloaded WalletGenerator.net onto an offline Raspberry Pi and used that to generate the keypair. I'm now testing it with small amounts of each coin. It's worked for most coins but I am having this issue with spreadcoin. I'm running the spreadcoin wallet on an Arch Linux laptop, no encryption or shared drives... I'm happy to give you both keys if that helps as it's only for testing purposes. But I want to be sure that if I keep a larger amount on a WalletGenerator address that I can get back my funds! Hope that makes sense.

georgem

  • Tech Admin
  • ******
  • Posts: 919
    • View Profile
Re: importprivkey error code -4
« Reply #12 on: April 23, 2017, 09:32:52 pm »
hm, so I went to https://walletgenerator.net/# and created an address twice and was able to import both of them without problems.

I suggest you stop any vanitygen activity within the wallet and restart your wallet, and try again.

Zeroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: importprivkey error code -4
« Reply #13 on: April 23, 2017, 09:45:12 pm »
Restarted laptop & wallet and still no luck... It must be something specific to my wallet then...
Do you think you could try importing this one, and if it works send the SPR to a new address from the WalletGenerator site and then send me the new privkey and I'll try that one?

Current pair is:
Se5opZ3aeq1BnnmVFRrJemSDbmXx31Vw5j
7S4cVRuGJ7zi8Xdgi4SwjWXe3LbQPbnGPiaKvMKKov1gbUTsedS

Zeroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: importprivkey error code -4
« Reply #14 on: April 24, 2017, 07:49:07 am »
I'll also try syncing the wallet on my Ubuntu PC and see if that works.