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 :)
#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.sqlNow please review all source files and setup valid mysql connection details
$mysqli=mysqli_connect('Mysql_server_ip','Database_username','Database_password','Database_name') or die("Database Error");
Copy all files to server
Setup nginx server blocks:
'mainpage' directory as public and if you need block /logs directory 'block_processing' locally
Also remeber to setup phpmyadmin with ssl, etc..
Now move files
nonce_fast.py and nonce.pyfrom '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
Push Enter key
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
Push Enter key
sudo php /var/www4/block_processing/process_work/index.php
Block Processing - this script handle block splitting and Proof of Work verification
screen
Push Enter key
sudo php /var/www4/block_processing/index.php
This script updates data to calculate predicted mining rewards
screen
Push Enter key
sudo php /var/www4/block_processing/update_calculator/index.php
Used to process internal statistics and save to database
screen
Push Enter key
sudo 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.phpand 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.
#Donate
Bitcoin -> 1MsCcLLzaZtgEiMsigFoRJjz149mPSoFKC
Ethereum -> 0x9284e52d64d888f2aa1bb62a38f3b5259487376a