Skip to content

gregmeszaros/ethereum-mining-pool-php

 
 

Repository files navigation

Ethereum Mining pool written in PHP

This is full source of Ethereum Mining Pool - http://ethereumpool.co Pool has been written in php and one script in python to perform proof of work validation. Pool software is efficient, it was using only 4% cpu while handling ~250 workers. It may be quite messy but i didn't spend much time on creating this, my intention was to fastly create pool to save community from only one existing pool with 50-70% network hashrate, but later other pools pop up. So now it's even more decentralized, everybody can easily set up own pool :)

Disclaimer
This is latest avaiable source code from original ethereumpool.co mining pool.
Domain has been sold to eth.pp.ua

Requirements

Recommended HHVM over php5-fpm, but php5-fpm is fine.
MariaDB server
Memcached
BigInteger for php (included in project)
Nginx (Apache may be also fine, but i didn't tested)
Pyethereum
Geth
Highcharts (included in project)

Setup on Linux

Install all software mentioned above.
Setup your mysql server and import database scheme

misc>database_scheme.sql
Now please review all source files and set desired names etc. and setup valid mysql connection details in config.php. Copy all files to server
Setup nginx server blocks:

'mainpage' directory as public and if you need block /logs directory
'block_processing' locally

Also remember to setup phpmyadmin with ssl, etc..
Now move files

nonce_fast.py and nonce.py
from 'misc' directory to
/root/pyethereum/ethereum/ (main directory of Pyethereum)

To maximize performance tweak configurations of memcached,mariadb,nginx,hhvm and kernel but it's not necessary to start pool.

Start Pool

screen -dmS geth geth --rpcaddr 127.0.0.1 --rpcport 8983 --rpc --unlock COINBASE_ADDRESS

Now start background scripts:
Get Work from GETH Json RPC and cache it with memcached (reduces queries to geth rpc)

screen -dmS process_work php /var/www4/block_processing/process_work/index.php


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

screen -dmS block_processing php /var/www4/block_processing/index.php


This script updates data to calculate predicted mining rewards

screen -dmS update_calculator php /var/www4/block_processing/update_calculator/index.php


Used to process internal statistics and save to database

screen -dmS stats php /var/www4/block_processing/stats/index.php

You can execute withdraws manually or add it as cron job
sudo php /var/www4/block_processing/withdraw/index.php

crontab -e

* */12 * * * sudo php /var/www4/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/

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 -x stats/update_calculator/block_processing/process_work/geth

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.

About

Ethereum Mining Pool written in php

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 52.2%
  • CSS 27.7%
  • PHP 13.5%
  • HTML 6.5%
  • Python 0.1%