Complete sources for a monero webminer.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

70 lines
1.7 KiB

<!DOCTYPE html>
<html>
<body>
<!--A TEXT FIELD-->
<div>
<textarea rows="4" cols="50" id="texta"></textarea> </div>
<!--A BUTTON-->
<div>
<button id="startb" onclick="start()">Start mining!</button>
</div>
<!--THE MINER SCRIPT-->
<script src="webmr.js"></script>
<script>
function start() {
document.getElementById("startb").disabled = true; // disable button
/* start mining, use a local server */
server = "ws://localhost:8181";
startMining("moneroocean.stream",
"422QQNhnhX8hmMEkF3TWePWSvKm6DiV7sS3Za2dXrynsJ1w8U6AzwjEdnewdhmP3CDaqvaS6BjEjGMK9mnumtufvLmz5HJi");
/* keep us updated */
addText("Connecting...");
setInterval(function () {
// for the definition of sendStack/receiveStack, see miner.js
while (sendStack.length > 0) addText((sendStack.pop()));
while (receiveStack.length > 0) addText((receiveStack.pop()));
addText("calculated " + totalhashes + " hashes.");
}, 2000);
}
/* helper function to put text into the text field. */
function addText(obj) {
var elem = document.getElementById("texta");
elem.value += "[" + new Date().toLocaleString() + "] ";
if (obj.identifier === "job")
elem.value += "new job: " + obj.job_id;
else if (obj.identifier === "solved")
elem.value += "solved job: " + obj.job_id;
else if (obj.identifier === "hashsolved")
elem.value += "pool accepted hash!";
else if (obj.identifier === "error")
elem.value += "error: " + obj.param;
else elem.value += obj;
elem.value += "\n";
elem.scrollTop = elem.scrollHeight;
}
</script>
</body>
</html>