Author

Topic: Quick and dirty bitcoin and ETH address monitoring (Read 156 times)

full member
Activity: 280
Merit: 101
This is incredibly genius! I need to know where to install this code in order to test-run its functionality.
Hope it works as app o a mobile phone or as an application in a desktop computer.I guess it helps one
to monitor activities in the wallet addresses.
newbie
Activity: 21
Merit: 0
Hello,

 You use a software that I develop for Windows - walletZ - check my thread


 https://bitcointalksearch.org/topic/ann-walletz-the-all-in-one-coin-balance-viewer-2384747

 It has support for alot of coin Smiley Just for monitoring!
newbie
Activity: 40
Merit: 0
Bonsoir, I like it. Had to install jq, but so I learned about it.
newbie
Activity: 29
Merit: 0
Here is a solution that allows to quickly and easily monitor some BTC or ETH addresses, so you can be notified when a transaction is made (receiving or sending coins). An email is sent when address balance has changed. This solution written for bash has the advantage of not requiring the installation of third party packages. Of course it’s quick and dirty, do not wait for a very elaborated code, but the work is done and that’s the main thing.

usage: command address coin(BTC or ETH)

Code:
#!/bin/bash
adresse=$1
crypto=$2
repertoire="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ ! -f "$repertoire"/"$adresse".txt ]; then

        #premiere utilisation, CREATION DU FICHIER

        if [ $crypto = "BTC" ] ; then soldeactuel="$(wget -qO- blockchain.info/rawaddr/"$adresse" 2>&1 | grep -Po '"final_balance":\K[0-9]+' | awk '{s=$1/100000000} END {printf "%0.8f\n", s}')"; fi
        if [ $crypto = "ETH" ] ; then soldeactuel="$(curl -s https://api.gastracker.io/addr/"$adresse" | jq -r '.balance.ether')"; fi
        printf "$soldeactuel" > "$repertoire"/"$adresse".txt
        exit
else
        #le fichier existe, on peut comparer

        anciensolde="$(cat "$repertoire"/"$adresse".txt)"
        if [ $crypto = "BTC" ] ; then soldeactuel="$(wget -qO- blockchain.info/rawaddr/"$adresse" 2>&1 | grep -Po '"final_balance":\K[0-9]+' | awk '{s=$1/100000000} END {printf "%0.8f\n", s}')"; fi
        if [ $crypto = "ETH" ] ; then soldeactuel="$(curl -s https://api.gastracker.io/addr/"$adresse" | jq -r '.balance.ether')"; fi

        if [ $anciensolde != $soldeactuel ]
        then
                # les soldes sont differents
                mail -s  ""$crypto" monitored adress has changed" [email protected] <<< ""$crypto" adress "$adresse" just received a new transaction. Balance is now: "$soldeactuel""
                printf "$soldeactuel" > "$repertoire"/"$adresse".txt
        fi
fi
Jump to: