Bitcoin Forum
April 19, 2024, 11:14:52 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Extracting Private Key - (java or rpc)  (Read 1405 times)
just_someguy (OP)
Full Member
***
Offline Offline

Activity: 125
Merit: 100


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?

1713568492
Hero Member
*
Offline Offline

Posts: 1713568492

View Profile Personal Message (Offline)

Ignore
1713568492
Reply with quote  #2

1713568492
Report to moderator
1713568492
Hero Member
*
Offline Offline

Posts: 1713568492

View Profile Personal Message (Offline)

Ignore
1713568492
Reply with quote  #2

1713568492
Report to moderator
1713568492
Hero Member
*
Offline Offline

Posts: 1713568492

View Profile Personal Message (Offline)

Ignore
1713568492
Reply with quote  #2

1713568492
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713568492
Hero Member
*
Offline Offline

Posts: 1713568492

View Profile Personal Message (Offline)

Ignore
1713568492
Reply with quote  #2

1713568492
Report to moderator
1713568492
Hero Member
*
Offline Offline

Posts: 1713568492

View Profile Personal Message (Offline)

Ignore
1713568492
Reply with quote  #2

1713568492
Report to moderator
1713568492
Hero Member
*
Offline Offline

Posts: 1713568492

View Profile Personal Message (Offline)

Ignore
1713568492
Reply with quote  #2

1713568492
Report to moderator
Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1174


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

I do Bitcoin stuff.
just_someguy (OP)
Full Member
***
Offline Offline

Activity: 125
Merit: 100


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: 1072
Merit: 1174


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

It adds RPC calls dumpprivkey and importprivkey.

I do Bitcoin stuff.
just_someguy (OP)
Full Member
***
Offline Offline

Activity: 125
Merit: 100


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
Merit: 1128


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 (OP)
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
April 21, 2011, 01:30:16 AM
Last edit: April 21, 2011, 01:43:42 AM by just_someguy
 #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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!