Bitcoin Forum
May 14, 2024, 02:37:32 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Quick and dirty bitcoin and ETH address monitoring  (Read 141 times)
klama98 (OP)
Newbie
*
Offline Offline

Activity: 29
Merit: 0


View Profile
January 08, 2018, 02:01:13 PM
 #1

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" someemail@gmail.com <<< ""$crypto" adress "$adresse" just received a new transaction. Balance is now: "$soldeactuel""
                printf "$soldeactuel" > "$repertoire"/"$adresse".txt
        fi
fi
"You Asked For Change, We Gave You Coins" -- casascius
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715654252
Hero Member
*
Offline Offline

Posts: 1715654252

View Profile Personal Message (Offline)

Ignore
1715654252
Reply with quote  #2

1715654252
Report to moderator
1715654252
Hero Member
*
Offline Offline

Posts: 1715654252

View Profile Personal Message (Offline)

Ignore
1715654252
Reply with quote  #2

1715654252
Report to moderator
1715654252
Hero Member
*
Offline Offline

Posts: 1715654252

View Profile Personal Message (Offline)

Ignore
1715654252
Reply with quote  #2

1715654252
Report to moderator
cryptocropty
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
January 11, 2018, 07:50:59 PM
 #2

Bonsoir, I like it. Had to install jq, but so I learned about it.
mortalys
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile WWW
January 11, 2018, 10:42:06 PM
 #3

Hello,

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


 https://bitcointalk.org/index.php?topic=2384747

 It has support for alot of coin Smiley Just for monitoring!
stantpro
Full Member
***
Offline Offline

Activity: 280
Merit: 101



View Profile
January 12, 2018, 03:41:32 PM
 #4

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!