Bitcoin Forum
December 10, 2016, 03:11:17 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Is this correct code to sending work to Bitcoin server?  (Read 359 times)
Taro Kudo
Newbie
*
Offline Offline

Activity: 6


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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!