Code Monkey home page Code Monkey logo

privex / koinos-miner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from therealwolf42/koinos-miner

0.0 1.0 0.0 494 KB

The Koinos Miner (CLI) provides a functional command line interface that allows users to mine the KOIN ERC-20 which will be used to deliver an equitable initial token distribution on the Koinos blockchain.

Home Page: https://koinos.io

License: GNU General Public License v3.0

CMake 1.74% C 38.77% JavaScript 48.66% Dockerfile 0.28% Shell 10.54%

koinos-miner's Introduction

Koinos Miner

GitHub Issues GitHub License

Koinos Miner: Wolf Edition

This miner has been enhanced with some great features, you can read more about them under the section Getting Started.

For the official version from OpenOrchard, please go here.

OpenOrchard have given their green-light for the idea behind this miner version! ๐Ÿ‘ They, however, have not verified nor checked the code nor are they affiliated with this version. I am using it extensively myself, but there could be bugs.

Quickstart with Docker

Privex regularly publishes automated docker image builds to DockerHub under the image privex/koinos-miner - these are pre-built container images that can be downloaded in just 1 to 3 minutes on fast 100mbps+ connections that contain the mining software preinstalled and ready to use.

When you reference the image privex/koinos with Docker, it should automatically download it from DockerHub for you - no need to manually install it.

Using Docker, you should be able to run the miner on most platforms, needing only Docker itself installed.

# If you don't yet have Docker installed, you can install it on Ubuntu 18.04 / 20.04 from apt
apt update -qy
apt install -y docker.io

# You can specify your private key as an environment variable directly on the command line using '-e' for the fastest non-interactive
# setup. It may be more secure however, to keep the privateKey inside of a .env file.
# Replace the example private key (f3416...) and eth address (0x419b) with your own eth address and private key.
docker run -e privateKey=f3416f83f4b34379b6bcb50187f3f96171626540983958f01187f76f9c63a49c --name koinos --rm -itd privex/koinos-miner -a 0x419b2E6af0Ed913DB7acF54BbCbE62cea6880D2c --use-env

# Alternatively, you can store your private key in a .env file. Simply create a plain text file somewhere secure, for example,
# inside of the root user's home folder.
nano /root/koinos.env

# Add the following line to the file (replace xxxxxxx with your actual private key)
privateKey=xxxxxxxxxx

# Close and save the file by pressing CTRL-X
# Now we can use that env file with docker:
docker run --env-file /root/koinos.env --name koinos --rm -itd privex/koinos-miner -a 0x419b2E6af0Ed913DB7acF54BbCbE62cea6880D2c --use-env

# You can limit the number of CPU cores that the miner uses, by passing --cpus or --cpuset-cpus
# The below example limits the miner container to 4 cores - it may occasionally switch the cores that it uses,
# but will be limited to a maximum of 4 cores
docker run --cpus 4 --env-file /root/koinos.env --name koinos --rm -itd privex/koinos-miner -a 0x419b2E6af0Ed913DB7acF54BbCbE62cea6880D2c --use-env

# By using --cpuset-cpus we can restrict the miner to specific numbered CPU cores (starting from 0, meaning 0 is your first core)
# In the below example, the miner will be limited to cores 0 to 2 (0+1+2), 5, and 8 to 10 (8+9+10).
# This can be used to improve performance if you know certain cores are slower than others (e.g. thread cores on intel CPUs)
docker run --cpuset-cpus=0-2,5,8-10 --env-file /root/koinos.env --name koinos --rm -itd privex/koinos-miner -a 0x419b2E6af0Ed913DB7acF54BbCbE62cea6880D2c --use-env

To stop the miner:

docker stop koinos

To check the logs of the miner

docker logs --tail=100 koinos

To follow the logs in realtime as it prints them (hit CTRL-C to exit the log follower):

docker logs --tail=100 -f koinos

Table of Contents

Dependencies

Prior to installation, you'll need to install the necessary dependencies.

Linux (Debian based)

sudo apt-get install git cmake build-essential libssl-dev

macOS

On macOS, installing gcc is required to support OpenMP parallelization. Using the brew package manager, install OpenSSL and gcc.

brew install openssl gcc cmake

Windows

On Windows, ensure that you are using the MingW compiler and you have installed CMake. Using the cholocately package manager, install OpenSSL.

choco install openssl

Installation

For both Windows and Linux, you should be able to simply invoke the standard npm installer.

npm install

For macOS, you will need to specify the C compiler as gcc.

CC=gcc-10 npm install

For macOS, you also might need to set the correct openssl directory:

#1: Find your local ssl path (example: /usr/local/Cellar/[email protected] or /usr/local/Cellar/openssl)
#2: Open package.json, change "postinstall" to "postinstall:other" and "postinstall:osx" to "postinstall"
#3: Look at "postinstall" and change the ssl paths for "DOPENSSL_ROOT_DIR" and "DOPENSSL_LIBRARIES". The second path is the same as the first just with "/lib" at the end

Getting started

You can view the CLI miner arguments by using npm like so:

npm start -- --help

And get the following output:

โฏ npm start -- --help

> [email protected] start /path/to/koinos-miner
> node app.js "--help"

Usage: app [OPTIONS]...

Options:
  -v, --version                      output the version number
  -a, --addr <addr>                  An ethereum address
  -e, --endpoint <endpoint>          An ethereum endpoint (default: "wss://ropsten-rpc.linkpool.io/ws")
  -t, --tip <percent>                The percentage of mined coins to tip the developers (default: "5")
  -p, --proof-period <seconds>       How often you want to submit a proof on average (default: "86400")
  -k, --key-file <file>              AES encrypted file containing private key
  -m, --gas-multiplier <multiplier>  The multiplier to apply to the recommended gas price (default: "1")
  -l, --gas-price-limit <limit>      The maximum amount of gas to be spent on a proof submission (default: "1000000000000")
  -l, --gwei-limit <limit>           [NEW] The maximum amount of gas in gwei unit to be spent on a proof submission (default: "1000")
  -l, --gwei-minimum <minimum>       [NEW] The minimum amount of gas in gwei unit to be spent on a proof submission (default: "15")
  -s, --speed <speed>                [NEW] How fast should the transaction be: slow | medium | optimal | fast | fastest (default: "optimal")
                                     (https://fees.upvest.co/estimate_eth_fees)`
  --import                           Import a private key
  --export                           Export a private key
  --use-env                          [NEW] Use private key from .env file (privateKey=YOUR_PRIVATE_KEY)
  --wolf-mode                        [NEW] Using this option is going to reward 1% (or --tip if > 0) of your mined coins to the maintainer of this version
  -h, --help                         display help for command

Recipient Address: The --addr argument specifies the recipient address, this is where KOIN will be rewarded.

Ethereum Endpoint: The --endpoint argument specifies the Ethereum node to be used when querying contract information and submitting proofs.

Developer Tip: The --tip argument specifies the percentage of rewarded KOIN to donate to the development team, thank you!

Proof Period: The --proof-period argument specifies the number of seconds on average the miner will attempt to mine and submit proofs.

Speed [NEW]: The --speed arguments determines how fast should the transaction be: slow | medium | optimal | fast | fastest (https://fees.upvest.co/estimate_eth_fees) - (default: optimal => golden middle between medium and fast)

Gas Multiplier: The --gas-multiplier argument specifies a multiplier to apply to the calculated gas price. This can be used to get your proofs submitted when the Ethereum network gas fees are spiking or are unpredictable.

Gas Price Limit: The --gas-price-limit argument specifies a cap in the acceptable gas price for a proof submission.

Gwei Limit [NEW]: The --gwei-limit argument specifies a cap in the acceptable gas price (in gwei unit) for a proof submission.

Gwei Minimum [NEW]: The --gwei-minimum argument specifies the minimum amount of gas (in gwei unit) to be paid for a proof submission.

  • Info: --gwei-limit and --gwei-minimum were added later to make it easier, as gwei prices are simpler to read. To provide backwards compatability, --gas-price-limit is still supported and will be used if --gwei-limit is not set. However, --gwei-price-limit is recommended.
  • 1 Gwei = 1000000000 Gas (https://eth-converter.com/)
  • A more detailed explanation of the different miner configurations can be found in the Koinos GUI Miner README.md.

Key Management

The CLI miner provides the arguments --import, --export, and --key-file. These are used in handling the private key of the funding address. The user may import a private key and optionally store it in a key file in which case exporting the key is now possible.

If you know what you're doing, you can also use --use-env to get the key from an .env file:

echo privateKey=YOUR_PRIVATE_KEY | tee .env

Example Run

A simple example of running the miner:

โฏ npm start -- --endpoint http://mining.koinos.io --addr 0x98047645bf61644caa0c24daabd118cc1d640f62 --use-env --speed optimal --tip 5 --proof-period 20000 --gwei-minimum 30 --wolf-mode

> [email protected] start /path/to/koinos-miner
> node app.js "--endpoint" "http://mining.koinos.io" "--addr" "0x98047645bf61644caa0c24daabd118cc1d640f62" "--use-env" "--speed" "optimal" "--proof-period" "20000" "--gwei-minimum" "30" "--tip" "5" "--wolf-mode"

 _  __     _                   __  __ _
| |/ /    (_)                 |  \/  (_)
| ' / ___  _ _ __   ___  ___  | \  / |_ _ __   ___ _ __
|  < / _ \| | '_ \ / _ \/ __| | |\/| | | '_ \ / _ \ '__|
| . \ (_) | | | | | (_) \__ \ | |  | | | | | |  __/ |
|_|\_\___/|_|_| |_|\___/|___/ |_|  |_|_|_| |_|\___|_|
------------- Version 1.0.4 (Wolf Edition) -------------
--------------------------------------------------------

[JS](app.js) Mining with the following arguments:
[JS](app.js) Ethereum Receiver Address: 0x98047645bf61644caa0c24daabd118cc1d640f62
[JS](app.js) Ethereum Miner Address: 0x9d2DfA86488fSSF1f41bC02CE94C74Bb0dE47Da6
[JS](app.js) Ethereum Endpoint: http://mining.koinos.io
[JS](app.js) Proof every 6h (20000)
[JS](app.js) Open Orchard Developer Tip: 5%
[JS](app.js) Wolf Mode Engaged! Gracias!


License

Copyright 2020 Open Orchard, Inc.

Koinos Miner is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Koinos Miner is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Koinos Miner. If not, see https://www.gnu.org/licenses/.

koinos-miner's People

Contributors

brklyn8900 avatar mvandeberg avatar sgerbino avatar someguy123 avatar theoreticalbts avatar therealwolf42 avatar youkaicountry avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.