Bitcoin Forum
January 20, 2017, 10:06:26 PM *
News: Latest stable version of Bitcoin Core: 0.13.2  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Extracting Private Key - (java or rpc)  (Read 1162 times)
just_someguy
Full Member
***
Offline Offline

Activity: 125


View Profile
April 20, 2011, 03:54:51 PM
 #1

I'm developing a small bitcoin service and I've got everything working great except for one hangup: I can't for the life of me figure out how to programatically extract the private key from the wallet.
I looked at bitcoinj but it appears to use a different format than the standard client.
I'm pretty new to bitcoin so maybe I'm missing something obvious.
The only way I've been able to do this so far has been modifying bitcointools to show the whole address in a dump and parse it out by hand.
Is there code floating around to do this in java with the standard berkley db format?

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1484949986
Hero Member
*
Offline Offline

Posts: 1484949986

View Profile Personal Message (Offline)

Ignore
1484949986
Reply with quote  #2

1484949986
Report to moderator
1484949986
Hero Member
*
Offline Offline

Posts: 1484949986

View Profile Personal Message (Offline)

Ignore
1484949986
Reply with quote  #2

1484949986
Report to moderator
Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1036


View Profile WWW
April 20, 2011, 03:58:26 PM
 #2

I have a patch in my walletdump branch that can export and import private keys. It is still dangerous to do so, including a chance of corrupting your wallet if keys are used in several place at the same time.

See https://github.com/sipa/bitcoin/tree/walletdump

aka sipa, core dev team

Tips and donations: 1KwDYMJMS4xq3ZEWYfdBRwYG2fHwhZsipa
just_someguy
Full Member
***
Offline Offline

Activity: 125


View Profile
April 20, 2011, 04:05:05 PM
 #3

Unfortunately I would need it to work in java.
Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1036


View Profile WWW
April 20, 2011, 04:06:03 PM
 #4

It adds RPC calls dumpprivkey and importprivkey.

aka sipa, core dev team

Tips and donations: 1KwDYMJMS4xq3ZEWYfdBRwYG2fHwhZsipa
just_someguy
Full Member
***
Offline Offline

Activity: 125


View Profile
April 20, 2011, 04:22:01 PM
 #5

Oh... I see. So its a full client replacement?
Still not sure thats going to work for me but I appreciate it.
The service I'm developing has an end user component that needs access to the keys. Requiring a different client wouldn't be optimal but if thats the only choice I have I may go that way.

If anyone happens to have a pure java version I'd be willing to pay a small amount from my meager bitcoin collection.
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526


View Profile
April 20, 2011, 05:42:08 PM
 #6

What are you actually trying to achieve? Sipas patch gives you what you want if you've built software on top of the official BitCoin C++ software. If you want to stay in "pure java" land then BitCoinJ can help but as you note, it can't use the c++ clients wallets. Also if you want to buy/sell things with it, BitCoinJ is too immature for that at present. It's also dangerous to use if you aren't sure what you're doing.

You can just compile your own bitcoind with sipas patch and use a java json-rpc library.
just_someguy
Full Member
***
Offline Offline

Activity: 125


View Profile
April 21, 2011, 01:30:16 AM
 #7

You're right. I got it installed and works great. (No small feat since I'm just good enough at linux to be dangerous).
As far as what I'm doing: I'm feeding the keys into an elliptic curve function to encrypt something else.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!