2024-12-18 11:58:07 +01:00
|
|
|
# END OF LIFE NOTICE
|
|
|
|
|
|
|
|
Several breaking changes have impacted the Flexpool.io backend resulting in the
|
|
|
|
[flexassistant](https://git.riou.xyz/jriou/flexassistant) project. The mining
|
|
|
|
companion has been archived on Sept 29, 2021.
|
|
|
|
|
2021-01-27 17:44:55 +01:00
|
|
|
# mining-companion
|
2021-01-22 17:55:39 +01:00
|
|
|
|
2021-01-27 17:44:55 +01:00
|
|
|
Cryptocurrency mining interest has raised recently due to high [Ethereum](https://ethereum.org/en/) profitability. You
|
|
|
|
can opt for the solo-mining path or use a **mining pool** to increase your chances to receive block rewards.
|
|
|
|
|
|
|
|
`mining-companion` is able to listen and notify for the following events:
|
|
|
|
* new **block** is mined by the mining pool
|
|
|
|
* unpaid **balance** is updated
|
|
|
|
* new **payment** has been sent by the mining pool
|
|
|
|
|
|
|
|
Notifications are sent via [Telegram Messenger](https://telegram.org/).
|
|
|
|
|
|
|
|
## Supported pools
|
|
|
|
|
|
|
|
* [Ethermine](https://ethermine.org/)
|
|
|
|
* [Flexpool.io](https://flexpool.io)
|
2021-01-22 17:55:39 +01:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo apt install python3-virtualenv
|
|
|
|
virtualenv venv
|
|
|
|
source venv/bin/activate
|
2021-01-27 17:44:55 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Pool libraries are loaded at execution time. For example, if you use only "flexpool" mining pool, you don't need to
|
|
|
|
install "ethermine" libraries. Requirements files have been splitted to install only libraries you need.
|
|
|
|
|
|
|
|
```
|
|
|
|
pip install -r requirements/base.txt
|
|
|
|
pip install -r requirements/ethermine.txt
|
|
|
|
pip install -r requirements/flexpool.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
To install all libraries at once:
|
|
|
|
|
|
|
|
```
|
2021-01-22 17:55:39 +01:00
|
|
|
pip install -r requirements.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
## Telegram bot
|
|
|
|
|
|
|
|
This [tutorial](https://takersplace.de/2019/12/19/telegram-notifications-with-nagios/) explains how to create a Telegram
|
|
|
|
bot. You'll need the `chat_id` and `auth_key` for the next section.
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
Configuration file use the JSON format with the following keys:
|
2021-01-27 17:44:55 +01:00
|
|
|
* `pools`: list of mining pools
|
|
|
|
* `miner`: wallet address of the miner
|
|
|
|
* `currency`: symbol of the currency to convert
|
|
|
|
* `telegram`: send notifications with Telegram
|
2021-01-22 17:55:39 +01:00
|
|
|
* `auth_key`: Telegram authentication key for the bot API
|
|
|
|
* `chat_id`: Telegram chat room id (where to send the message)
|
|
|
|
* `state_file`: persist data between runs into this file (default: `state.json`)
|
|
|
|
|
|
|
|
See [configuration example](config.example.json).
|
|
|
|
|
2021-01-27 17:44:55 +01:00
|
|
|
All options are optional (but the companion would do nothing).
|
2021-01-22 17:55:39 +01:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```
|
2021-02-12 09:43:38 +01:00
|
|
|
python3 companion/main.py --help
|
2021-01-22 17:55:39 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Contribute
|
|
|
|
|
|
|
|
Contributions are welcomed! Feel free to update the code and create a pull-request.
|
|
|
|
|
2021-02-12 09:43:38 +01:00
|
|
|
Be sure to lint the code and run tests before:
|
2021-01-22 17:55:39 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
docker build -t pre-commit .
|
|
|
|
docker run -it -v $(pwd):/mnt/ --rm pre-commit bash
|
|
|
|
# cd /mnt/
|
2021-02-12 09:43:38 +01:00
|
|
|
# pip install -r requirements.txt
|
2021-01-22 17:55:39 +01:00
|
|
|
# pre-commit run --all-files
|
2021-02-12 09:43:38 +01:00
|
|
|
# pytest
|
2021-01-22 17:55:39 +01:00
|
|
|
# exit
|
|
|
|
```
|