Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Shiroslullaby on July 30, 2016, 05:29:08 PM



Title: Methods to monitor an address
Post by: Shiroslullaby on July 30, 2016, 05:29:08 PM
If I have a known bitcoin address, and wanted to automatically monitor the balance, and possibly even be notified if there is a change in balance,
what are my options to accomplish this?
Are there functions for this built into core, do I need to be running a node, is there a website API for one of the blockchain sites that can accomplish this?

I've done some googling and found a little info, but figured I would ask here since there is probably more than one way to accomplish this,
I'd like to see the advantages/ disadvantages of some different methods.

(I think I should have posted this in Development & Technical Discussion if a mod wants to move it.)
Thanks in advance for any information I can get!


Title: Re: Methods to monitor an address
Post by: SmartIphone on July 30, 2016, 05:47:06 PM
If I have a known bitcoin address, and wanted to automatically monitor the balance, and possibly even be notified if there is a change in balance,
what are my options to accomplish this?
Are there functions for this built into core, do I need to be running a node, is there a website API for one of the blockchain sites that can accomplish this?

I've done some googling and found a little info, but figured I would ask here since there is probably more than one way to accomplish this,
I'd like to see the advantages/ disadvantages of some different methods.

(I think I should have posted this in Development & Technical Discussion if a mod wants to move it.)
Thanks in advance for any information I can get!

Please check a discusion here that was made by SebastianJu few weeks ago about any website/service that monitors a bitcoin address and sends out an email: https://bitcointalk.org/index.php?topic=1536953


Title: Re: Methods to monitor an address
Post by: cpfreeplz on July 30, 2016, 05:54:21 PM
If I have a known bitcoin address, and wanted to automatically monitor the balance, and possibly even be notified if there is a change in balance,
what are my options to accomplish this?
Are there functions for this built into core, do I need to be running a node, is there a website API for one of the blockchain sites that can accomplish this?

I've done some googling and found a little info, but figured I would ask here since there is probably more than one way to accomplish this,
I'd like to see the advantages/ disadvantages of some different methods.

(I think I should have posted this in Development & Technical Discussion if a mod wants to move it.)
Thanks in advance for any information I can get!

An easy method for just watching anytime you open your wallet would be to import a watch-only address. In terms of getting a notification though hmm.. I know blockchain.info has this feature and I'm sure other wallets must too. Depending on what wallet you use you should be able to have a notification. Anyways here it is for blockchain.info : https://blockchain.info/wallet/payment-notifications (https://blockchain.info/wallet/payment-notifications)


Title: Re: Methods to monitor an address
Post by: Shiroslullaby on July 30, 2016, 08:40:03 PM
Hmm thanks for the replies.
These methods would definitely work, but I also want to see if its possible to do this without relying on someone elses website/ email service.

I guess at that point you are looking at running a node yourself and analyzing the blockchain as new transactions come in.
This would be a lot more work but its a project I'm interested in since I'm trying to improve my programming skills and learn more about Bitcoin.


Title: Re: Methods to monitor an address
Post by: PremiumCodeX on July 31, 2016, 02:03:08 PM
I guess at that point you are looking at running a node yourself and analyzing the blockchain as new transactions come in.
This would be a lot more work but its a project I'm interested in since I'm trying to improve my programming skills and learn more about Bitcoin.

As you wrote, you could look at running a node yourself and analyze the blockchain with a kind of explorer. I advise you to check out some open-source BTC block explorers to get some view about the topic, but probably you will have to find the code for the method in addition.


Title: Re: Methods to monitor an address
Post by: coinableS on August 04, 2016, 04:58:26 AM
Hmm thanks for the replies.
These methods would definitely work, but I also want to see if its possible to do this without relying on someone elses website/ email service.

I guess at that point you are looking at running a node yourself and analyzing the blockchain as new transactions come in.
This would be a lot more work but its a project I'm interested in since I'm trying to improve my programming skills and learn more about Bitcoin.

I posted an answer to this a few months back on bitcoin.stackexchange http://bitcoin.stackexchange.com/questions/44373/how-would-one-monitor-an-address-for-a-transaction-and-1-confirmation-in-php

Start a new node at home that will be connected 24/7.
In your bitcoin.conf set a walletnotify

Make sure the address you are monitoring is imported into your bitcoind wallet.
Set wallet notify up in your bitcoin.conf

   
Code:
 walletnotify=curl https://yourwebsite.com/script.php?txid=%s

Now anytime there is activity on your bitcoind wallet your script will run, with the transaction id stored in a GET under `["txid"]` and then you can do a script like:

   
Code:
require("easybitcoin.php");
    $bitcoin = new Bitcoin("someusername", "somepassword");
   
    $txid = $_GET["tx"];
    $txinfo = $bitcoin->gettransaction($txid);
    $details = count($txinfo["details"]);

    for($i=0;$i<$details;$i++){
    $check = $txinfo["details"][$i]["address"];
    $addy = "1SomeAddressToMonitor";
        if($check == $addy){
        //activity on your address, do something like send an email
         $email = "my@email.com";
         $subject = "New Activity";
         $body - "There was a transaction on ".$addy.". The transaction ID is ".$txid;
         mail($email, $subject, $body);
        }
    }


Title: Re: Methods to monitor an address
Post by: bitdumper on August 07, 2016, 04:10:41 PM
you can use the blockchain api and json parcing so you will get the current balance from the bitcoin address and you can then store the result in database and then check for update with curl and then you can send it into email when new balance comes


Title: Re: Methods to monitor an address
Post by: klaaas on August 08, 2016, 04:52:03 PM
A mix up from https://bitcointalk.org/index.php?topic=27669;all and http://bitnotify.com would be cool.

Some reference., https://en.bitcoin.it/wiki/BitcoinNotify