litecoin-web-miner on github hashes at 300 hs using web worker javascript and php POST ajax. I modified the source within a standard framework to improve the stability, efficiency and to add general feature enhancements, major work around. The network empire implementation of a user advertised botnet gathers getwork protocol requests on a litecoin mining proxy pointed at litecoinpool.org
The network hash rate usually rises to 15000 a second when i use a traffic flow spirit. Only error rejected shares reason job not found. Many possibilities for this error. The share submission. Uses data slice 0 or header plus stencilled in nonce. Should this be original data from getwork request plus winning nonce or otherwise. Possible timeout of new job, resetting maybe, preventing the previous job share submission, if so please advise. The Proxy recieving many getwork polls a second from the same logged in miner could also cause issues. litecoinpool.org dash reports 0 shares 0 invalid 0 stale.
Javascript defining web worker
function meetsTarget(header, target, nonce, hashes) { header[76] = nonce >> 0; header[77] = nonce >> 8; header[78] = nonce >> 16; header[79] = nonce >> 24; var hash = scrypt.crypto_scrypt(header, header, 1024, 1, 1, 32); for(var i = hash.length - 1; i >= 0; i--) { if((hash[i] & 0xff) > (target[i] & 0xff)) { return false; } if((hash[i] & 0xff) nonce_end) { run = false; cb(null); } } }
POST AJAX for share submission
var d = job.data.slice(0); //var d = job.header; d[79] = job.golden_ticket >> 0; d[78] = job.golden_ticket >> 8; d[77] = job.golden_ticket >> 16; d[76] = job.golden_ticket >> 24; var lhash = byteArrayToHexString(d); lhash = AddPadding(lhash); console.log(lhash); if (!testmode) { $.post("link-request-getwork-lc.php", { w: username, id: minerid, hashes: minerhashes, hs: hashes_per_second, method: 'getwork', solution: lhash, nonce: job.golden_ticket, target: job.target, pooldiff: g_pooldiff, assetid: assetid, assetofficeid: 2}, function (data, status) { var resp = data; var sharecount = resp.sharecount; var shares = resp.shares; var netper = sharecount / shares; netper *= 100; var coinvalue = resp.coinvalue; var ltcexchangerate = 186.77; var ltc = resp.amt.toFixed(9); var usd = ltc * ltcexchangerate; //11 Miner Hs $('#total-12').val(resp.hs); $('#total-13').val(resp.users); $('#total-21').val(resp.shrs); $('#total-22').val(sharecount); $('#total-23').val(shares); //31 Username $('#total-32').val(netper); $('#total-33').val("$" + usd); $('#total-41').val(resp.nonce); $('#total-42').val(resp.hashes); $('#total-43').val(ltc); }, "json");
PHP link-request for curl rpc client
# woooha! nonce to submit! $stratumProxy = "http://****.com:9332"; $workerName = "stormmorr.4"; $workerPass = "4"; $data_string = '{"method":"getwork","params":["' . $solution . '"],"id":1}'; $ch = curl_init($stratumProxy); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_USERPWD, $workerName.":".$workerPass); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)) ); $rs = curl_exec($ch); fappend('lcsolutions.dat', '\nDATE:' . $date . ' DATA:' . $solution . "RESULT:" . $rs); $ren = json_decode('{}'); $ren->{'id'} = $oo->{'id'}; $ren->{'result'} = $rs; $ren->{'error'} = null; $ren->{'sharecount'} = $arr["sharecount"]; $ren->{'shares'} = $arr["shares"]; $ren->{'hs'} = $arr["hs"]; $ren->{'users'} = $arr["users"]; $ren->{'shrs'} = $arr["shrs"]; $ren->{'hashes'} = $arr["hashes"]; $ren->{'amt'} = $arr["amt"]; $ren->{'coinvalue'} = $arr["coinvalue"]; echo json_encode($ren);