Pages:
Author

Topic: OSX Bitcoin-Qt private key (Read 7268 times)

legendary
Activity: 1358
Merit: 1002
September 17, 2012, 02:21:06 PM
#22
Then you are out of luck it seems. Can't install pywallet and bitcoin-qt doesn't work with a config file...

Is the config file text encoding UTF-8? I know for a fact Mac's like to fuck up text files with odd encodings. lol
I converted it to plain text, then changed the extension to .conf and the command went though perfectly.
Glad to hear it.  If I'm understanding correctly, bitcoin-qt will run properly with a .conf file in Mountain Lion? So it is safe for me to upgrade (at least regarding this particular issue).

Yes, as long as it is a real text file with a .conf extension. He had a .rtf file, which is a binary file, hence why Bitcoin-qt crashed.
legendary
Activity: 3472
Merit: 4801
September 17, 2012, 02:03:47 PM
#21
Then you are out of luck it seems. Can't install pywallet and bitcoin-qt doesn't work with a config file...

Is the config file text encoding UTF-8? I know for a fact Mac's like to fuck up text files with odd encodings. lol
I converted it to plain text, then changed the extension to .conf and the command went though perfectly.
Glad to hear it.  If I'm understanding correctly, bitcoin-qt will run properly with a .conf file in Mountain Lion? So it is safe for me to upgrade (at least regarding this particular issue).
legendary
Activity: 1358
Merit: 1002
September 17, 2012, 12:58:53 PM
#20
Then you are out of luck it seems. Can't install pywallet and bitcoin-qt doesn't work with a config file...

Is the config file text encoding UTF-8? I know for a fact Mac's like to fuck up text files with odd encodings. lol
legendary
Activity: 1358
Merit: 1002
September 17, 2012, 12:48:56 PM
#19
That's not to use pywallet. That's to use bitcoin-qt in server mode and pass it the commands using curl because there is no bitcoind for Mac.

Those instructions I gave to that other user were for him to avoid installing pywallet as he was having trouble installing it.
legendary
Activity: 1358
Merit: 1002
September 17, 2012, 12:31:34 PM
#18
I don't, but if you get this resolved, please post your resolution back here. I'll avoid upgrading to Mountain Lion until I'm sure this is going to work.

Bitcoin-Qt has worked fine on 10.8 for me.
It just crashes after I manually added the optional bitcoin.conf file so I can get pywallet working.

You don't need and you shouldn't have bitcoin running when messing with the wallet.dat using pywallet. Huh
Not sure what you're trying to do, but you're not doing it right.
legendary
Activity: 3472
Merit: 4801
September 17, 2012, 10:45:25 AM
#17
I don't, but if you get this resolved, please post your resolution back here. I'll avoid upgrading to Mountain Lion until I'm sure this is going to work.
legendary
Activity: 1358
Merit: 1002
June 27, 2012, 02:18:20 PM
#16
OK, glad it worked.
Edited my post to insert the correct command, as not to confuse anyone else Wink
legendary
Activity: 3472
Merit: 4801
June 27, 2012, 02:04:48 PM
#15
Good news and bad news.

Good news first.  It WORKED!  Hurray! Thanks so much for your help.

Bad news.  Even though it worked, I got odd results.

First to keep my password out of the terminal history I tried:
Code:
read x; curl --user testUser --data-binary '{"method": "walletpassphrase", "params": ["$x", "120"] }' http://127.0.0.1:8332/; unset x
and got
Code:
{"result":null,"error":{"code":-14,"message":"Error: The wallet passphrase entered was incorrect."},"id":null}
Even though I could see my passphrase where I typed it, and it was correct.

So then I tried:
Code:
curl --user testUser --data-binary '{"method": "walletpassphrase", "params": ["", "120"] }' http://127.0.0.1:8332/
Using my actual passphrase in place of , and I got
Code:
{"result":null,"error":{"code":-1,"message":"value is type str, expected int"},"id":null}

The only string I saw in the command where an INT might be expected was the "120", so I tried:
Code:
curl --user testUser --data-binary '{"method": "walletpassphrase", "params": ["", 120] }' http://127.0.0.1:8332/
And this time, oddly enough, I got
Code:
{"result":null,"error":{"code":-17,"message":"Error: Wallet is already unlocked."},"id":null}
Huh

So my best guess is that when I got the
Code:
{"code":-1,"message":"value is type str, expected int"}
error, it must have unlocked the wallet anyhow and just not set any timeout, because the "dumpprivkey" then worked.

Thanks again for all your help!  Hopefully this thread will be useful for many other OSX users.
legendary
Activity: 1358
Merit: 1002
June 27, 2012, 01:50:01 PM
#14
Try this:
Code:
curl --user testUser --data-binary '{"method": "walletpassphrase", "params": ["", 120] }' http://127.0.0.1:8332/
replacing with your walletpassphrase

and next
Code:
curl --user testUser --data-binary '{"method": "dumpprivkey", "params": ["1GrEBzpFfquAk81zaHnL8pKHRRn3kGHhD5"] }' http://127.0.0.1:8332/

When done,
Code:
curl --user testUser --data-binary '{"method": "walletlock"}' http://127.0.0.1:8332/
To lock the wallet again with the passphrase as it seems the timeout doesn't work quite well when unlocking, so better safe than sorry.

After all that you may wish to delete your terminal history or else the passphrase will be left in there.
http://www.mactricksandtips.com/2012/01/clear-terminal-history.html
legendary
Activity: 3472
Merit: 4801
June 27, 2012, 01:43:49 PM
#13
Ok, so if pywallet is the answer, then I guess my new question is: Can anyone help me get pywallet working in OSX Lion?

I understand that to run pywallet I need some libraries from MacPorts, and I understand the MacPorts website says that I'll also need Apple's Xcode Developer Tools.

I believe I've taken care of installing both, but when I try to run:

Quote
sudo port install python27 py27-twisted py27-pip py-bsddb python_select

I get the following error:

Quote
Error: Unable to open port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?

Any idea what I've done wrong?
legendary
Activity: 3472
Merit: 4801
June 27, 2012, 01:41:16 PM
#12
Your wallet is encrypted! You need to decrypt it before sending the commands Tongue
Yep see my original post here:
I'm using OSX Lion, and running Bitcoin-Qt 0.6.2.2 with an encrypted wallet.

But one thing I can say: pywallet will also not work on an encrypted wallet. Well, at least not before you decrypt it.

So this post in this thread was wrong/misleading?

Dump your keys from the wallet.dat file by using pywallet : https://bitcointalksearch.org/topic/pywallet-22-manage-your-wallet-update-required-34028 and running the command pywallet.py --dumpwallet  --password=PASSWORD

I took that to mean that pywallet would accept a PASSWORD parameter on the command line that would decrypt the private key in the wallet?

Nevermind, I see you already mentioned that.  So back to my question...
legendary
Activity: 1358
Merit: 1002
June 27, 2012, 01:20:58 PM
#11
Sign a message with that address, please. Tongue No need to take your word for it.
But looking at the blockchain.info page and seeing as it only received half a bitcent in there and never sent anything, it really is yours and not an address that happened to send you coins.

BTW, I was just joking about the message signing Wink

But I'm not joking about this: Your wallet is encrypted! You need to decrypt it before sending the commands Tongue
And given that there is no bitcoind on Mac I don't know of a way for you to do it on the Terminal.

This is the way to do it on linux:
Quote
Oh, you need to unencrypt your wallet temporarily so it can add the new key. I do the following, so my passphrase doesn't end up in my shell history. It unlocks the wallet for 60 seconds: read x; ./bitcoind walletpassphrase "$x" 60; unset x
From: http://bitcoin.stackexchange.com/questions/3530/how-to-import-a-private-key-to-an-encrypted-wallet-on-standard-client

Well, I guess it's time for you to figure out how to install pywallet Grin
You'll be able to give it the password to decrypt the wallet.
legendary
Activity: 3472
Merit: 4801
June 27, 2012, 01:14:04 PM
#10
Honestly, I'm surprised that the curl command would work without my encryption password.  That seems to me to be a serious security flaw if any malicious program could look up a password in bitcoin.conf and access the private keys in my wallet.  Are you sure there isn't a need to pass in the encryption password somehow?
legendary
Activity: 3472
Merit: 4801
June 27, 2012, 01:07:02 PM
#9
Are you sure you didn't paste a Bitcoin address taken from the Address Book, that is, a Bitcoin address that belongs to someone else and not to you?
Your addresses are listed on the "Receive Coins" separator only.

Yes, I double checked the address and it definitely was correct, but here is another I just copied and pasted.  You can verify on the blockchain that it is a valid address since I received coins there in the past (although I suppose you have to take my word for it that I own the address and it is in my wallet)

Command copied from my terminal and pasted into this post:

Code:
curl --user testUser --data-binary '{"method": "dumpprivkey", "params": ["1GrEBzpFfquAk81zaHnL8pKHRRn3kGHhD5"] }' http://127.0.0.1:8332/

Result copied from my terminal and pasted into this post:

Code:
{"result":null,"error":{"code":-4,"message":"Private key for address 1GrEBzpFfquAk81zaHnL8pKHRRn3kGHhD5 is not known"},"id":null}
legendary
Activity: 3472
Merit: 4801
June 27, 2012, 12:58:21 PM
#8

If you got that far, is already working but probably you didn't format your command correctly. Try this one:

Code:
curl --user username --data-binary '{"method": "getinfo"}' http://127.0.0.1:8332/

Ok, this is promising. I get the following:

Code:
{"result":{"version":60300,"protocolversion":60001,"walletversion":40000,"balance":,"blocks":186513,"connections":8,"proxy":"","difficulty":1726566.55919348,"testnet":false,"keypoololdest":1330757976,"keypoolsize":101,"paytxfee":0.00000000,"unlocked_until":0,"errors":""},"error":null,"id":null}

legendary
Activity: 1358
Merit: 1002
June 27, 2012, 12:25:07 PM
#7
Did you leave the quotation marks around the address? You should have left them there.

Example using the address I have on my signature, just replace it with yours.


Code:
curl --user --data-binary '{"method": "dumpprivkey", "params": ["1PKyq6aMKcCwn8cmb9Jc5SkNydLsQb5n7K"] }' http://127.0.0.1:8332/

EDIT: I tried without the quotation marks and it gave me the following error, so that wasn't your problem.
Code:
{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}

Are you sure you didn't paste a Bitcoin address taken from the Address Book, that is, a Bitcoin address that belongs to someone else and not to you?
Your addresses are listed on the "Receive Coins" separator only.
full member
Activity: 182
Merit: 100
June 27, 2012, 12:18:19 PM
#6

I was really hoping this was going to work.  It seemed so simple and useful.  Unfortunately, when I ran the curl command I got the following:

Quote
{"result":null,"error":{"code":-4,"message":"Private key for address
is not known"},"id":null}

Where
is a bitcoin address copied from Bitcoin-qt and pasted into the curl command.

If you got that far, is already working but probably you didn't format your command correctly. Try this one:

Code:
curl --user username --data-binary '{"method": "getinfo"}' http://127.0.0.1:8332/
legendary
Activity: 3472
Merit: 4801
June 27, 2012, 12:03:20 PM
#5

I was really hoping this was going to work.  It seemed so simple and useful.  Unfortunately, when I ran the curl command:
Quote
curl --user --data-binary '{"method": "dumpprivkey", "params": ["
"] }' http://127.0.0.1:8332/
I got the following:
Quote
{"result":null,"error":{"code":-4,"message":"Private key for address
is not known"},"id":null}

Where
is a bitcoin address copied from Bitcoin-qt and pasted into the curl command, and is the value I assigned to rpcuser in the bitcoin.conf
legendary
Activity: 1358
Merit: 1002
June 27, 2012, 11:45:59 AM
#4
legendary
Activity: 3472
Merit: 4801
June 27, 2012, 11:18:25 AM
#3
Ok, so if pywallet is the answer, then I guess my new question is: Can anyone help me get pywallet working in OSX Lion?

I understand that to run pywallet I need some libraries from MacPorts, and I understand the MacPorts website says that I'll also need Apple's Xcode Developer Tools.

I believe I've taken care of installing both, but when I try to run:

Quote
sudo port install python27 py27-twisted py27-pip py-bsddb python_select

I get the following error:

Quote
Error: Unable to open port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?

Any idea what I've done wrong?
Pages:
Jump to: