Author

Topic: Is this correct code to sending work to Bitcoin server? (Read 501 times)

newbie
Activity: 6
Merit: 0
Hi I am writing Bitcoin miner with Java for studying bitcoin technology.
But I am not sure this code is correct.
The code is to make getwork() sending data to RPC interface of bitcoind.

Code:
String num16 = Integer.toHexString(foundNonce);
String zero="";
for(int zi=0;zi<8-num16.length();zi++){
zero=zero+"0";
}
String senddata = originalData.substring(0,152) + zero + num16 + originalData.substring(160);

  • senddata is a string to send to bitcoind
  • foundNonce is a integer value of founded nonce
  • originalData is a data from bitcoind getwork() method

Thank you for your help.
Jump to: