3
I'd like to write a function in Java that takes a private key and generates the address to use in a QR code. I'd like to make this , but I'm not very good with the hashing algorithms.
I've checked with https://www.bitaddress.org and what is generated on there is not the same as what I'm getting in my program.
Can anyone help me with this? Google has failed me
But isn't that only the hash, and not the address? And I've tried using that library, it gives me errors, like java.lang.ClassNotFoundException: org.slf4j.LoggerFactory, which I'll have to find myself I guess :( – user1009013 – 2013-12-30T21:19:27.330
Sorry about that, you're right. See my edit.
I haven't used bitcoinj yet, so I'm afraid I can't help you with the installation. – jnnk – 2013-12-30T22:22:06.927
Everything should be included in the two jar files. Make sure you have bitcoinj.jar and bitcoinj-tools.jar in your classpath. The error you received sounds like bitcoinj-tools.jar is missing. – ScripterRon – 2013-12-31T01:49:08.947
1Yup you're right. And if anyone wants to see how I did this: Address address = new Address(NetworkParameters.prodNet(), Utils.sha256hash160(new ECKey(privkey, null).getPubKey())); Then toString() gives the readable address. – user1009013 – 2013-12-31T11:11:34.143