I recently created a custom Public key (with vanitygen) and i would like to add the corresponding private key to my bitcoin-Qt wallet client. I have started bitcoin-Qt in server mode using:
$ open Bitcoin-Qt.app --args -server
And then issued the following commands, yet i cannot seem to successful add the private key, can anyone tell me what i am doing wrong?
$ curl --user bitcoinrpc --data-binary '{"method": "walletlock" }' http://127.0.0.1:8332/
Enter host password for user 'bitcoinrpc':
{"result":null,"error":null,"id":null}
$ curl --user bitcoinrpc --data-binary '{"method": "walletpassphrase", "params": ["************", 120] }' http://127.0.0.1:8332/
Enter host password for user 'bitcoinrpc':
{"result":null,"error":null,"id":null}
$ curl --user bitcoinrpc --data-binary '{"method": "walletpassphrase", "params": ["************", 120] }' http://127.0.0.1:8332/
Enter host password for user 'bitcoinrpc':
{"result":null,"error":{"code":-17,"message":"Error: Wallet is already unlocked."},"id":null}
$ curl --user bitcoinrpc --data-binary '{"method": "importprivkey", "params": ["************", "************"] }' http://127.0.0.1:8332/
Enter host password for user 'bitcoinrpc':
{"result":null,"error":{"code":-4,"message":"Error adding key to wallet"},"id":null}
So what happens is, when i try to decrypt my wallet it just says 'null' as a response. At first i thought it wasn't actually decrypting, but if i lock it and then try twice to decrypt it, it tells me "Error: Wallet is already unlocked".
Great! so it is unlocked and we should be able to now add the private key, but i just get error code -4 ? what is error -4 ? how do i make this work??