0

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.

1

2 Answers 2

1

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->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->getbalance($user['id'], 1);

Get one of your users addresses:

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

To check transactions:

echo $bitcoin->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.

0

That is really a waste of time.

Bitcoin and all other Altcoins which use the blockchain technology are used as the transaction ledger. So Just get/install your crypto ledger, update your ledger of your Bitcoin(altcoin).

When you need to know about particular transaction related to the address just use the pre-built tools to scan ledger.

echo $bitcoin->gettransaction($trans_id);

just shown as above.

There is no need to log each transaction in database, because it is already logged in ledger. so if you want to moniotor some addresses, just create a cronjobs to monitor any transaction and send alert to the user.

9
  • that gets a transaction of a tid. how would you know when an address receives an incoming or it going transaction? Jun 11, 2017 at 13:55
  • That has to be done using cron jobs to monitor the blockchain scanning third party server(blockchain.info) or local wallet installation.
    – Jitendra
    Jun 11, 2017 at 19:04
  • That's the thing, do you use a cron job to monitor the address or you monitor every block and see if there is the monitored address in each block? Jun 12, 2017 at 4:21
  • There are Trillions of possible public key, so it is not viable solution to monitor each and every key. But it is usable if we have a defined limited set of public key from some user. we can use this cronjobs to allow to track Five or Six public key per user for thousand of users without any overhead on Server.
    – Jitendra
    Jun 12, 2017 at 17:59
  • yes i have a list of btc pub keys that i want to monitor. Jun 12, 2017 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.