Bitcoin Forum

Bitcoin => Project Development => Topic started by: tlr on December 15, 2013, 01:50:31 AM



Title: Best way to monitor the network for new transactions/blocks in real-time?
Post by: tlr on December 15, 2013, 01:50:31 AM
I'm looking to develop an app that needs to monitor the Bitcoin network in real time. I'm already able to parse the blockchain into a database, but I'm wondering what the best way to keep the database up to date in real time is?

bitcoind doesn't seem to have a JSON-RPC API for getting streams of new transactions or blocks, does it? I suppose I could monitor the debug.log but that feels hacky.

Is there a better client/library for this purpose? What does blockchain.info do, for example?


Title: Re: Best way to monitor the network for new transactions/blocks in real-time?
Post by: e521 on December 15, 2013, 01:54:55 AM
maybe you can contact http://www.listentobitcoin.com and ask?


Title: Re: Best way to monitor the network for new transactions/blocks in real-time?
Post by: tlr on December 15, 2013, 02:15:09 AM
maybe you can contact http://www.listentobitcoin.com and ask?

I think they use the blockchain.info API, it says "Blockchain.info Transactions: Connected." near the bottom.

I'd rather connect directly to the Bitcoin network.


Title: Re: Best way to monitor the network for new transactions/blocks in real-time?
Post by: artw1982 on December 15, 2013, 02:46:05 AM
Not sure what language you're using but you could use something like a FileSystemWatcher and detect when the blockchain db is updated.


Title: Re: Best way to monitor the network for new transactions/blocks in real-time?
Post by: edmundedgar on December 15, 2013, 10:43:37 AM
I'm looking to develop an app that needs to monitor the Bitcoin network in real time. I'm already able to parse the blockchain into a database, but I'm wondering what the best way to keep the database up to date in real time is?

bitcoind doesn't seem to have a JSON-RPC API for getting streams of new transactions or blocks, does it? I suppose I could monitor the debug.log but that feels hacky.

Is there a better client/library for this purpose? What does blockchain.info do, for example?

I haven't used this but bitcoind has an option called "blocknotify", which looks like it lets you specify a command to run when a new block shows up.
https://en.bitcoin.it/wiki/Running_Bitcoin

That won't help you if you need stuff before it gets into blocks (and it's not for addresses in the local wallet). The sadly-defunct bitping.net used to use a patched version of bitcoind for that:
https://github.com/MORA99/bitcoin/commits/master
...which lets you specify a URL on the command line to notify it about new transactions.

But the patch is a bit old, and I couldn't get the patch to work against more recent versions, so I ended up just running a process to watch debug.log, filtering that for stuff I was interested in and going from there. This does indeed feel hacky, but it's actually quite nice and flexible. It's easy to test (replay whatever you're doing the same log as many times as you like) and easy to catch up if something that needs the data can't keep up.


Title: Re: Best way to monitor the network for new transactions/blocks in real-time?
Post by: malevolent on December 15, 2013, 10:49:23 AM
maybe you can contact http://www.listentobitcoin.com and ask?

Be careful with that site: http://www.reddit.com/r/Bitcoin/comments/1ia7q2/

Use this one: http://www.bitlisten.com/


Title: Re: Best way to monitor the network for new transactions/blocks in real-time?
Post by: bclucho on July 03, 2016, 08:40:23 PM
Have a look to  https://bitbucket.org/camp0/aiengine and https://github.com/sebicas/bitcoin-sniffer, hope it helps