Skip to content

Instantly share code, notes, and snippets.

@Nithanim
Last active November 14, 2017 22:34
Show Gist options
  • Save Nithanim/54552386021ef3c154245145cd32aa51 to your computer and use it in GitHub Desktop.
Save Nithanim/54552386021ef3c154245145cd32aa51 to your computer and use it in GitHub Desktop.
EQT Staking Setup for Debian
#NO AUTOINSTALLER!
#RUN COMMANDS MANUALLY AND FIX POTENTIAL ERRORS
########## BASIC SETUP
#Assumes:
# * Basic linux experience
# * Working debian-like system (Should work on debian stretch (with the fix), jessie and the raspberry versions of it)
apt-get update
apt-get install tmux unzip -y
#As soon as you disconnect or close the terminal, you loose your progress setting up the wallet!
#Run "tmux" to start a terminal that protects you from that.
#If you want to let the compilation wok in background, press ctrl+b and then 'd' right after
#To open that terminal again (if you closed it or lost connection), run "tmux a".
adduser --disabled-login eqt
sudo apt-get install build-essential libboost-all-dev libdb++-dev libssl-dev libz-dev #libleveldb-dev
su eqt
cd
########## OPTIONAL STEP WHEN A LOT OF ERRORS APPEAR
#<<<<fix for debian stretch or up (or generally if you get a looong list of errors mentioning CBigNum and BIGNUM)
#manual openssl compile
exit #need to be root
apt-get remove libssl-dev -y # seems uninstell is needed. conflicts otherwise
su eqt
cd
wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2-stable.zip
unzip OpenSSL_1_0_2-stable.zip
rm OpenSSL_1_0_2-stable.zip
cd openssl-OpenSSL_1_0_2-stable/
./config
make
export CXXFLAGS+=" -I${HOME}/openssl-OpenSSL_1_0_2-stable/include/"
export LDFLAGS+=" -L${HOME}/openssl-OpenSSL_1_0_2-stable/ -lssl"
cd
#>>>>end fix
#####
########## COMPILING
unzip master.zip
rm master.zip
mv Equitrade-master Equitrade
cd Equitrade/src
#fixes error "recipe for target 'leveldb/libleveldb.a' failed" "make: * [leveldb/libleveldb.a] Error 2"
chmod +x leveldb/build_detect_platform
#fixes error with "makefile.unix:186: recipe for target 'obj/alert.o' failed" with the arrow pointing to '}'
mkdir obj
make -f makefile.unix
#### if you get a lot of errors refer to the optional error fix above
cp EquiTraderd ~
#YOUR DEAMON EXECUTABLE IS NOW AT ~/EquiTraderd
mkdir .EquiTraderData
cd .EquiTraderData
#Change AUser and ARandomPassword to your liking. Password should be fairly secure; you dont need to rememer or store it somewhere!
echo "rpcuser=<AUser>" >> EquiTrader.conf
echo "rpcpassword=<ARandomPassword>" >> EquiTrader.conf
#The minimum amount of coins (of an UTXO) to stake. 1 means to stake every otuput bigger than or equal 1EQT
echo "stakemindepth=1" >> EquiTrader.conf #Thank you notinthdiner from the EQT Telegram group!
echo "rpcport=43102" >> EquiTrader.conf
echo "server=1" >> EquiTrader.conf
echo "listen=1" >> EquiTrader.conf
echo "daemon=1" >> EquiTrader.conf #Starting EquiTraderd will have the program in background. You can shut it down with ./EquiTraderd stop
echo "rpcallowip=127.0.0.1" >> EquiTrader.conf
echo "testnet=0" >> EquiTrader.conf
########## STAKING SETUP
cd
#You can try to transfer your wallet from your machine into ~/.EquiTraderData/
#Some coins dont like that (haven't tried wiht EQT) and you have to let the daemon creat a new wallet file.
#You can extract your privkeys by unlocking your wallet and then type in console of QT:
dumpprivkey <address>
#Then you can import your private keys on your staking device by running:
set +o history
./EquiTraderd importprivkey <yourprivatekey1> [<OptionalName>]
./EquiTraderd importprivkey <yourprivatekey2>
./EquiTraderd importprivkey <yourprivatekey3>
./EquiTraderd importprivkey <yourprivatekey4>
./EquiTraderd importprivkey <yourprivatekey...>
set -o history
# The "set" command ensures that your key is not saved in the command history of bash
#In case your wallet is locked:
nano unlock.sh
## and past the following in:
##<<<<
#!/bin/bash
pw="<yourwalletpassword>"
while true
do
echo "try"
result=$(/home/eqt/EquiTraderd walletpassphrase $pw 30758400 true 2>&1)
ret=$?
echo "Return value is ${ret}"
if [ $ret -eq 87 ]; then
echo "Waiting then..."
sleep 30
elif [ $ret -eq 0 ]; then
echo "Command sent, exiting"
exit
else
echo "Error ($ret): $result" >> stakingsetup.debug
exit
fi
pgrep EquiTraderd
if [ $? -gt 0 ]; then
echo "Daemon died, exiting"
exit
fi
done
##>>>> END OF PASTE
#Press ctrl+o and then ctrl+x. You now should be on the commandline again
chmod 700 unlock.sh
########## AUTOMATICALLY START AND STOP
exit #you have to be root
nano /etc/systemd/system/equitrader.service
##<<<< PASTE
[Unit]
Description=EquiTrader daemon
After=network.target
[Service]
Type=forking
ExecStart=/home/eqt/EquiTraderd -daemon -pid=/home/eqt/eqt.pid
ExecStartPost=/bin/bash /home/eqt/unlock.sh
ExecStop=/home/eqt/EquiTraderd stop
User=eqt
Group=eqt
PIDFile=/home/eqt/eqt.pid
KillMode=process
KillSignal=SIGINT
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target
##>>>> END OF PASTE
#!Remove ExecStartPost if you are not using a locked wallet!
#####
#add autostart
systemctl enable equitrader.service
#start manually
service equitrader start
#stop manually
service equitrader stop
#get status info (one time)
service equitrader status
#get status info (continuus)
watch service equitrader status
#You can check with some commands if your deamon is working (executed as user eqt)
~/EquiTraderd getinfo
#gets you your balance and the "blocks" (blockheight) which should get up to the same as your desktopwallet
#and
./EquiTraderd getmininginfo
EQT EJ5tY9Ph1WWtmaup3Pz9w88cdRPy5SsTMW
BTC 1K3n2AUSKY7DpUvYcGW6jEebEgHSyk4imT
#For The QT wallet
#You have to ensure that the daemon already compiles successfully!
#As root
apt-get install qt4-qmake libqt4-dev build-essential libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev
su eqt
cd ~/Equitrade
qmake
make
cp EquiTrader-qt ~
# Graphical wallet is now at ~/EquiTrader-qt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment