diff --git a/a-team/scripts.notary/btc_splitfunds b/a-team/scripts.notary/btc_splitfunds index 30f8b3b..73fd08d 100755 --- a/a-team/scripts.notary/btc_splitfunds +++ b/a-team/scripts.notary/btc_splitfunds @@ -17,4 +17,5 @@ if [ "$UTXOS" -lt "99" ] RESULT="$(acsplit BTC 20)" print_txid "$RESULT" fi +echo "" echo "---------------------------------------------------------------------------------------------" diff --git a/a-team/scripts.notary/sendawaynn.sh b/a-team/scripts.notary/sendawaynn.sh index ce7025a..4dbbf49 100755 --- a/a-team/scripts.notary/sendawaynn.sh +++ b/a-team/scripts.notary/sendawaynn.sh @@ -24,7 +24,7 @@ echo 'Balance: '$balance if (( $(echo "$balance < 11" | bc -l) )); then echo "----------------------------------------------------------------" echo " " - exit +# exit fi # Set the send to address, and send all coinbase transactions @@ -36,9 +36,10 @@ hex=$(curl -s --user $curluser:$curlpass --data-binary "@$curdir/createrawtx.cur nlocktime=$(printf "%08x" $(date +%s) | dd conv=swab 2> /dev/null | rev) hex=${hex::-8}$nlocktime signed=$(curl -s --user $curluser:$curlpass --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "signrawtransaction", "params": ["'$hex'"]}' -H 'content-type: text/plain;' http://127.0.0.1:$curlport/ | jq -r .result.hex) +echo $signed #Broadcast the transaction -txid=$(curl -s --user $curluser:$curlpass --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendrawtransaction", "params": ["'$signed'"]}' -H 'content-type: text/plain;' http://127.0.0.1:$curlport/ | jq -r .result) +#txid=$(curl -s --user $curluser:$curlpass --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendrawtransaction", "params": ["'$signed'"]}' -H 'content-type: text/plain;' http://127.0.0.1:$curlport/ | jq -r .result) #echo $txid echo "----------------------------------------------------------------" echo " " diff --git a/a-team/scripts.notary/startassets b/a-team/scripts.notary/startassets index d40242e..9e1ef85 100755 --- a/a-team/scripts.notary/startassets +++ b/a-team/scripts.notary/startassets @@ -1,31 +1,19 @@ #!/bin/bash set -eo pipefail +delay=10 source ~/komodo/src/pubkey.txt overide_args="${@}" extra_args="-connect=172.16.16.11" source skip -#wait for deamon to start -delay () { - started=0 - while [[ $started -eq 0 ]]; do - sleep 5 - komodo-cli $1 getbalance - outcome=$(echo $?) - if [[ $outcome -eq 0 ]]; then - started=1 - fi - done -} - verusd $overide_args $extra_args -pubkey=$pubkey & -delay -ac_name=VRSC +sleep $delay ~/komodo/src/listassetchainparams | while read args; do if [[ " ${skip[@]} " =~ " ${args} " ]]; then pointless=0 else komodod $args $overide_args $extra_args -pubkey=$pubkey & - delay $(echo $args | awk '{print $2}') + sleep $delay fi done diff --git a/dragonriders/dokomodo/yaml/config.ini b/dragonriders/dokomodo/yaml/config.ini index 97fac67..a805c15 100644 --- a/dragonriders/dokomodo/yaml/config.ini +++ b/dragonriders/dokomodo/yaml/config.ini @@ -34,7 +34,7 @@ write_path_conf = ~/.komodo # List of assetchains to be started, it does not mean when they ar estarted that they are also notarized!!! # List is used to create configuration files for assetchains # to access its data in central registry file -production_coins_assets = REVS, SUPERNET, DEX, PANGEA, JUMBLR, BET, CRYPTO, HODL, MSHARK, BOTS, MGW, COQUI, WLC, KV, CEAL, MESH, MNZ, AXO, ETOMIC, BTCH, VOTE2018, PIZZA, BEER, NINJA, OOT, BNTN, CHAIN, PRLPAY, DSEC +production_coins_assets = REVS, SUPERNET, DEX, PANGEA, JUMBLR, BET, CRYPTO, HODL, MSHARK, BOTS, MGW, COQUI, WLC, KV, CEAL, MESH, MNZ, AXO, ETOMIC, BTCH, VOTE2018, PIZZA, BEER, NINJA, OOT, BNTN, CHAIN, PRLPAY, DSEC, GLXT, EQL, ZILLA, RFOX, SEC development_coins_assets = PIZZA, BEER @@ -50,7 +50,7 @@ iguana_url = http://%(iguana_host)s:%(iguana_rpc_port)s # List of chains which will be notarized!!! # This will be used mostly for iguana methods, this list will be used in loop and key of coin will be used # to access its data in central registry file -production_coins = KMD, BTC, LTC, CHIPS, REVS, SUPERNET, DEX, PANGEA, JUMBLR, BET, CRYPTO, HODL, MSHARK, BOTS, MGW, COQUI, WLC, KV, CEAL, MESH, MNZ, AXO, ETOMIC, BTCH, VOTE2018, NINJA, OOT, BNTN, CHAIN, PRLPAY, GAME, DSEC +production_coins = KMD, BTC, LTC, CHIPS, REVS, SUPERNET, DEX, PANGEA, JUMBLR, BET, CRYPTO, HODL, MSHARK, BOTS, MGW, COQUI, WLC, KV, CEAL, MESH, MNZ, AXO, ETOMIC, BTCH, VOTE2018, NINJA, OOT, BNTN, CHAIN, PRLPAY, GAME, DSEC, GLXT, EQL, ZILLA, VRSC, RFOX, SEC development_coins = KMD, PIZZA, BEER diff --git a/webworker01/README.md b/webworker01/README.md index 46c76a2..184ccee 100644 --- a/webworker01/README.md +++ b/webworker01/README.md @@ -6,8 +6,6 @@ Script Name | Function **checkforks** | Script to quickly check all assetchains for possible forks **checkmasks** | Check your nodes connectivity to the notary node network **coinlist** | Handy way to keep coin list in one place for other scripts to use (thanks to a-team) -**fail2banstatusall** | Get stats of fail2ban jails -**freshubuntu** | Run this for initial setup of your server for basic security needs (generalized on purpose so it can be used on any server) **killemall** | Hard kill komodo related processes **killthemsoftly** | Kill komodo processes nicely **kmdacfirewall** | UFW settings with commentary @@ -18,5 +16,7 @@ Script Name | Function **start** | Start chipsd and komodod **startac** | Start assetchains **stats** | Fancy cli stats for notary nodes +**fail2banstatusall** | Moved to https://github.com/webworker01/freshubuntu +**freshubuntu** | Moved to https://github.com/webworker01/freshubuntu Donate to motivate! :D RNFgPeabWXWeSq2NnYfvdsjuok5Tccd7xM diff --git a/webworker01/checkfork b/webworker01/checkfork index 4b14779..7c53a70 100755 --- a/webworker01/checkfork +++ b/webworker01/checkfork @@ -1,42 +1,100 @@ #!/bin/bash +#You can modify this list of ACs to exclude or comment out the line to show all +ignoreacs=('VOTE2018' 'BEER' 'PIZZA') + +#how far ahead or behind before being marked as a fork +variance=3 + source coinlist forked=false +remotecheck=$(curl -Ssf https://komodostats.com/api/notary/summary.json) +remotecheck2=$(curl -Ssf https://dexstats.info/api/explorerstatus.php) + +format="%-8s %8s %8s %8s %8s\n" +redformat="\033[0;31m$format\033[0m" +printf "$format" "-ASSET-" "-BLOCKS-" "-LONG-" "-RMT1-" "-RMT2-" + +#KMD blocks=$(komodo-cli getinfo | jq .blocks) longest=$(komodo-cli getinfo | jq .longestchain) - +remoteblocks=$(echo $remotecheck | jq '.[] | select(.ac_name=="KMD") | .blocks') +remoteblocks2=$(echo $remotecheck2 | jq '.status[] | select(.chain=="KMD") | .height | tonumber') +diff1=$((blocks-remoteblocks)) +diff2=$((blocks-remoteblocks2)) +thisformat=$format if ((blocks < longest)); then forked=true - printf "\033[0;31mKMD - Possible fork!\033[0m Blocks $blocks < LongestChain $longest\n" -else - echo "KMD - Blocks $blocks = LongestChain $longest" + thisformat=$redformat +fi +if (( diff1 < variance * -1 )) || (( diff1 > variance )); then + forked=true + thisformat=$redformat +fi +if (( diff2 < variance * -1 )) || (( diff2 > variance )); then + forked=true + thisformat=$redformat fi +printf "$thisformat" "KMD" "$blocks" "$longest" "$remoteblocks" "$remoteblocks2" +#CHIPS blocks=$(chips-cli getinfo | jq .blocks) longest=$(chips-cli getinfo | jq .headers) - +remoteblocks=$(echo $remotecheck | jq '.[] | select(.ac_name=="CHIPS") | .blocks') +diff1=$((blocks-remoteblocks)) +thisformat=$format if ((blocks < longest)); then forked=true - printf "\033[0;31mCHIPS - Possible fork!\033[0m Blocks $blocks < Headers $longest\n" -else - echo "CHIPS - Blocks $blocks = Headers $longest" + thisformat=$redformat +fi +if (( diff1 < variance * -1 )) || (( diff1 > variance )); then + forked=true + thisformat=$redformat +fi +printf "$thisformat" "CHIPS" "$blocks" "$longest" "$remoteblocks" + +#GAME +blocks=$(gamecredits-cli getinfo | jq .blocks) +remoteblocks=$(echo $remotecheck | jq '.[] | select(.ac_name=="GAME") | .blocks') +diff1=$((blocks-remoteblocks)) +thisformat=$format +if (( diff1 < variance * -1 )) || (( diff1 > variance )); then + forked=true + thisformat=$redformat fi +printf "$thisformat" "GAME" "$blocks" " " "$remoteblocks" for coins in "${coinlist[@]}"; do coin=($coins) - - blocks=$(komodo-cli -ac_name=${coin[0]} getinfo | jq .blocks) - longest=$(komodo-cli -ac_name=${coin[0]} getinfo | jq .longestchain) - if ((blocks < longest)); then - forked=true - printf "\033[0;31m${coin[0]} - Possible fork!\033[0m Blocks $blocks < LongestChain $longest\n" - else - echo "${coin[0]} - Blocks $blocks = LongestChain $longest" + if [[ ! ${ignoreacs[*]} =~ ${coin[0]} ]]; then + + blocks=$(komodo-cli -ac_name=${coin[0]} getinfo | jq .blocks) + longest=$(komodo-cli -ac_name=${coin[0]} getinfo | jq .longestchain) + remoteblocks=$(echo $remotecheck | jq --arg acname ${coin[0]} '.[] | select(.ac_name==$acname) | .blocks') + remoteblocks2=$(echo $remotecheck2 | jq --arg acname ${coin[0]} '.status[] | select(.chain==$acname) | .height | tonumber') + diff1=$((blocks-remoteblocks)) + diff2=$((blocks-remoteblocks2)) + thisformat=$format + if ((blocks < longest)); then + forked=true + thisformat=$redformat + fi + if (( diff1 < variance * -1 )) || (( diff1 > variance )); then + forked=true + thisformat=$redformat + fi + if (( diff2 < variance * -1 )) || (( diff2 > variance )); then + forked=true + thisformat=$redformat + fi + printf "$thisformat" "${coin[0]}" "$blocks" "$longest" "$remoteblocks" "$remoteblocks2" fi done if [ "$forked" = false ]; then printf "\033[0;32mAll coins are fine\033[0m\n" +else + printf "\033[0;31mPossible fork!\033[0m\n" fi \ No newline at end of file diff --git a/webworker01/coinlist b/webworker01/coinlist index fab3665..1214984 100644 --- a/webworker01/coinlist +++ b/webworker01/coinlist @@ -19,6 +19,7 @@ coinlist=( 'AXO 200000000' 'ETOMIC 100000000' 'BTCH 20998641' +'VOTE2018 600000000' 'PIZZA 100000000' 'BEER 100000000' 'NINJA 100000000' @@ -27,4 +28,9 @@ coinlist=( 'CHAIN 999999' 'PRLPAY 500000000' 'DSEC 7000000' +'GLXT 100000000' +'EQL 500000000' +'ZILLA 11000000' +'RFOX 1000000000' +'VRSC 0' ) diff --git a/webworker01/fail2banstatusall b/webworker01/fail2banstatusall deleted file mode 100755 index c5b3136..0000000 --- a/webworker01/fail2banstatusall +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -JAILS=`sudo fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'` -for JAIL in $JAILS -do - sudo fail2ban-client status $JAIL -done diff --git a/webworker01/freshubuntu b/webworker01/freshubuntu deleted file mode 100755 index 23f726c..0000000 --- a/webworker01/freshubuntu +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -if [ "$EUID" -ne 0 ] -then - echo -e "\e[41mPlease use sudo or run as root...\e[0m" - exit -fi - -read -p "Configure timezone & locale? (y/n) " -n 1 DOLOCALE -echo -if [[ $DOLOCALE =~ ^[Yy]$ ]] -then - dpkg-reconfigure tzdata - dpkg-reconfigure locales -fi - -read -p "Upgrade packages? (y/n) " -n 1 DOUPGRADES -echo -if [[ $DOUPGRADES =~ ^[Yy]$ ]] -then - apt-get update && apt-get -y dist-upgrade -fi - -read -p "Install extra tools? (y/n) " -n 1 DOEXTRAS -echo -if [[ $DOEXTRAS =~ ^[Yy]$ ]] -then - apt -y install fail2ban ufw git curl bash-completion htop jq -fi - -read -p "Update hostname? (y/n) " -n 1 DOHOSTNAME -echo -if [[ $DOHOSTNAME =~ ^[Yy]$ ]] -then - read -p "Enter hostname: " NEWHOSTNAME - echo "$NEWHOSTNAME" > /etc/hostname - sed -i "1i127.0.0.1 ${NEWHOSTNAME}" /etc/hosts -fi - -read -p "Disable IPV6? (y/n) " -n 1 DOIPV6 -echo - -if [[ $DOIPV6 =~ ^[Yy]$ ]] -then - echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf - echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf - echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf - sysctl -p -fi - -read -p "Configure UFW? (This will only allow incoming port 22) (y/n) " -n 1 DOUFW -echo -if [[ $DOUFW =~ ^[Yy]$ ]] -then - ufw default deny incoming - ufw default allow outgoing - ufw allow 22 comment 'SSH' - ufw enable - systemctl enable ufw - ufw status -fi - -read -p "Add non-root sudo user? (y/n) " -n 1 DONONROOT -echo -if [[ $DONONROOT =~ ^[Yy]$ ]] -then - read -p "Enter user name: " NEWUSERNAME - echo - useradd -m $NEWUSERNAME - adduser $NEWUSERNAME sudo - passwd $NEWUSERNAME - sudo chsh $NEWUSERNAME -s /bin/bash - - grep -q "^[#]*force_color_prompt=" /home/$NEWUSERNAME/.bashrc && sed -i "/^[#]*force_color_prompt=/c\force_color_prompt=yes" /home/$NEWUSERNAME/.bashrc - - source /home/$NEWUSERNAME/.bashrc - - read -p "Please enter the public key (and label if desired) for $NEWUSERNAME (not recommended: enter to skip): " NEWUSERPUBKEY - if [[ ! -z "$NEWUSERPUBKEY" ]] - then - mkdir -p /home/$NEWUSERNAME/.ssh/ - echo "ssh-rsa $NEWUSERPUBKEY" >> /home/$NEWUSERNAME/.ssh/authorized_keys - chmod -R 700 /home/$NEWUSERNAME/.ssh/ - chown -R $NEWUSERNAME:$NEWUSERNAME /home/$NEWUSERNAME/.ssh/ - - read -p "Copy key to root user? " -n 1 DOROOTKEY - if [[ $DOROOTKEY =~ ^[Yy]$ ]] - then - mkdir -p /root/.ssh - cp /home/$NEWUSERNAME/.ssh/authorized_keys /root/.ssh/ - chown -R root:root /root/.ssh/ - chmod -R 700 /root/.ssh/ - fi - fi - - read -p "Please login with the SSH key on the new user now to verify connectivity. Have you completed this? (y/n) " -n 1 TESTEDCONNECTIVITY - echo - if [[ $TESTEDCONNECTIVITY =~ ^[Yy]$ ]] - then - read -p "Disable root login? " -n 1 DOROOTDISABLE - echo - if [[ $DOROOTDISABLE =~ ^[Yy]$ ]] - then - grep -q "^[#]*PermitRootLogin" /etc/ssh/sshd_config && sed -i "/^[#]*PermitRootLogin/c\PermitRootLogin no" /etc/ssh/sshd_config || echo "PermitRootLogin no" >> /etc/ssh/sshd_config - fi - - grep -q "^[#]*PubkeyAuthentication" /etc/ssh/sshd_config && sed -i "/^[#]*PubkeyAuthentication/c\PubkeyAuthentication yes" /etc/ssh/sshd_config || echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config - grep -q "^[#]*ChallengeResponseAuthentication" /etc/ssh/sshd_config && sed -i "/^[#]*ChallengeResponseAuthentication/c\ChallengeResponseAuthentication no" /etc/ssh/sshd_config || echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config - grep -q "^[#]*PasswordAuthentication" /etc/ssh/sshd_config && sed -i "/^[#]*PasswordAuthentication/c\PasswordAuthentication no" /etc/ssh/sshd_config || echo "PasswordAuthentication no" >> /etc/ssh/sshd_config - - systemctl restart sshd.service - else - echo -e "\e[41mSorry, it won't be safe to do the final steps here then... take care.\e[0m" - fi -fi - \ No newline at end of file diff --git a/webworker01/kmdacfirewall b/webworker01/kmdacfirewall index 6204b6c..ba3cae4 100755 --- a/webworker01/kmdacfirewall +++ b/webworker01/kmdacfirewall @@ -38,6 +38,7 @@ sudo ufw allow 14357 comment 'BNTN' sudo ufw allow 15586 comment 'CHAIN' sudo ufw allow 9678 comment 'PRLPAY' sudo ufw allow 40002 comment 'GAME' +sudo ufw allow 11556 comment 'DSEC' sudo ufw allow 15722 comment 'GLXT' sudo ufw allow 10305 comment 'EQL' sudo ufw enable diff --git a/webworker01/stats b/webworker01/stats index 2948c27..71cafcb 100755 --- a/webworker01/stats +++ b/webworker01/stats @@ -1,7 +1,7 @@ #!/bin/bash #Stats script for Komodo Notary Nodes # -#Requires jq v1.5+ and bitcoin-cli, komodo-cli and chips-cli installed (e.g. symlinked to /usr/local/bin) +#Requires jq v1.5+ and bitcoin-cli, komodo-cli, chips-cli and gamecredits-cli installed (e.g. symlinked to /usr/local/bin) #==Options - Only Change These== @@ -14,10 +14,17 @@ txscanamount=77777 #You can modify this list of ACs to exclude or comment out the line to show all ignoreacs=('VOTE2018' 'BEER' 'PIZZA') +#git checking - path and remote branch +declare -A repos=( +[KMD]='$HOME/komodo origin/dev' +[SUPERNET]='$HOME/SuperNET origin/dev' +[CHIPS]='$HOME/chips3 origin/dev' +[GAME]='/home/gamecredits/GameCredits origin/master' +) + #==End Options== -timeSince() -{ +timeSince () { local currentimestamp=$(date +%s) local timecompare=$1 @@ -46,6 +53,41 @@ timeSince() fi } +checkRepo () { + if [ -z $1 ] || [ -z $2 ] || [ -z $3 ]; then + return + fi + + prevdir=${PWD} + + eval cd "$2" + + color_red=$'\033[0;31m' + color_reset=$'\033[0m' + + git remote update > /dev/null 2>&1 + + localrev=$(git rev-parse HEAD) + remoterev=$(git rev-parse $3) + cd $prevdir + + if [ $localrev != $remoterev ]; then + printf "$color_red[U]$color_reset" + fi + + case $1 in + KMD) + printf " " + ;; + CHIPS) + printf " " + ;; + GAME) + printf " " + ;; + esac +} + #Do not change below for any reason! #The BTC and KMD address here must remain the same. Do not need to enter yours! source coinlist @@ -58,7 +100,7 @@ timefilter=1525032458 #Second time filter for assetchains (SuperNET commit 07515fb) timefilter2=1525513998 -format="%-8s %7s %6s %7s %12.8f %8s %7s %7s\n" +format="%-11s %6s %6s %7s %.12s %6s %6s %6s" othercoins=( 'CHIPS chips-cli' @@ -69,31 +111,32 @@ outputstats () { count=0 totalntrzd=0 - now=$(date +"%Y-%m-%d %T%z") + now=$(date +"%H:%M") printf "\n\n" - printf "%-8s %7s %6s %7s %12s %8s %7s %7s\n" "-ASSET-" "-NTRZd-" "-UTXO-" "-BLOX-" "-BALANCE-" "-LAST-" "-CNCT-"; + printf "%-11s %6s %6s %7s %12s %6s %6s %6s\n" "-ASSET-" "-NOTR-" "-UTXO-" "-BLOX-" "-BALANCE-" "-LAST-" "-CNCT-"; btctxinfo=$(bitcoin-cli listtransactions "" $txscanamount) btclastntrztime=$(echo $btctxinfo | jq -r --arg address "$btcntrzaddr" '[.[] | select(.address==$address)] | sort_by(.time) | last | "\(.time)"') btcntrzd=$(echo $btctxinfo | jq --arg address "$btcntrzaddr" --arg timefilter $timefilter '[.[] | select(.time>=($timefilter|tonumber) and .address==$address and .category=="send")] | length') totalntrzd=$(( $totalntrzd + $btcntrzd )) - printf "$format" "BTC" \ + printf "$format\n" "BTC" \ "$btcntrzd" \ "$(bitcoin-cli listunspent | jq --arg amt "$utxoamt" '[.[] | select(.amount==($amt|tonumber))] | length')" \ "$(bitcoin-cli getblockchaininfo | jq .blocks)" \ - "$(bitcoin-cli getbalance)" \ + "$(printf "%12.8f" $(bitcoin-cli getbalance))" \ "$(timeSince $btclastntrztime)" \ "$(bitcoin-cli getnetworkinfo | jq .connections)" kmdinfo=$(komodo-cli getinfo) kmdtxinfo=$(komodo-cli listtransactions "" $txscanamount) kmdlastntrztime=$(echo $kmdtxinfo | jq -r --arg address "$kmdntrzaddr" '[.[] | select(.address==$address)] | sort_by(.time) | last | "\(.time)"') - printf "%-8s %7s %6s %7s %.12s %8s %7s %7s\n" "KMD" \ + repo=(${repos[KMD]}) + printf "$format\n" "KMD$(checkRepo KMD ${repo[0]} ${repo[1]})" \ " " \ "$(komodo-cli listunspent | jq --arg amt "$utxoamt" '[.[] | select(.amount==($amt|tonumber))] | length')" \ "$(echo $kmdinfo | jq .blocks)" \ - "$(echo $kmdinfo | jq .balance)" \ + "$(printf "%12.8f" $(echo $kmdinfo | jq .balance))" \ "$(timeSince $kmdlastntrztime)" \ "$(echo $kmdinfo | jq .connections)" \ "$(echo $kmdtxinfo | jq '[.[] | select(.generated==true)] | length') mined" @@ -114,43 +157,56 @@ outputstats () coinslastntrztime=$(echo $coinstxinfo | jq -r --arg address "$coinsntraddr" '[.[] | select(.address==$address)] | sort_by(.time) | last | "\(.time)"') coinsntrzd=$(echo $coinstxinfo | jq --arg address "$coinsntraddr" --arg timefilter $timefilter2 '[.[] | select(.time>=($timefilter|tonumber) and .address==$address and .category=="send")] | length') totalntrzd=$(( $totalntrzd + $coinsntrzd )) - - printf "$format" "${coin[0]}" \ + repo=(${repos[${coin[0]}]}) + printf "$format\n" "${coin[0]}$(checkRepo ${coin[0]} ${repo[0]} ${repo[1]})" \ "$coinsntrzd" \ "$(${coin[1]} listunspent | jq --arg amt "$coinsutxoamount" '[.[] | select(.amount==($amt|tonumber))] | length')" \ "$(echo $coinsinfo | jq .blocks)" \ - "$(echo $coinsinfo | jq -r '. | (.balance|tostring)')" \ + "$(printf "%12.8f" $(echo $coinsinfo | jq -r '. | (.balance|tostring)'))" \ "$(timeSince $coinslastntrztime)" \ "$(echo $coinsinfo | jq .connections)" done + lastcoin=(${coinlist[-1]}) + secondlast=(${coinlist[-2]}) for coins in "${coinlist[@]}"; do coin=($coins) - if [[ ! ${ignoreacs[*]} =~ ${coin[0]} ]] - then + if [[ ! ${ignoreacs[*]} =~ ${coin[0]} ]]; then info=$(komodo-cli -ac_name=${coin[0]} getinfo) mininginfo=$(komodo-cli -ac_name=${coin[0]} getmininginfo) txinfo=$(komodo-cli -ac_name=${coin[0]} listtransactions "" $txscanamount) lastntrztime=$(echo $txinfo | jq -r --arg address "$kmdntrzaddr" '[.[] | select(.address==$address)] | sort_by(.time) | last | "\(.time)"') acntrzd=$(echo $txinfo | jq --arg address "$kmdntrzaddr" --arg timefilter $timefilter2 '[.[] | select(.time>=($timefilter|tonumber) and .address==$address and .category=="send")] | length') totalntrzd=$(( $totalntrzd + $acntrzd )) - printf "$format" "${coin[0]}" \ + repo=(${repos[${coin[0]}]}) + laststring="" + + if [[ ${coin[0]} == ${lastcoin[0]} ]]; then + laststring="@ $now" + fi + if [[ ${coin[0]} == ${secondlast[0]} ]]; then + laststring="All:$totalntrzd" + fi + + printf "$format" "${coin[0]}$(checkRepo ${coin[0]} ${repo[0]} ${repo[1]})" \ "$acntrzd" \ "$(komodo-cli -ac_name=${coin[0]} listunspent | jq --arg amt "$utxoamt" '[.[] | select(.amount==($amt|tonumber))] | length')" \ "$(echo $info | jq .blocks)" \ - "$(echo $info | jq .balance)" \ + "$(printf "%12.8f" $(echo $info | jq .balance))" \ "$(timeSince $lastntrztime)" \ - "$(echo $info | jq .connections)" + "$(echo $info | jq .connections)" \ + "$laststring" + + if [[ ${coin[0]} != ${lastcoin[0]} ]]; then + echo + fi fi done - printf "Total: %9s %44s" "$totalntrzd" "$now"; } -if [ "$sleepytime" != "false" ] -then - while true - do +if [ "$sleepytime" != "false" ]; then + while true; do outputstats sleep $sleepytime done