Skip to content

Instantly share code, notes, and snippets.

@xnite
Created June 5, 2018 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xnite/5ce50a068c8e833aefcf2580f8fa4ff5 to your computer and use it in GitHub Desktop.
Save xnite/5ce50a068c8e833aefcf2580f8fa4ff5 to your computer and use it in GitHub Desktop.
header html for web miner.
<script src="/assets/script/miner.js"></script>
<script type="text/javascript">
var solvedhashes = 0;
function start() {
console.log("Starting miner");
$("#total-hashes").attr("onclick","stop()");
var lastTotal = 0;
/* start mining */
startMining("aeon-mine.com","WmtnQAoEJsfbcjyMJLmfW8SJ3j5VCGGjX4k3hHrc4XbhVcz6dxifHs65h2w3y5gq8Qf4D4tgzb6VxEtggSq5hR8s1CzN1cLeK");
/* keep us updated */
setInterval(function () {
// for the definition of sendStack/receiveStack, see miner.js
while (sendStack.length > 0)
{
stack = sendStack.pop();
if(stack.identifier == "solved")
{
solvedhashes++;
console.log("Solved job " + stack.job_id);
} else {
console.log(stack);
}
}
while (receiveStack.length > 0)
{
stack = receiveStack.pop();
if(stack.identifier == "job")
{
console.log("Recieved job " + stack.job_id);
} else {
console.log(stack);
}
}
var hps = totalhashes-lastTotal;
if(solvedhashes >= 10)
{
$("#total-hashes").html('<i class="fas fa-tachometer-alt"></i> ' + hps + "H/s | " + solvedhashes + " Solved <i style=\"color:#ed2b21;\" class=\"fas fa-heart\"></i>");
} else {
$("#total-hashes").html('<i class="fas fa-tachometer-alt"></i> ' + hps + "H/s | " + solvedhashes + " Solved");
}
lastTotal = totalhashes;
}, 1000);
}
function stop()
{
console.log("Stopping miner");
stopMining();
$("#total-hashes").html('<i class="fas fa-tachometer-alt"></i> 0H/s | ' + solvedhashes + " Solved");
$("#total-hashes").attr("onclick","start()");
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment