I'll be attempting to set one up later tomorrow. I like the open-source route and would like to help in the future development.
It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
Worker distribution pie charts:Code:
#!/bin/bash
cp /Scripts/payouts /Scripts/old_payouts
rm /Scripts/payouts
counter=0
redis-cli del Pool_Stats:CurrentRoundBTCD
redis-cli del Pool_Stats:CurrentRoundBTC
now="`date +%s`"
thisShift=`redis-cli hget Pool_Stats This_Shift`
ShiftStart=`redis-cli hget Pool_Stats:$thisShift starttime`
BTCDPrice=`redis-cli hget Exchange_Rates btcdcoin`
TotalEarned=0
TotalEarnedBTCD=0
# loop through algos
while read line
do
AlgoTotal=0
AlgoTotalBTCD=0
logkey2="Pool_Stats:"$thisShift":Algos"
logkey2BTCD="Pool_Stats:"$thisShift":AlgosBTCD"
echo "LOGKEY2: $logkey2"
# loop through each coin for that algo
while read CoinName
do
coinTotal=0
coinTotalBTCD=0
thiskey=$CoinName":balances"
logkey="Pool_Stats:"$thisShift":Coins"
logkeyBTCD="Pool_Stats:"$thisShift":CoinsBTCD"
#Determine price for Coin
coin2btc=`redis-cli hget Exchange_Rates $CoinName`
# echo "$CoinName - $coin2btc"
workersPerCoin=`redis-cli hlen $thiskey`
if [ $workersPerCoin = 0 ]
then
echo "do nothing" > /dev/null
else
while read WorkerName
do
thisBalance=`redis-cli hget $thiskey $WorkerName`
thisEarned=`echo "scale=4;$thisBalance * $coin2btc" | bc -l`
coinTotal=`echo "scale=4;$coinTotal + $thisEarned" | bc -l`
AlgoTotal=`echo "scale=4;$AlgoTotal + $thisEarned" | bc -l`
BTCDEarned=`echo "scale=4;$thisEarned / $BTCDPrice" | bc -l`
coinTotalBTCD=`echo "scale=4;$coinTotalBTCD + $BTCDEarned" | bc -l`
AlgoTotalBTCD=`echo "scale=4;$AlgoTotalBTCD + $BTCDEarned" | bc -l`
# echo "$WorkerName earned $BTCDEarned from $CoinName"
redis-cli hincrbyfloat Pool_Stats:CurrentRoundBTCD $WorkerName $BTCDEarned
redis-cli hincrbyfloat Pool_Stats:CurrentRoundBTC $WorkerName $thisEarned
done< <(redis-cli hkeys $CoinName:balances)
redis-cli hset $logkey $CoinName $coinTotal
redis-cli hset $logkeyBTCD $CoinName $coinTotalBTCD
echo "$CoinName: $coinTotal"
fi
done< <(redis-cli hkeys Coin_Names_$line)
redis-cli hset $logkey2 $line $AlgoTotal
redis-cli hset $logkey2BTCD $line $AlgoTotalBTCD
TotalEarned=`echo "scale=4;$TotalEarned + $AlgoTotal" | bc -l`
TotalEarnedBTCD=`echo "scale=4;$TotalEarnedBTCD + $AlgoTotalBTCD" | bc -l`
done< <(redis-cli hkeys Coin_Algos)
redis-cli hset Pool_Stats:$thisShift Earned_BTC $TotalEarned
redis-cli hset Pool_Stats:$thisShift Earned_BTCD $TotalEarnedBTCD
echo "Total Earned: $TotalEarned"
redis-cli hset Pool_Stats:$thisShift endtime $now
nextShift=$(($thisShift + 1))
redis-cli hincrby Pool_Stats This_Shift 1
echo "$thisShift" >>/Scripts/Shifts
redis-cli hset Pool_Stats:$nextShift starttime $now
echo "Printing Earnings report" >> /Scripts/ShiftChangeLog.txt
echo "Shift change switching from $thisShift to $nextShift at $now" >>/Scripts/ShiftChangeErrorCheckerReport
while read WorkerName
do
PrevBalance=`redis-cli zscore Pool_Stats:Balances $WorkerName`
if [[ $PrevBalance == "" ]]
then
PrevBalance=0
fi
thisBalance=`redis-cli hget Pool_Stats:CurrentRoundBTCD $WorkerName`
TotalBalance=`echo "scale=4;$PrevBalance + $thisBalance" | bc -l` >/dev/null
echo $WorkerName $TotalBalance
# echo "$WorkerName $TotalBalance" >> /Scripts/PayoutReport
echo "$WorkerName $TotalBalance - was $PrevBalance plus today's $thisBalance" >> /Scripts/ShiftChangeErrorCheckerReport
redis-cli zadd Pool_Stats:Balances $TotalBalance $WorkerName
redis-cli hset Worker_Stats:Earnings:$WorkerName $thisShift $thisBalance
redis-cli hincrbyfloat Worker_Stats:TotalEarned $WorkerName $thisBalance
#Log each earning in the redis instance in the HTML format.
#But first, mask the worker address.
str=$WorkerName
n=7
hiddenWorkerName="***************"${str:${#str} - $n}
redis-cli hincrby Pool_Stats Earning_Log_Entries 1
EarningNumber=`redis-cli hget Pool_Stats Earning_Log_Entries`
redis-cli hset Pool_Stats:EarningsLog $EarningNumber "" $thisShift Shift Earning $hiddenWorkerName $thisBalance $PrevBalance $TotalBalance $now
done< <(redis-cli hkeys Pool_Stats:CurrentRoundBTCD)
echo "Done adding coins, clearing balances now." >> /Scripts/ShiftChangeLog.log
# Save the total BTC/BTCD earned for each shift into a historical key for auditing purposes.
redis-cli rename Pool_Stats:CurrentRoundBTCD Pool_Stats:$thisShift:ShiftBTCD
redis-cli rename Pool_Stats:CurrentRoundBTC Pool_Stats:$thisShift:ShiftBTC
#for every coin on the pool....
while read Coin_Names2
do
#Save the old balances key for every coin into a historical key.
redis-cli rename $Coin_Names2:balances Prev:$thisShift:$Coin_Names2:balances
# This loop will move every block from the blocksConfirmed keys into the blocksPaid keys. This means only blocksConfirmed are unpaid.
while read PaidLine
do
redis-cli sadd $Coin_Names2:"blocksPaid" $PaidLine
redis-cli srem $Coin_Names2:"blocksConfirmed" $PaidLine
echo "nothing" > /dev/null
done< <(redis-cli smembers $Coin_Names2:"blocksConfirmed")
done< <(redis-cli hkeys Coin_Names)
echo "Done script at $now" >> /Scripts/ShiftChangeLog.log
#Calculate workers owed in excesss of 5 BTCDcoin and generate a report of them.
while read PayoutLine
do
amount=`redis-cli zscore Pool_Stats:Balances $PayoutLine`
roundedamount=`echo "scale=4;$amount - 1" | bc -l`
echo "$PayoutLine $roundedamount"
#log a file named /Scripts/pallp0pp
echo "$PayoutLine $amount" >> /Scripts/payouts
#send all of the payments using the coin daemon
txn=`bitcoindarkd sendtoaddress $PayoutLine $amount`
if [ -z "$txn" ]
then
#log failed payout to txt file.
echo "payment failed! $PayoutLine" >>/Scripts/AlertLog
else
urlstring="http://btcd.explorer.ssdpool.com:9050/tx/$txn"
newtotal=`echo "scale=4;$amount - $roundedamount" | bc -l` >/dev/null
redis-cli hincrby Pool_Stats Earning_Log_Entries 1
redis-cli hset Worker_Stats:Payouts:$PayoutLine $thisShift $amount
redis-cli hincrbyfloat Worker_Stats:TotalPaid $PayoutLine $amount
EarningNumber=`redis-cli hget Pool_Stats Earning_Log_Entries`
str=$PayoutLine
n=7
hiddenPayoutLine="***************"${str:${#str} - $n}
#log in redis for displaying on website
redis-cli hset Pool_Stats:EarningsLog $EarningNumber "" $thisShift Payout $hiddenPayoutLine $amount $amount here $now
redis-cli zadd Pool_Stats:Balances 0 $PayoutLine
fi
done< <(redis-cli zrangebyscore Pool_Stats:Balances 5 inf)
#move old profitability stats
redis-cli rename Pool_Stats:CurrentShift:Profitability Pool_Stats:$thisShift:Profitability
#!/bin/bash
declare -A ProArr
declare -A NameArr
AlgoCounter=0
now="`date +%s`"
ShiftNumber=`redis-cli hget Pool_Stats This_Shift`
echo "Test"
startstring="Pool_Stats:"$ShiftNumber
starttime=`redis-cli hget $startstring starttime`
endtime=$now
length=$(($endtime - $starttime))
redis-cli hset Pool_Stats CurLength $length
dayslength=`echo "scale=3;$length / 86400" | bc -l`
TgtCoinPrice=`redis-cli hget Exchange_Rates`
TotalEarned=0
TotalEarnedTgtCoin=0
redis-cli hset Pool_Stats CurDaysLength $dayslength
redis-cli del Pool_Stats:CurrentShift:WorkerBTC
redis-cli del Pool_Stats:CurrentShift:WorkerTgtCoin
# START CALCULATING COIN PROFIT FOR CURRENT ROUND - THIS ALSO CALCULATES WORKER EARNINGS MID SHIFT.
# PLEASE NOTE ALL COIN NAMES IN COIN_ALGO REDIS KEY MUST MATCH KEY NAMES IN EXCHANGE_RATES KEY CASE-WISE
while read line
do
AlgoTotal=0
AlgoTotalTgtCoin=0
logkey2="Pool_Stats:CurrentShift:Algos"
logkey2TgtCoin="Pool_Stats:CurrentShift:AlgosTgtCoin"
echo "LOGKEY2: $logkey2"
# loop through each coin for that algo
while read CoinName
do
coinTotal=0
coinTotalTgtCoin=0
thiskey=$CoinName":balances"
logkey="Pool_Stats:CurrentShift:Coins"
logkeyTgtCoin="Pool_Stats:CurrentShift:CoinsTgtCoin"
#Determine price for Coin
coin2btc=`redis-cli hget Exchange_Rates $CoinName`
# echo "$CoinName - $coin2btc"
workersPerCoin=`redis-cli hlen $thiskey`
if [ $workersPerCoin = 0 ]
then
echo "do nothing" > /dev/null
else
while read WorkerName
do
thisBalance=`redis-cli hget $thiskey $WorkerName`
thisEarned=`echo "scale=6;$thisBalance * $coin2btc" | bc -l`
coinTotal=`echo "scale=6;$coinTotal + $thisEarned" | bc -l`
AlgoTotal=`echo "scale=6;$AlgoTotal + $thisEarned" | bc -l`
TgtCoinEarned=`echo "scale=6;$thisEarned / $TgtCoinPrice" | bc -l`
coinTotalTgtCoin=`echo "scale=6;$coinTotalTgtCoin + $TgtCoinEarned" | bc -l`
AlgoTotalTgtCoin=`echo "scale=6;$AlgoTotalTgtCoin + $TgtCoinEarned" | bc -l`
# echo "$WorkerName earned $TgtCoinEarned from $CoinName"
redis-cli hincrbyfloat Pool_Stats:CurrentShift:WorkerTgtCoin $WorkerName $TgtCoinEarned
redis-cli hincrbyfloat Pool_Stats:CurrentShift:WorkerBTC $WorkerName $thisEarned
done< <(redis-cli hkeys $CoinName:balances)
redis-cli hset $logkey $CoinName $coinTotal
redis-cli hset $logkeyTgtCoin $CoinName $coinTotalTgtCoin
echo "$CoinName: $coinTotal"
fi
done< <(redis-cli hkeys Coin_Names_$line)
redis-cli hset $logkey2 $line $AlgoTotal
redis-cli hset $logkey2TgtCoin $line $AlgoTotalTgtCoin
TotalEarned=`echo "scale=6;$TotalEarned + $AlgoTotal" | bc -l`
TotalEarnedTgtCoin=`echo "scale=6;$TotalEarnedTgtCoin + $AlgoTotalTgtCoin" | bc -l`
done< <(redis-cli hkeys Coin_Algos)
# END CALCULATING COIN PROFITS FOR CURRENT SHIFT
# START CALCULATIN AVERAGE HASHRATES SO FAR THIS SHIFT
echo "Start: $starttime End: $endtime"
AlgoCounter=0
while read Algo
do
AlgoCounter=$(($AlgoCounter + 1))
if [ $Algo = "sha256" ]
then
Algo="sha256"
fi
AlgoHRTotal=0
counter=0
loopstring="Pool_Stats:AvgHRs:"$Algo
while read HR
do
IN=$HR
arrIN=(${IN//:/ })
amt=${arrIN[0]}
counter=`echo "$counter + 1" | bc`
AlgoHRTotal=`echo "$AlgoHRTotal + $amt" | bc -l`
done< <(redis-cli zrangebyscore $loopstring $starttime $endtime)
if [ $Algo = "sha" ]
then
Algo="sha256"
fi
thisalgoAVG=`echo "scale=8;$AlgoHRTotal / $counter" | bc -l`
string="average_"$Algo
redis-cli hset Pool_Stats:CurrentShift $string $thisalgoAVG
string3="Pool_Stats:CurrentShift:Algos"
thisalgoEarned=`redis-cli hget $string3 $Algo`
thisalgoP=`echo "scale=8;$thisalgoEarned / $thisalgoAVG / $dayslength" | bc -l`
string2="Profitability_$Algo"
redis-cli hset Pool_Stats:CurrentShift $string2 $thisalgoP
if [ $Algo = "keccak" ]
then
thisalgoP=`echo "scale=8;$thisalgoP * 500" | bc -l`
elif [ $Algo = "sha256" ]
then
thisalgoP=`echo "scale=8;$thisalgoP * 100" | bc -l`
elif [ $Algo = "x11" ]
then
thisalgoP=`echo "scale=8;$thisalgoP * 4" | bc -l`
else
echo "done" >/dev/null
fi
if [ -z "$thisalgoP" ]
then
thisalgoP=0
fi
ProArr[$AlgoCounter]=$thisalgoP
NameArr[$AlgoCounter]=$Algo
redis-cli hset Pool_Stats:CurrentShift $string2 $thisalgoP
echo "For Current Shift Algo $Algo had an average of $thisalgoAVG - profitability was $thisalgoP"
done< <(redis-cli hkeys Coin_Algos)
profitstring=${ProArr[1]}":"${ProArr[2]}":"${ProArr[3]}":"${ProArr[4]}":"${ProArr[5]}
stringnames=${NameArr[1]}":"${NameArr[2]}":"${NameArr[3]}":"${NameArr[4]}":"${NameArr[5]}
redis-cli hset Pool_Stats:CurrentShift:Profitability $now $profitstring
redis-cli hset Pool_Stats:CurrentShift NameString $stringnames
#!/bin/bash
BC2BTC=`curl -G 'https://api.mintpal.com/v1/market/stats/BC/BTC/' | jq -r .[].last_price`
FTC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=5' | jq -r .return.markets.FTC.lasttradeprice`
MZC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=164' | jq -r .return.markets.MZC.lasttradeprice`
NET2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=134' | jq -r .return.markets.NET.lasttradeprice`
DRK2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=155' | jq -r .return.markets.DRK.lasttradeprice`
WDC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=14' | jq -r .return.markets.WDC.lasttradeprice`
STR2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=83' | jq -r .return.markets.STR.lasttradeprice`
KDC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=178' | jq -r .return.markets.KDC.lasttradeprice`
NYAN2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=184' | jq -r .return.markets.NYAN.lasttradeprice`
MNC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=7' | jq -r .return.markets.MNC.lasttradeprice`
POT2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=173' | jq -r .return.markets.POT.lasttradeprice`
GDC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=82' | jq -r .return.markets.GDC.lasttradeprice`
GLC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=76' | jq -r .return.markets.GLC.lasttradeprice`
BTE2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=49' | jq -r .return.markets.BTE.lasttradeprice`
UNO2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=133' | jq -r .return.markets.UNO.lasttradeprice`
USDE2BTC=`curl -G 'https://poloniex.com/public?command=returnTicker' | jq -r .BTC_USDE.last`
HIRO2BTC=`curl -G 'https://poloniex.com/public?command=returnTicker' | jq -r .BTC_HIRO.last`
GDN2BTC=`curl -G 'https://poloniex.com/public?command=returnTicker' | jq -r .BTC_GDN.last`
cinni2btc=`curl -G 'https://poloniex.com/public?command=returnTicker' | jq -r .BTC_CINNI.last`
NOBL2BTC=`curl -G 'https://poloniex.com/public?command=returnTicker' | jq -r .BTC_NOBL.last`
REDD2BTC=`curl -G 'https://poloniex.com/public?command=returnTicker' | jq -r .BTC_REDD.last`
LGC2BTC=`curl -G 'https://poloniex.com/public?command=returnTicker' | jq -r .BTC_LGC.last`
EAC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=139' | jq -r .return.markets.EAC.lasttradeprice`
CAP2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=53' | jq -r .return.markets.CAP.lasttradeprice`
RBY2BTC=`curl -G 'https://bittrex.com/api/v1/public/getticker?market=BTC-RBY' | jq -r .result.Last`
tips2ltc=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=147' | jq -r .return.markets.TIPS.lasttradeprice`
ltc2btc=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=3' | jq -r .return.markets.LTC.lasttradeprice`
nxt2btc=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=159' | jq -r .return.markets.NXT.lasttradeprice`
tips2btc=`echo "$tips2ltc * $ltc2btc" | bc -l`
TRC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=27' | jq -r .return.markets.TRC.lasttradeprice`
LOT2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=137' | jq -r .return.markets.LOT.lasttradeprice`
GLD2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=30' | jq -r .return.markets.GLD.lasttradeprice`
MEC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=45' | jq -r .return.markets.MEC.lasttradeprice`
MYR2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=200' | jq -r .return.markets.MYR.lasttradeprice`
MEOW2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=149' | jq -r .return.markets.MEOW.lasttradeprice`
EXE2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=183' | jq -r .return.markets.EXE.lasttradeprice`
VTC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=151' | jq -r .return.markets.VTC.lasttradeprice`
SAT2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=168' | jq -r .return.markets.SAT.lasttradeprice`
NXT2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=159' | jq -r .return.markets.NXT.lasttradeprice`
MAX2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=152' | jq -r .return.markets.MAX.lasttradeprice`
THREE2BTC=`curl -G 'https://api.mintpal.com/v1/market/stats/365/BTC/' | jq -r .[].last_price`
ZET2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=85' | jq -r .return.markets.ZET.lasttradeprice`
XC2BTC=`curl -G 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=210' | jq -r .return.markets.XC.lasttradeprice`
redis-cli hset Exchange_Rates blackcoin $BC2BTC
redis-cli hset Exchange_Rates globaldenomination $GDN2BTC
redis-cli hset Exchange_Rates zetacoin $ZET2BTC
redis-cli hset Exchange_Rates logicoin $LGC2BTC
redis-cli hset Exchange_Rates cinnicoin $cinni2btc
redis-cli hset Exchange_Rates 365coin $THREE2BTC
redis-cli hset Exchange_Rates NXT $NXT2BTC
redis-cli hset Exchange_Rates execoin $EXE2BTC
redis-cli hset Exchange_Rates vertcoin $VTC2BTC
redis-cli hset Exchange_Rates kittehcoin $MEOW2BTC
redis-cli hset Exchange_Rates megacoin $MEC2BTC
redis-cli hset Exchange_Rates netcoin $NET2BTC
redis-cli hset Exchange_Rates globalcoin $GLC2BTC
redis-cli hset Exchange_Rates grandcoin $GDC2BTC
redis-cli hset Exchange_Rates goldcoin $GLD2BTC
redis-cli hset Exchange_Rates fedoracoin $tips2btc
redis-cli hset Exchange_Rates litecoin $ltc2btc
redis-cli hset Exchange_Rates nxt $NXT2BTC
redis-cli hset Exchange_Rates terracoin $TRC2BTC
redis-cli hset Exchange_Rates feathercoin $FTC2BTC
redis-cli hset Exchange_Rates reddcoin $REDD2BTC
redis-cli hset Exchange_Rates earthcoin $EAC2BTC
redis-cli hset Exchange_Rates bottlecaps $CAP2BTC
redis-cli hset Exchange_Rates rubycoin $RBY2BTC
redis-cli hset Exchange_Rates terracoin $TRC2BTC
redis-cli hset Exchange_Rates noblecoin $NOBL2BTC
redis-cli hset Exchange_Rates mincoin $MNC2BTC
redis-cli hset Exchange_Rates klondikecoin $KDC2BTC
redis-cli hset Exchange_Rates darkcoin $DRK2BTC
redis-cli hset Exchange_Rates mazacoin $MZC2BTC
redis-cli hset Exchange_Rates unobtanium $UNO2BTC
redis-cli hset Exchange_Rates hirocoin $HIRO2BTC
redis-cli hset Exchange_Rates cinnicoin $cinni2btc
redis-cli hset Exchange_Rates usde $USDE2BTC
redis-cli hset Exchange_Rates lottocoin $LOT2BTC
redis-cli hset Exchange_Rates nyancoin $NYAN2BTC
redis-cli hset Exchange_Rates worldcoin $WDC2BTC
redis-cli hset Exchange_Rates potcoin $POT2BTC
redis-cli hset Exchange_Rates myriadcoin $MYR2BTC
redis-cli hset Exchange_Rates myriad-scrypt $MYR2BTC
redis-cli hset Exchange_Rates myriadsha $MYR2BTC
redis-cli hset Exchange_Rates saturncoin $SAT2BTC
redis-cli hset Exchange_Rates maxcoin $MAX2BTC
redis-cli hset Exchange_Rates rubycoin $RBY2BTC
redis-cli hset Exchange_Rates xccoin $XC2BTC
#!/bin/bash
workercounter=0
arraycounter=0
now="`date +%s`"
TenMins=$((now - 600))
interval=600
modifier=65536
SHAmodifier=4294967296
redis-cli del tmpkey
while read Algo
do
TotalWorkers=0
WorkerTotals=0
unset arrWorkerTotals
unset arrWorkerCounts
unset arrWorkerNames
typeset -A arrWorkerTotals
typeset -A arrWorkerCounts
typeset -A arrWorkerNames
AlgoCounter=0
workercounter=0
redis-cli del tmpkey
while read CoinType
do
echo "$CoinType"
counter=0
CoinKeyName=$CoinType":hashrate"
totalhashes=`redis-cli zcard $CoinKeyName`
if [ -z "$totalhashes" ]
then
echo "no hashes" >/dev/null
else
while read LineItem
do
# echo "$LineItem"
counter=$(($counter + 1))
AlgoCounter=$(($AlgoCounter + 1))
IN=$LineItem
arrIN=(${IN//:/ })
preworker=(${arrIN[1]})
#strip HTML tags out to ensure safe displaying later
workername=`echo "$preworker," | tr -d '<>,'`
echo "$workername"
if [[ $workername == "" ]]
then
echo "ignore worker"
else
share=(${arrIN[0]})
arrWorkerCounts[$workername]=$((${arrWorkerCounts[$workername]} + 1))
if [[ ${arrWorkerCounts[$workername]} -eq 1 ]]
then
#must have been this workers first share, so thi s is a new worker
TotalWorkers=$(($TotalWorkers + 1))
workercounter=$(($workercounter + 1))
arrWorkerNames[$workercounter]=$workername
echo "TotalWorkers - $TotalWorkers ~~~ workercounter - $workercounter ~~~ arrWorkerNames -" ${arrWorkerNames[$workercounter]}
else
#this was a duplicate worker, do nothing
echo " " >/dev/null
fi
if [ -z "${arrWorkerTotals[$workername]}" ]
then
tempvar=0
else
tempvar=${arrWorkerTotals[$workername]}
fi
arrWorkerTotals[$workername]=`echo "scale=6;$tempvar + $share" | bc -l`
echo "${arrWorkerNames[$workercounter]}"
fi
done< <(redis-cli zrangebyscore $CoinKeyName $TenMins $now)
TotalHash=`echo "$TotalHash + $share" | bc -l`
fi
done< <(redis-cli hkeys Coin_Names_$Algo)
# break it down - sha is stored a GH, everything else is stored a MH
if [ $Algo = "sha256" ]
then
modifier=4294967296
divisor=1073741824
elif [ $Algo = "keccak" ]
then
modifier=16777216
divisor=1048576
elif [ $Algo = "x11" ]
then
modifier=4294967296
divisor=1048576
else
modifier=65536
divisor=1048576
fi
TotalHR=`echo "scale=3;$TotalHash * $modifier / $interval / $divisor" | bc`
redis-cli zadd Pool_Stats:avgHR:$Algo $now $TotalHR":"$now
#go over the array of WorkerNames and calculate each workers HR
counterB=0
while [[ $counterB -lt $workercounter ]]
do
counterB=$(($counterB + 1))
workerName=${arrWorkerNames[$counterB]}
echo $workerName
temporary=`echo "scale=6;${arrWorkerTotals[$workerName]} * $modifier" | bc -l`
# number=`echo "$interval / $divisor" | bc -l`
arrWorkerHashRates[$counterB]=`echo "$temporary / $interval / $divisor" | bc -l`
workerName=${arrWorkerNames[$counterB]}
rate=${arrWorkerHashRates[$counterB]}
echo $workerName $rate
string=$rate":"$now
redis-cli zadd Pool_Stats:WorkerHRs:$Algo:$workerName $now $string
echo "$Algo - $workerName -"$arrWorkerHashRates[$counterB]}
done
done< <(redis-cli hkeys Coin_Algos)