react-coinhive
Mine cryptocurrency in your browser. This uses Coin-Hive to mine Monero (XMR).
Installation
npm install --save react-coinhive
Usage
import React from 'react';import CoinHive from 'react-coinhive'; extends ReactComponent { return <CoinHive ="Maya" ="caP8U8pZXH6n0f53eV3fdpwOvpmTAD3C" = = = = /> }
Props
-
siteKey
: Your Coin-Hive Site Key. -
userName
: If used, the miner will be created withCoinHive.User(siteKey, userName)
. By default the miner is created withCoinHive.Anonymous(siteKey)
. -
src
: Source url of the js script minier. Requires a string. Default isCoinHiveClient.src.coinhive
('https://coinhive.com/lib/coinhive.min.js') Available default values :CoinHiveClientsrc =coinhive: 'https://coinhive.com/lib/coinhive.min.js'authedmine : 'https://authedmine.com/lib/authedmine.min.js'; -
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.
Disclaimer
I have nothing to do with coin-hive.com
.