I have created 2 scripts for Linux PoS miners. One is a start-up script and second one is a report one. I would like to thank @Kandiru, @drunkenmugsy and @root for a few better hacks. Special thanks to @karamble who's code I added to my script because it was a good add-on . If I forgot to mention anyone I'm sorry and pleas do tell me so I will add you. Adding username and password in config files in .dcrd, .dcrwallet and .dcrctl folders. you have to run it as a user that runs dcrd, dcrwallet and dcrctl. You need nano in you Linux most of them do. Config: nano ~/.dcrctl/dcrctl.conf Code: [Application Options] rpcuser=USER rpcpass=PASS nano ~/.dcrd/dcrd.conf Code: [Application Options] rpcuser=USER rpcpass=PASS nano ~/.dcrwallet/dcrwallet.conf Code: [Application Options] username=USER password=PASS Auto-start script (UPDATED 30.03.2016): Code: #! /bin/sh # Set all the paths and DCR values for ticket price, fee and how much to maintain homeFolder="<YOUR HOME FOLDER>" decredFolder="$homeFolder/<YOUR FOLDER>" dcrdFolder="$homeFolder/<YOUR FOLDER>" dcrwalletFolder="$homeFolder/<YOUR FOLDER>" walletPassPhrase="<YOUR PASSWORD>" balanceToMaintain="<YOUR BALANCE>" ticketMaxPrice="<YOUR PRICE>" maxFee="<YOUR PRICE>" # Original is 0.05 noConfig="false" runInScreen="no" configText="" printf "Starting decred PoS mining!\n" printf "Checking if you have config files for dcrd, dcrwallet and dcrctl ........ " if [ ! -f "$homeFolder/.dcrd/dcrd.conf" ]; then configText="\nPleas create dcrd.conf." noConfig="true" fi if [ ! -f "$homeFolder/.dcrwallet/dcrwallet.conf" ]; then configtext="$configText\nPleas create dcrwallet.conf." noConfig="true" fi if [ ! -f "$homeFolder/.dcrctl/dcrctl.conf" ]; then configText="$configText\nPleas create dcrctl.conf." noConfig="true" fi if [[ "$noConfig" == "true" ]]; then printf "failed" printf "$configText" exit fi printf "OK\n" if type "screen" > /dev/null; then printf "Do you want to run it in screen yes | no (no): " read runInScreen else printf "Install 'screen' if you want to run in it." fi printf "\nStarting dcrd ........ " if [ "$runInScreen" == "y" ] || [ "$runInScreen" == "yes" ] || [ "$runInScreen" == "Yes" ] || [ "$runInScreen" == "Y" ]; then screen -dmS decred screen -S decred -p 0 -X exec $decredFolder/dcrd printf "OK\n" printf "Starting wallet ........ " while true; do dcrdLog=`tail $dcrdFolder/dcrd.log | grep -c "DNS seed"` if [[ $dcrdLog -gt 0 ]]; then screen -S decred -X screen $decredFolder/dcrwallet --enablestakemining --balancetomaintain=$balanceToMaintain --ticketmaxprice=$ticketMaxPrice printf "OK\n" break else sleep 1 fi done else $decredFolder/dcrd > /dev/null & disown printf "OK\n" printf "Starting wallet ........ " while true; do dcrdLog=`tail $dcrdFolder/dcrd.log | grep -c "DNS seed"` if [[ $dcrdLog -gt 0 ]]; then $decredFolder/dcrwallet --enablestakemining --balancetomaintain=$balanceToMaintain --ticketmaxprice=$ticketMaxPrice > /dev/null & disown printf "OK\n" break else sleep 1 fi done fi printf "Unlocking wallet ........ " while true; do dcrwalletLog=`tail $dcrwalletFolder/dcrwallet.log | grep -c "PLEASE ENSURE YOUR WALLET"` if [[ $dcrwalletLog -gt 0 ]]; then $decredFolder/dcrctl --wallet walletpassphrase $walletPassPhrase 0 printf "OK\n" break else sleep 1 fi done printf "Cleaning missed / revoked tickets ........ " $decredFolder/dcrctl rebroadcastmissed printf "OK\n" printf "Setting a fee ........ " $decredFolder/dcrctl --wallet settxfee $maxFee > /dev/null $decredFolder/dcrctl --wallet setticketfee $maxFee > /dev/null printf "OK\n" printf "PoS mining succefully started!\n" Report script (UPDATED 16.03.2016): Code: #! /bin/sh dcrwalletLogFolder="/home/brencelj/.dcrwallet/logs/mainnet/" decredFolder="/home/brencelj/decred/" cd $decredFolder balanceAll=`./dcrctl --wallet getbalance 'default' 0 all` balanceLocked=`./dcrctl --wallet getbalance 'default' 0 locked` balanceSpendable=`./dcrctl --wallet getbalance 'default' 0 spendable` stakeInfo=`./dcrctl --wallet getstakeinfo` maxPrice=`./dcrctl --wallet getticketmaxprice` ticketFee=`./dcrctl --wallet getticketfee` blockcount=`./dcrctl getblockcount` balanceWon=`echo $stakeInfo | grep -aEo '"totalsubsidy": [0-9\.]*,' | sed -ne 's/,//p' | sed -ne 's/\"totalsubsidy\":.//p'` votesCount=`echo $stakeInfo | grep -aEo '"voted": [0-9\.]*,' | sed -ne 's/,//p' | sed -ne 's/\"voted\":.//p'` missedVotesCount=`echo $stakeInfo | grep -aEo '"missed": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"missed\":.//p'` revokedVotesCount=`echo $stakeInfo | grep -aEo '"revoked": [0-9\.]*' | sed -n -e 's/\"revoked\":.//p'` ticketPrice=`echo $stakeInfo | grep -aEo '"difficulty": [0-9\.]*,'| sed -ne 's/,//p' | sed -n -e 's/\"difficulty\":.//p'` ticketsImatureCount=`echo $stakeInfo | grep -aEo '"immature": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"immature\":.//p'` ticketsMatureCount=`echo $stakeInfo | grep -aEo '"live": [0-9\.]*,' | sed -ne 's/,//p' | sed -n -e 's/\"live\":.//p'` cd $dcrwalletLogFolder votedTicketsPerDay=`cat dcrwallet.log | grep -a Voted | grep -ao "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/ | /g'` buyCount=`cat dcrwallet.log | grep -a SStx | wc -l` boughtTicketsPerDay=`cat dcrwallet.log | grep -a SStx | grep -ao "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/ | /g'` revokedTicketsPerDay=`cat dcrwallet.log | grep -a Revoked | grep -ao "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" | uniq -c | tr -d '\n' | sed 's/\s\{3,\}/ | /g'` dateNow=`date +"%d-%b-%Y %X"` imatureFunds=`awk -va=$balanceAll -vl=$balanceLocked -vs=$balanceSpendable 'BEGIN{printf "%.8f" , a-l-s}'` rewardblock=`cat dcrwallet.log | grep -a Voted | cut -d "(" -f2 | cut -d ")" -f1 | sed -e 's/height / /g' | tr -d "\n" |{ read line; for i in $line; do payblock="$((i +256))"; if [ $payblock -gt $blockcount ]; then echo -n "$payblock "; fi done; echo }` echo "" echo "########## Decred report ##########" echo "" echo " $dateNow" echo "" echo " **Money**" echo " All: $balanceAll" echo " Locked: $balanceLocked" echo " Spendable: $balanceSpendable" echo " Immature: $imatureFunds" echo " Won: $balanceWon" echo "" echo " **Tickets**" echo " All: $(($ticketsImatureCount+$ticketsMatureCount))" echo " Mature: $ticketsMatureCount" echo " Immature: $ticketsImatureCount" echo " Price Now: $ticketPrice" echo " My Price: $maxPrice" echo " My Fee: $ticketFee" echo "" echo " **Bought Tickets Per Day**" echo " $boughtTicketsPerDay |" echo "" echo " **Votes**" echo " Done: $votesCount" echo " Missed: $(($missedVotesCount-$revokedVotesCount))" echo " Revoked: $revokedVotesCount" echo " Bought: $buyCount" echo " Failed: $missedVotesCount" echo "" echo " **Voted Tickets Per Day**" echo " $votedTicketsPerDay |" echo "" echo " **Reward Paying Block**" echo " Current Block: $blockcount" echo " Upcoming Reward Blocks: $rewardblock" echo "" echo "###################################" echo "" UPDATED 15.03.2016 (Auto-start script) - added dcrctl rebroadcastmissed as suggested by @root UPDATED 16.03.2016 (Report script) - added immature funds or funds that aren't yet received because of 254 block wait or something else suggested by @sambiohazard in other topic UPDATED 18.03.2016 (Config part) - added how to create config files for username and password for dcred, dcrwallet and dcrctl on a request of @ImpellitterI UPDATED 20.03.2016 (Auto-start script) - added setting a fee UPDATED 30.3.2016 (Auto-start script) - added option for rung it in a screen - added checking if you have screen installed - added checking if you have config files for dcrd, dcrwallet and dcrctl - changed text preview
Thanks for your work https://mainnet.decred.org/tx/0cbcae57e44e49add2d6ebdf5b5e121a16fb7964bf1ff7e480171306819464a0
No problem, i hope others will donate too. I am not using your scripts but i think "Donation is motivation".
well if you started them with -u and -p in them than you can leave them on and crate this files for next restart of daemons which will be today after version 0.0.8. But you can create this files while they are running it shouldn't create any problems. or you can wait until the new relese and do all than
I can call any command through --wallet (only 'stop' has to be called with daemon / wallet respectively). It seems to be working just fine.
I am sorry for my English. I mean you have daemon commands and wallet commands. I was able to call all through dcrctl --wallet CMD to get the result. For example dcrctl getinfo prints the result, but can be called as dcrctl --wallet getinfo to get even more details. Or even validateaddress etc...
Aha OK yeah well I thought that rebroadcastmissed and getblockcount need now --wallet now so that is why I asked and since for me it works without it I didn't change anything
@Ealves It is all recorded in your log file but if you don't have log file it won't show the correct number.
Hi @brencelj have you used the report script lately? I think it is not working with vers 0.8.2. Looks like the getbalance command syntax has changed and broke the script: getbalance ("account" minconf=1) getbalance command: wrong number of params (expected between 0 and 2, received 3) (code: ErrNumParams)