Building an blockchain address monitoring service. Best way to monitor an address for bitcoin and other altcoins? I'm looking to build a blockchain address monitoring service for bitcoin and other altcoins. What is the best way to monitor a bunch of addresses for incoming/outgoing transactions? 

Currently I wrote a php script that checks the address every 5 minutes for any new activity and then store this data to a file and then another 5 minutes I fetch the data again and diff the file to see any differences and if so do something. 

Another method I was thinking was to fetch each block as its mined then see if any of the addresses match what I have listed then do something.
Since you mentioned PHP you can install a Bitcoin Node on your server and then use EasyBitcoin-PHP: https://github.com/aceat64/EasyBitcoin-PHP 

Then use the Bitcoin API:
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

To list all transactions associated with an account:

echo $bitcoin-&gt;getreceivedbyaddress($btc_address);


"Returns the amount received by  in transactions with at least [minconf] confirmations. It correctly handles the case where someone has sent to the address in multiple transactions. Keep in mind that addresses are only ever used for receiving transactions. Works only for addresses in the local wallet, external addresses will always show 0."

So you could run this and compare with your DB to see if a new transaction appears that isn't already in the DB.

--

To monitor a balance of an account you can just check on each page load (and update your DB if you wanted to):

echo $bitcoin-&gt;getbalance($user['id'], 1);


Get one of your users addresses:

echo $bitcoin-&gt;getaccount($user['id']);


To check transactions:

echo $bitcoin-&gt;gettransaction($trans_id);


--

You could also use an API:
How to get the list of transactions of input/outputs for a bitcoin address in JSON format?

--

I'm not 100% sure what you're asking for but I hope what I provide helps you.