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)
#!/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" someemail@gmail.com <<< ""$crypto" adress "$adresse" just received a new transaction. Balance is now: "$soldeactuel""
printf "$soldeactuel" > "$repertoire"/"$adresse".txt
fi
fi