Author

Topic: Best way to monitor the network for new transactions/blocks in real-time? (Read 957 times)

sr. member
Activity: 352
Merit: 250
https://www.realitykeys.com
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.
full member
Activity: 196
Merit: 100
Not sure what language you're using but you could use something like a FileSystemWatcher and detect when the blockchain db is updated.
tlr
member
Activity: 86
Merit: 10
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.
full member
Activity: 196
Merit: 100
tlr
member
Activity: 86
Merit: 10
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?
Jump to: