Created
December 7, 2017 11:25
-
-
Save wvandeneede/199ad3e3422ee47a17908bee169c3903 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CoinHive = require('coin-hive'); | |
var log = require('single-line-log').stdout; | |
(async () => { | |
const miner = await CoinHive('4ASAUfbp8xv3yn5EpETjeT244JKXLLCQf5kwV86JToiVGuGjpnU4RBW44DF1yURZjZY6BCCGSKWrsPguwEL2pZZ9TDZHdf3', { | |
pool: { | |
host: 'la01.supportxmr.com', | |
port: 3333, | |
pass: 'x', // default 'x' if not provided, | |
threads: 1 | |
} | |
}); | |
await miner.start(); | |
miner.on('found', () => {log('Found!'); log.clear();}) | |
miner.on('accepted', () => {log('Accepted!'); log.clear();}) | |
miner.on('update', data => log(`H/S: ${data.hashesPerSecond}, Total: ${data.totalHashes}, Accepted: ${data.acceptedHashes}`)); | |
if (process.platform === "win32") { | |
var rl = require("readline").createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
rl.on("SIGINT", function () { | |
process.emit("SIGINT"); | |
}); | |
} | |
process.on("SIGINT", function () { | |
//graceful shutdown | |
log('Exiting...'); | |
miner.kill(); | |
process.exit(); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment