Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: wuzamarine on February 18, 2014, 04:16:01 AM



Title: error trying to import private key
Post by: wuzamarine on February 18, 2014, 04:16:01 AM
I am in a special situation where I need to import my private key credentials and basically restore a wallet to bitcoind. bitcoind is running and I do have an rpc user/pass and server=1 in the bitcoind.conf, but no matter what I do, when I try and import the key I get the following error.

root@coined:/home#  bitcoind importprivkey "5JxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxHjdCia9dt7" "root"
error: {"code":-4,"message":"Error adding key to wallet"}


Title: Re: error trying to import private key
Post by: Justin00 on February 18, 2014, 04:29:37 AM
Did you unlock wallet first ?


Title: Re: error trying to import private key
Post by: wuzamarine on February 18, 2014, 04:36:21 AM
Did you unlock wallet first ?

No, there is no password or encryption to unlock. Unless bitcoind throws a lock on by default I don't know about.


Title: Re: error trying to import private key
Post by: wuzamarine on February 18, 2014, 04:39:43 AM
Did you unlock wallet first ?

No, there is no password or encryption to unlock. Unless bitcoind throws a lock on by default I don't know about.

nope

root@coined:/home# bitcoind walletpassphrase "" 1000
error: {"code":-15,"message":"Error: running with an unencrypted wallet, but walletpassphrase was called."}


Title: Re: error trying to import private key
Post by: Justin00 on February 18, 2014, 04:41:17 AM
was looking on google quickly.. any chance the key is imported alrdy ?


Title: Re: error trying to import private key
Post by: wuzamarine on February 18, 2014, 11:24:12 AM
was looking on google quickly.. any chance the key is imported alrdy ?

It did import something, at one point the label 'dude' appeared (the label I was using) but the address was different and so was the private key. It's as though bitcoind said "well, you obviously want an address, no clue what you are doing with this one, we'll just make one up for you".

I have not been able to reproduce the step since with a new label 'dude2'.

Trying a different server now, maybe it's a local issue.


Title: Re: error trying to import private key
Post by: davidpbrown on February 18, 2014, 06:35:56 PM
I think there's something about the qt or daemon that requires the .conf file exists with rpc port, otherwise it doesn't import.

Check that in ~/.bitcoin or wherever for your OS, that there is a bitcoin.conf and that it contains detail of the form:

rpcuser=wuzamarine
rpcpassword=randomstringhereaosudhaiosdubaohbnqld
rpcport=8332
daemon=1


Title: Re: error trying to import private key
Post by: Localbtcbuyer on February 18, 2014, 06:37:26 PM
Can you just import into another client (blockchain.info, or maybe multibit), then send to your address?


Title: Re: error trying to import private key
Post by: davidpbrown on February 19, 2014, 09:01:14 PM
https://en.bitcoin.it/wiki/How_to_import_private_keys

> Bitcoin-QT does not enable its RPC interface by default. To enable it:

>   Close Bitcoin-QT and restart it with bitcoin-qt -server.


Title: Re: error trying to import private key
Post by: kroleg on February 20, 2014, 08:58:32 AM
to solve this problem you should unlock your wallet first


Title: Re: error trying to import private key
Post by: softron on February 27, 2014, 06:42:02 PM
Try using another wallet like electrum


Title: Re: error trying to import private key
Post by: roslinpl on February 27, 2014, 08:43:31 PM
indeed. Try to import those keys into another client...
seems strange if you did everything like it is explained above..

let us know what happend.

:) importing private keys is always a bit stressing :P isn't? :)


Title: Re: error trying to import private key
Post by: softron on February 28, 2014, 12:02:41 PM
Try
 
importprivkey <privkey> [label]