It should be noted that Google and ad blockers consider this script as a malware, so use this understanding in mind.

I recently heard this story from Buenos Aires where a Starbucks was caught extracting a cryptocurrency on client computers that were trying to connect to free WiFi. I've also recently launched a survey on Twitter asking people to allow sites to exploit crypto-currency on every page as an alternative to advertising. The most preferred advertising, but it encourages people to think about new types of advertising models.

All of this made me think about how a developer could implement the extraction of Bitcoin (or Ethereum or Monero, etc.) in a web page using JavaScript. It's super simple with coin-hive a utility created for Monero and other crypto-mining currencies!

Note: I definitely do not agree with the idea that you should exploit cryptocurrency on a visitor machine without their knowledge. This is a breach of trust, a discharge of their battery, a possible increase in their energy cost, etc.

CoinHive is a service so you will need to sign up for an account. You can explore their terms as you wish. Then you'll want to get the numismatic package:

npm install -g hive corner

You can now extract a small JavaScript extract from your local computer:

const CoinHive = require ("hive-room");

(async () => {
// create a minor
minor const = CoinHive wait (& # 39; YOUR_CONSE_COUPLE_COUPLE); // CoinHive website key

// Start the minor
wait for minor.start ();

// Listen to events
minor.on (& # 39 ;, Found), () => console.log (& # 39; Found! & quot;));
minor.on (& # 39 ;, ;,) => console.log (& # 39; Accepted! & # 39;));
minor.on (& # 39; update & # 39 ;, data =>
console.log (`
Hashes per second: $ {data.hashesPerSecond}
Total number of hashes: $ {data.totalHashes}
Accepted hash: $ {data.acceptedHashes}
`)
)

// stop the minor
setTimeout (async () => wait minor.stop (), 60000);
}) ();

This snippet will work in both Node.js and the browser. Coin-Hive also has command line support. The CoinHive web dashboard gives you a beautiful mertrie of what you have generated and won.

The process is pretty simple, but again, just because it's easy, it does not mean that it's something you should add to your public website without thinking too much about how to handle privacy issues Also consider that you need a large volume of mining to earn real money.

LEAVE A REPLY

Please enter your comment!
Please enter your name here