https://github.com/x25/coinhive-stratum-mining-proxy
Browser mining on any pool using CoinHive.js library
https://github.com/x25/coinhive-stratum-mining-proxy
coin-hive coinhive mining mining-pool monero
Last synced: 16 days ago
JSON representation
Browser mining on any pool using CoinHive.js library
- Host: GitHub
- URL: https://github.com/x25/coinhive-stratum-mining-proxy
- Owner: x25
- License: mit
- Created: 2017-09-27T09:32:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-09T13:06:01.000Z (about 7 years ago)
- Last Synced: 2025-04-02T03:35:32.673Z (23 days ago)
- Topics: coin-hive, coinhive, mining, mining-pool, monero
- Language: Python
- Homepage:
- Size: 166 KB
- Stars: 267
- Watchers: 37
- Forks: 109
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CoinHive Stratum Mining Proxy
A proof of concept of web mining using CoinHive's [JavaScript Mining](https://coinhive.com/documentation/miner) library. The proxy acts like coin hive to connect to a mining pool. Should work with any monero pool based on the [Stratum Mining Protocol](https://en.bitcoin.it/wiki/Stratum_mining_protocol). You can even set up your [own pool](https://github.com/sammy007/monero-stratum).
Pros: no dev fee, adblock bypass, use any pool you like.
## Installation
Run on Docker ([docker hub repository](https://hub.docker.com/r/0x25/coinhive-stratum-mining-proxy/)):
```sh
$ git clone https://github.com/x25/coinhive-stratum-mining-proxy.git
$ cd coinhive-stratum-mining-proxy
$ docker build -t coinhive-stratum-mining-proxy .
$ docker run -p 8892:8892 coinhive-stratum-mining-proxy
```eg:
```sh
$ docker run -p 8892:8892 coinhive-stratum-mining-proxy xmr-eu1.nanopool.org 14444
```
Or install dependencies (```apt-get install ...``` or ```brew install ...```):- python
- python-dev
- pip
- openssl-dev
- gcc
- git
- musl-dev
- libffi-devand run on Linux/Mac box:
```sh
$ git clone https://github.com/x25/coinhive-stratum-mining-proxy.git
$ cd coinhive-stratum-mining-proxy
$ pip install -v -r requirements.txt
$ python coinhive-stratum-mining-proxy.py
```eg:
```sh
$ python coinhive-stratum-mining-proxy.py xmr-eu1.nanopool.org 14444
```## Usage
1. Install and Run `coinhive-stratum-mining-proxy`
2. Load the Coinhive Miner```html
```
The javascript can be saved/renamed and loaded from your server, see [adblock_bypass.html](https://github.com/x25/coinhive-stratum-mining-proxy/blob/master/static/adblock_bypass.html).
3. Change the ```CoinHive.CONFIG.WEBSOCKET_SHARDS``` config variable:
```html
CoinHive.CONFIG.WEBSOCKET_SHARDS = [["ws://localhost:8892/proxy"]];
```
4. Start Mining
```html
var miner = new CoinHive.Anonymous('YOUR_MONERO_ADDRESS');
miner.start();```
or```html
var miner = new CoinHive.User('YOUR_MONERO_ADDRESS', 'YOUR_WORKER_NAME');
miner.start();```
the username will be used as the stratum worker name (use only if your pool supports worker names).5. Profit!
## SSL/Secure WebSockets
Generate keypair:
```sh
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 100 -nodes
```Run script with ```--ssl=key.pem:cert.pem``` parameter:
```sh
python coinhive-stratum-mining-proxy.py --ssl=key.pem:cert.pem
```
If you use the Let's Encrypt generated certificates or if you see the error NET::ERR_CERT_AUTHORITY_INVALID in the browser, you should find the intermediate (a.k.a. chain.pem) certificates and run the script with ```--ssl=key.pem:cert.pem:chain.pem``` parameters.## Statistic
Simple stats are available at ```/stats``` route:
```sh
curl http://localhost:8892/stats?password=YOUR_PASS
{"total_hashes": 0, "uptime": 15.53, "clients": 1}
```No password by default, please run with ``--password=YOUR_PASS`` argument to setup password.
## Demo
Setup and run `coinhive-stratum-mining-proxy` with `xmr-eu1.nanopool.org 14444` parameters and open http://localhost:8892 in your browser for live demo.
## Links
- [JavaScript Miner API](https://coinhive.com/documentation/miner)
- [Solo mining stratum pool for Monero](https://github.com/sammy007/monero-stratum)## Disclaimer
This project is not endorsed by or affiliated with coinhive.com in any way.
## License
MIT