5
3
I'm not entirely sure whether to ask this question on Bitcoin-SE or Stack Overflow, but I decided to post it here due to the direct relevancy of the question to Bitcoin and the general prominence of programming experience I have observed on Bitcoin-SE. If Bitcoin-SE is the incorrect place to post it, I apologize in advance; I'm new to SE and this was my best guess.
I'm attempting, in order to better understand how Bitcoin mining works, to code a simple Bitcoin CPU miner in Java, which I have some but not much experience with. All the online resources on JSON-RPC implementation in Java I have found have either been out of date and no longer functional or incomprehensible for someone with limited Java experience. How, in the most simplistic way possible, would I code a JSON-RPC getwork request (to a pool server) in Java and correctly parse the output into the variables required for mining?
Or you could use BitCoinJ.
– 0xcaff – 2014-02-06T17:26:36.160+1 This is the right forum to ask. (And bitcoinj would be a good place to implement this feature, not sure if they have it already). – Thilo – 2012-03-15T08:15:30.277
@Thilo Thanks, glad I posted it in the right place. BitcoinJ implements a client-only node; it won't process RPC requests of any sort. Good idea, but I'm afraid it won't do the job. – BinaryMage – 2012-03-16T01:15:28.430
It won't right now, but (at least) for an RPC client it should offer support one day (IMHO). – Thilo – 2012-03-16T02:00:19.307
Sorry if the "client-only node" was misleading; that's just what's stated on their Google Code page. I looked through the documentation and found nothing whatsoever on RPC. I agree it should implement RPC client support, but that doesn't mean it will. In any case, it doesn't currently. – BinaryMage – 2012-03-16T02:07:09.160
Yes, we can agree on that ;-) Please update this post with an answer of your own if you find out how to do RPC with Java (even if you have to hand-roll it with just the JDK libs). – Thilo – 2012-03-16T02:25:29.460