Closed jeong760 closed 7 years ago
Dears,
Following is my pool profit.sh I've added a This_Shift="date +%s
" in order to get Shift number.
Becuase I operate two separate servers for uNOMP and Coin Daemons
declare -A ProArr
declare -A NameArr
AlgoCounter=0
now="date +%s
"
This_Shift="date +%s
"
This_Shift=redis-cli hset Pool_Stats This_Shift $This_Shift
ShiftNumber=redis-cli hget Pool_Stats This_Shift
echo "$ShiftNumber"
starttime=$ShiftNumber
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 Dashcoin
TgtCoinPrice=redis-cli hget Exchange_Rates Dogecoin
TgtCoinPrice=redis-cli hget Exchange_Rates Litecoin
TgtCoinPrice=redis-cli hget Exchange_Rates Namecoin
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
while read line do AlgoTotal=0 AlgoTotalTgtCoin=0 logkey2="Pool_Stats:CurrentShift:Algos" logkey2TgtCoin="Pool_Stats:CurrentShift:AlgosTgtCoin" echo "LOGKEY2: $logkey2"
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`
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`
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)
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
Dears,
Here I attached a current Redis DB scheme of my private pools. but I think that still need to change or need to improve more.
Regards, John Ahn
Dears,
Current configuration is following and I want to make a correct DB scheme on Redis to support these mining options.
Bitcoin merged mining with BTC and Namecoin together. Scrypt merged mining with LTC and Dogecoin together Dash is only for Dash
Regards, John Ahn
Dears,
I am trying to configuration multipool coins using uNOMP but there is no sample reference for correct DB scheme.
I have created some DB table as manually but not sure it was correct or not. so I need to your help or assist for correct DB scheme create ways and want to share that method with others.
However that I know of except above DB hashtables following tables need to create for the script files on /unomp/multipool
PoolStats:Profitability
Pool_Stats:WorkerHRs::
Pool_Stats:CurrentShift:AlgosBTC Pool_Stats:CurrentShift:AlgosTgtCoin Pool_Stats:CurrentShift:CoinsBTC Pool_Stats:Balances Pool_Stats:DetailedPayouts:
Pool_Stats:DetailedPayouts::
Pool_Stats:TotalPaid
Pool_Stats:CurrentShift
Regards, John Ahn