ethereum-mining-pool-php
ethereum-mining-pool-php copied to clipboard
First open source Ethereum mining pool written in php (slightly outdated)
Ethereum Mining pool written in PHP
This is full source of Ethereum Mining Pool - http://ethereumpool.co It has been written mostly in php, code is not bad, but needs some work, it runs fine on one decent dedicated server if it's not serving more than ~500 workers, for more it needs to be rewritten and split between more servers. It should be considered alpha code. Code is messy, my intention at time was to swiftly create pool to save community from only one existing pool with more than 3/4 network hashrate.
Disclaimer
This is latest avaiable source code from original ethereumpool.co mining pool.
Domain has been sold to eth.pp.ua
Requirements
Recommended HHVM, not mandatory, can be replaced with php-fpm
MariaDB server
Memcached
BigInteger for php (included in project)
Nginx
Pyethereum
Geth
Setup on Linux
Install all software mentioned above.
Setup your mysql server and import database scheme
misc>database_scheme.sqlSetup valid mysql connection details in config.php.
Setup nginx server blocks:
'mainpage' directory as public and if you need block /logs directory 'block_processing' locally
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 -dmS geth geth --rpcaddr 127.0.0.1 --rpcport 8983 --rpc --unlock Address
Now start background scripts:
Get work from geth json and cache it with memcached
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;
Don't use it on production, it's quite heavy.
Make sure to setup valid permissions, allow php-fpm to run python script and make sure that directory permissions are correct to save logs.
Some paths may require changes.
Setting up pool revenue address and fee
block_processing/index.phpmake 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
php,python and some js,css,html code is under The MIT License (MIT) including charting library Plotly.js
Front end template is paid (sorry, at first it wasn't meant to be open sourced thus i just picked paid template)