Bitcoin Forum
May 28, 2024, 12:17:49 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Is this correct code to sending work to Bitcoin server?  (Read 489 times)
Taro Kudo (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
September 11, 2011, 07:36:41 AM
 #1

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.
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!