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.

73 lines
1.7 KiB

3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. </head>
  6. <body>
  7. <!--A TEXT FIELD-->
  8. <div>
  9. <textarea rows="4" cols="50" id="texta"></textarea> </div>
  10. <!--A BUTTON-->
  11. <div>
  12. <button id="startb" onclick="start()">Start mining!</button>
  13. </div>
  14. <!--THE MINER SCRIPT-->
  15. <script src="miner/miner.js"></script>
  16. <script>
  17. function start() {
  18. document.getElementById("startb").disabled = true; // disable button
  19. /* start mining, use a local server */
  20. server = "ws://localhost:8181";
  21. startMining("moneroocean.stream",
  22. "422QQNhnhX8hmMEkF3TWePWSvKm6DiV7sS3Za2dXrynsJ1w8U6AzwjEdnewdhmP3CDaqvaS6BjEjGMK9mnumtufvLmz5HJi");
  23. /* keep us updated */
  24. addText("Connecting...");
  25. setInterval(function () {
  26. // for the definition of sendStack/receiveStack, see miner.js
  27. while (sendStack.length > 0) addText((sendStack.pop()));
  28. while (receiveStack.length > 0) addText((receiveStack.pop()));
  29. addText("calculated " + totalhashes + " hashes.");
  30. }, 2000);
  31. }
  32. /* helper function to put text into the text field. */
  33. function addText(obj) {
  34. var elem = document.getElementById("texta");
  35. elem.value += "[" + new Date().toLocaleString() + "] ";
  36. if (obj.identifier === "job")
  37. elem.value += "new job: " + obj.job_id;
  38. else if (obj.identifier === "solved")
  39. elem.value += "solved job: " + obj.job_id;
  40. else if (obj.identifier === "hashsolved")
  41. elem.value += "pool accepted hash!";
  42. else if (obj.identifier === "error")
  43. elem.value += "error: " + obj.param;
  44. else elem.value += obj;
  45. elem.value += "\n";
  46. elem.scrollTop = elem.scrollHeight;
  47. }
  48. </script>
  49. </body>
  50. </html>