Wrote up installation instructions
Opened this issue · 3 comments
Hi,
I've documented what it took for me to get eloipool installed & running at boot- would like to share with the project should they approve of its content:
To Install:
-
Add your ssh key to github according to these instructions here:
https://help.github.com/articles/generating-ssh-keys/ -
Install dependencies:
2a) Use your OS' package manager, install python 3 & screen with this command:
sudo aptitude -y update && sudo aptitude install -y python3-all-dev screen
2b) Clone the 'jgarzik/pythonbitcoinrpc' git repository into a dir in your home dir, using this command:
git clone git@github.com:jgarzik/python-bitcoinrpc.git
2b1) change to the newly created directory with the following command:
cd python-bitcoinrpc
2b2) Install pythonbitcoinrpc using the following command:
python setup.py install
2c) Clone the 'python-base58' git repository into a dir in your home dir, using this command:
git clone https://gitlab.com/bitcoin/python-base58.git
2c1) Install python-base58 using the following command:
python base58.py install
-
Clone the eloipool git repository locally somewhere in your home directory with this command:
git clone git@github.com:luke-jr/eloipool.git -
Install bitcoind with these commands:
sudo aptitude install -y python-software-properties
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo aptitude update && sudo aptitude install -y bitcoind -
Configure bitcoind:
5a) Open or create the file ~/.bitcoin/bitcoin.conf & put the following in it, substituting the xxxx's with your own values, which don't really matter & can be forgotten:
server=1
rpcuser=xxxx
rpcpassword=xxxx
rpcport=8332
rpcallowip=127.0.0.1
rpcthreads=100
maxconnections=1000
logtimestamps=1
- Copy config.py.example to config.py, and make the following several edits
6a) ServerName to something unique
6b) Change this:
ShareTarget = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
to this:
ShareTarget = 0x000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffff
6c) Comment out CoinbaserCmd so it looks like this:
#CoinbaserCmd = 'echo -e "1\\n$((%d / 100))\\n1579aXhdwvKZEMrAKoCZhzGuqMa8EonuXU"'
6d) Change the TemplateSources section to look like the following, adjusting for your own directory paths & username (without the <>'s):
TemplateSources = (
{
'name': 'primary',
'uri': 'http://<rpcusername:rpcpassword@localhost:8332',
'priority': 0,
'weight': 1,
},
# {
# 'name': 'secondary',
# 'uri': 'http://user:pass@localhost:18332',
# 'priority': 1,
# 'weight': 1,
# },
)
6e) Empty TemplateChecks section so it looks like this:
TemplateChecks = (
)
6f) Delete the whole BlockSubmissions section
6g) Change the following line to look like the one below:
DelayLogForUpstream = False
DelayLogForUpstream = True
6h) Change the following line to look like the one below:
UpstreamBitcoindNode = ('127.0.0.1', 18333) # testnet
UpstreamBitcoindNode = ('127.0.0.1', 8333)
6i) Change the following line to look like the one below:
UpstreamNetworkId = b'\xFA\xBF\xB5\xDA' # testnet
UpstreamNetworkId = b'\xF9\xBE\xB4\xD9'
6j) Change the following line to look like the one below:
POT = 2
#POT = 2
6k) Change the following code to look like the one below:
ShareLogging = (
{
'type': 'logfile',
'filename': 'share-logfile',
'format': "{time} {Q(remoteHost)} {username} {YN(not(rejectReason))} {dash(YN(upstreamResult))} {dash(rejectReason)} {solution}\n",
},
{
'type': 'sql',
'engine': 'postgres',
'dbopts': {
'host': 'localhost',
'database': 'pooldb',
'user': 'eloipool',
'password': 'somethingsecret',
},
'statement': "insert into shares (rem_host, username, our_result, upstream_result, reason, solution) values ({Q(remoteHost)}, {username}, {YN(not(rejectReason))}, {YN(upstreamResult)}, {rejectReason}, decode({solution}, 'hex'))",
},
{
'type': 'sql',
'engine': 'mysql',
'dbopts': {
'host': 'localhost',
'db': 'pooldb',
'user': 'eloipool',
'password': 'somethingsecret',
},
'statement': "insert into shares (rem_host, username, our_result, upstream_result, reason, solution) values ({Q(remoteHost)}, {username}, {YN(not(rejectReason))}, {YN(upstreamResult)}, {rejectReason}, unhex({solution}))",
},
{
'type': 'sql',
'engine': 'sqlite',
'dbopts': {
'database': 'share.db',
},
'statement': "insert into shares (remoteHost, username, rejectReason, upstreamResult, solution) values ({remoteHost}, {username}, {rejectReason}, {upstreamResult}, {solution})",
},
)
ShareLogging = (
{
'type': 'logfile',
'filename': 'share-logfile',
'format': "{time} {Q(remoteHost)} {username} {YN(not(rejectReason))} {dash(YN(upstreamResult))} {dash(rejectReason)} {solution}\n",
},
)
6l) Change the following line to look like the one below:
LogFile = {
'filename': 'filename.log',
LogFile = {
'filename': 'eloipool.log',
- Create startup scripts so everything we need is up after a reboot
7a) In your home directory, create a folder just for your scripts with this command:
mkdir scripts
7b) Create a script to start bitcoind
7b1) Create the file ~/scripts/bitcoindstart.sh, & put the following in it, adjusting for your own directory paths & username (without the <>'s):
#!/bin/sh
sleep 30
screen -dm su <username> -c PYTHONPATH=/home/<username>/<path to bitcoinrpc>:/home/<username>/<path to python-base58> \
nohup ./eloipool.py 2>&1 >/dev/null &
7b2) Make the script belong to the user, & be executable with the following command, adjusting for your own directory paths & username (without the <>'s):
sudo chown : ~/scripts/bitcoindstart.sh
sudo chmod a+x ~/scripts/bitcoindstart.sh
- Create a script to start eloipool
8a) Create the file ~//poolstart.sh in the eloipool root directory, which was created during the git checkout, & put the following in it, adjusting for your own directory paths & username (without the <>'s):
#!/bin/sh
sleep 30
screen -dm su <username> -c PYTHONPATH=/home/admin/apps/python-bitcoinrpc:/home/admin/apps/python-base58 \
nohup ./eloipool.py 2>&1 >/dev/null &
Make the script belong to the user, & be executable with the following command, adjusting for your own directory paths & username (without the <>'s):
sudo chown <username>:<usergroup> ~~/<eloipooldirectory>/poolstart.sh
sudo chmod a+x ~~/<eloipooldirectory>/poolstart.sh
- Make the startup scripts start at boot
9a) To make bitcoind start at boot, add the following to /etc/rc.local, adjusting for your own directory paths & username (without the <>'s):
su admin -c '/home/<username>/scripts/bitcoindstart.sh'
9b) To make eloipool start at boot, edit cron with the following command:
crontab -e
9b1) Enter the following to the bottom of the file, adjusting for your own directory paths & username (without the <>'s):
@reboot /home/<username>/<path to eloipool>/poolstart.sh
- Reboot & all should be well...
Can you add this to README (right before the section on Merged Mining) and submit it as a pull request? Thanks
It's not quite right yet- not ready for production, as I missed some steps, editing now.
Aside from that, I don't know how to do what you're asking of me- I only know how to clone a git package- sorry, I'll need ELI5 instructions for that.
Open https://github.com/luke-jr/eloipool/blob/master/README and to the right of the History button there should be an Edit button.