Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Ploo on December 02, 2012, 11:03:06 PM



Title: Java Bitcoin Utils
Post by: Ploo on December 02, 2012, 11:03:06 PM
I'm looking for a simple library to handle basic bitcoin related calculations such as
- generating private keys
- calculating public keys
- calculating bitcoin addresses

I'm not looking for any actual bitcoin network interaction. I'm looking at bitcoinj opened but before I slim it down to the classes that are relevant to me I figured I'd ask and see if this is something that's already available.


Title: Re: Java Bitcoin Utils
Post by: gweedo on December 02, 2012, 11:24:38 PM
http://pastebin.com/raw.php?i=LuiDSmiN

I wrote this awhile ago, and it does all that, but does require the use of the bouncy castle dependencies


Title: Re: Java Bitcoin Utils
Post by: apetersson on December 02, 2012, 11:28:41 PM
bitcoinJ is very simple for that:

Code:
new ECKey().toAddress(NetworkParameters.prodNet())


Title: Re: Java Bitcoin Utils
Post by: Mike Hearn on December 03, 2012, 12:02:38 AM
Just take the ECKey, Address and VersionedChecksummedBytes classes from bitcoinj and you have what you need. They don't depend on other parts of the library.


Title: Re: Java Bitcoin Utils
Post by: grau on December 03, 2012, 09:28:16 PM
So you have a choice:

https://github.com/bitsofproof/supernode/blob/master/src/main/java/com/bitsofproof/supernode/core/AddressConverter.java

https://github.com/bitsofproof/supernode/blob/master/src/main/java/com/bitsofproof/supernode/core/ECKeyPair.java