Skip to content

nortonlifelock/miningcore

 
 

Repository files navigation

Build status license

Miningcore 2.0 Stratum Pool

Miningcore running ubuntu

Changes in this Miningcore release

Upgrading to this version

If you already running a build with postgres database. You need to update you database.

In this release we use a new column "connectedworkers" in table "poolstats"

sudo wget https://raw.githubusercontent.com/FishyJoel/miningcore/master/src/Miningcore/DataStore/Postgres/Scripts/db_change_20210225.sql

sudo -u postgres -i
psql -d miningcore -f db_change_20210225.sql
exit

Features

  • Supports clusters of pools each running individual currencies
  • Ultra-low-latency, multi-threaded Stratum implementation using asynchronous I/O
  • Adaptive share difficulty ("vardiff")
  • PoW validation (hashing) using native code for maximum performance
  • Session management for purging DDoS/flood initiated zombie workers
  • Payment processing
  • Banning System
  • Live Stats API on Port 4000
  • WebSocket streaming of notable events like Blocks found, Blocks unlocked, Payments and more
  • POW (proof-of-work) & POS (proof-of-stake) support
  • Detailed per-pool logging to console & filesystem
  • Runs on Linux and Windows
  • Discord Channel preferred
  • Gitter Channel

Supported Coins

In our wiki we have a complete list of supported coins.

Checkout the coins list here

Running Miningcore on Windows

Running pre-built Release Binaries on Windows

  • Download miningcore-win-x64.zip from the latest Release
  • Extract the Archive
  • Setup the database as outlined below
  • Create a configuration file config.json as described here
  • Run dotnet Miningcore.dll -c config.json

Running Miningcore on Linux

wget https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-3.1
# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

# Update the package lists:
sudo apt-get update

# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql-12
  • Create the database config:
# login as postgres user
sudo -i -u postgres
psql
CREATE USER miningcore WITH ENCRYPTED PASSWORD 'some-secure-password';
CREATE DATABASE miningcore;
ALTER DATABASE miningcore OWNER TO miningcore;
ALTER USER postgres WITH PASSWORD 'new_password';
GRANT ALL privileges ON DATABASE miningcore TO miningcore;

list shows the databases and privileges like below:

\list
                               List of databases
    Name    |  Owner   | Encoding | Collate |  Ctype  |     Access privileges
------------+----------+----------+---------+---------+---------------------------
 miningcore | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =Tc/miningcore           +
            |          |          |         |         | miningcore=CTc/miningcore
 postgres   | postgres | UTF8     | C.UTF-8 | C.UTF-8 |
 template0  | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres              +
            |          |          |         |         | postgres=CTc/postgres
 template1  | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres              +
            |          |          |         |         | postgres=CTc/postgres
(4 rows)

# exit PostgresDB
\quit

# exit user postgres
$ exit					
  • Import Miningcore database tables
sudo wget https://raw.githubusercontent.com/FishyJoel/miningcore/master/src/Miningcore/DataStore/Postgres/Scripts/createdb.sql

sudo -u postgres -i
psql -d miningcore -f createdb.sql
exit
  • Advanced PostgreSQL Database setup

The following step needs to performed once for every new coin you add to your server or cluster. Be sure to replace all occurences of pools_id in the statement below with the id of your pool from your config.json file:

sudo -u postgres -i
psql -d miningcore
CREATE TABLE shares_pools_id PARTITION OF shares FOR VALUES IN ('pools_id');

!!! Do this for every Coin you add to you server. If you have multiple server, add it on every server !!!

EXAMPLE:

lookup for the pools id in you config.json file. In this example pools id is VerusCoin

  CREATE TABLE shares_VerusCoin PARTITION OF shares FOR VALUES IN ('VerusCoin');
  
  config.json:
  "pools": [
      {
        "id": "VerusCoin",
        "enabled": true,
        "coin": "VerusCoin",
        "address": "RE9v8tCKiALVmkWbirTKc5cZpSJtuXswJ8",
  • Coin Daemon (per pool)

  • Miningcore needs to be built from source on Linux.

    Example Ubuntu 20.04:

sudo apt-get update -y
sudo apt-get install git cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5
sudo git clone https://github.com/FishyJoel/miningcore
cd miningcore/src/Miningcore
dotnet publish -c Release --framework netcoreapp3.1  -o ../../build
  • Running Miningcore

    Create a configuration file config.json as described here

cd ../../build
dotnet Miningcore.dll -c config.json

Building on Windows

Download and install the .Net Core 3.1 SDK

git clone https://github.com/FishyJoel/miningcore
cd miningcore/src/Miningcore
dotnet publish -c Release --framework netcoreapp3.1  -o ..\..\build

Building on Windows - VISUAL STUDIO

Running a production pool

Running Miningcore

Follow below steps if setting poolservice for the first time or updating poolservice service script or profile.

- Update ConnectionString in poolservice.profile
- sudo cp poolservice.profile /etc/poolservice.profile
- sudo cp poolservice /etc/init.d/poolservice
- sudo chmod 755 /etc/init.d/poolservice
- sudo systemctl daemon-reload

Start/Stop service

sudo /etc/init.d/poolservice stop|start|status|restart

ShareRelay (ZeroMQ) needs .NET core 2.1 runtime

ZeroMQ is not supported in .NET core 3.1 and ShareRelay will fail

If you need ShareRelay support:

Install dotnet-sdk-2.1

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-2.1

Build pool in core2.1 framework

BUILDIR=${1:-../../build}
echo "Building into $BUILDIR"
dotnet publish -c Release --framework netcoreapp2.1 --runtime linux-x64 --self-contained true -o $BUILDIR

Feel free to discuss ideas/issues with fellow pool operators using our channels:
Discord Channel preferred
Gitter Channel

About

Miningcore a the multi-currency stratum-engine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 57.3%
  • C++ 22.7%
  • C# 16.3%
  • Assembly 3.5%
  • Shell 0.1%
  • CMake 0.1%