/winze.io

pool.winze.io: Open source Ethereum Mining Pool

Primary LanguageJavaScriptMIT LicenseMIT

winze.io

Open source Ethereum Mining Pool

This is the full source code of the Ethereum Mining Pool Winze.io. This project builds on the code written by karek314. The code is in PHP, except for one script which is in Python. The project is built to be efficient.

Installation

Setup on Linux

  1. Install all software mentioned above.
  2. Import database scheme
    misc>database_scheme.sql
  3. Copy this directory to /opt/pool/
  4. Link the website into Nginx http root: ln -s /opt/pool/mainpage/ /usr/share/nginx/html/
  5. Setup Nginx site in /etc/nginx/sites-enabled/*:
'mainpage' directory as public and if you need block /logs directory 'block_processing' locally 
  1. Move files
    nonce_fast.py and nonce.py
    from 'misc' directory to */pyethereum/ethereum/ (main directory of Pyethereum)
  2. Create config.php in the git root folder
<?php
return array(
  'host' => 'localhost',
  'username' => 'root',
  'password' => '',
  'bdd' => '',
  'BigInteger' => '/usr/share/nginx/html/BigInteger.php'
);

Withdraws

You can execute withdraws manually or add it as cron job

sudo php /usr/share/nginx/html/pool/block_processing/withdraw/index.php

crontab -e

* */12 * * * sudo php /usr/share/nginx/html/pool/block_processing/withdraw/index.php

This both scripts can be used to check if withdraws has been processed correctly or check if splited balance == real balance, it was mainly used while development process but it might be helpful.

sudo php /home/www4/block_processing/withdraw_check/index.php
curl http://127.0.0.1:9846/check/

Create Ethereum account

Create an Ethereum account, if you do not have one already. geth account new

Start Pool

Geth

  • Create a screen with: screen -S geth
  • Start the Ethereum daemon: geth --rpcaddr 127.0.0.1 --rpcport 8983 --rpc --unlock 0
  • Detach from the screen with: Ctrl+a d

Get Work from GETH Json RPC and cache it with memcached (reduces queries to geth rpc)

  • Create a screen with: screen -S process_work
  • cd /opt/pool
  • sudo php block_processing/process_work/index.php
  • Detach from the screen with: Ctrl+a d

Block Processing - this script handle block splitting and Proof of Work verification

  • Create a screen with: screen -S block_processing
  • cd /opt/pool
  • sudo php block_processing/index.php
  • Detach from the screen with: Ctrl+a d

This script updates data to calculate predicted mining rewards

  • Create a screen with: screen -S update_calculator
  • cd /opt/pool
  • sudo php block_processing/update_calculator/index.php
  • Detach from the screen with: Ctrl+a d

Used to process internal statistics and save to database

  • Create a screen with: screen -S stats
  • cd /opt/pool
  • sudo php block_processing/stats/index.php
  • Detach from the screen with: Ctrl+a d

Notes

withdraw_check and withdraw scripts saves logs in block_processing directory.
If you would like to debug mining proxy (mainpage/index.php)

$logstate = true;

But don't use it on production, it's quite heavy with many workers.

Make sure to setup valid permissions to allow php run python script and make sure that directory permissions are fine to save logs. Also please review python path in php files, but '/usr/bin/python' should be fine, other paths may be also necessary to review depending on where you put files!

Setting up pool revenue address and fee

block_processing/index.php
and make sure address exists as 'miner' in miners table.



You can easily access all background scripts by

screen -ls
then pick one by
screen -x INTEGER

#Contributing If you want to contribute, fork and pull request or open issue.

#License Entire PHP and Python code is under The MIT License (MIT)
Front-end(site theme) is used from http://themes.3rdwavemedia.com/website-templates/responsive-bootstrap-theme-web-development-agencies-devstudio/
Personally i own license, so better buy license or use your own front-end.