# Gavin Andresen # 2011-01-06 18:38:27 # https://bitcointalk.org/index.php?topic=2647.msg35879#msg35879 I've been reworking my old 'monitorreceived' patch to catch up with the latest JSON api changes, and I'm looking for feedback. @p{par} New methods I've already implemented: @p{par} @p{(li}monitorblocks @p{lt}url@s{gt} [monitor=true]: POSTs a JSON-RPC notification to @p{lt}url@s{gt} when new blocks are accepted.@p{li)} @p{(li}listmonitored : returns list of URLs that are monitoring new blocks@p{li)} @p{(li}getblock @p{lt}depth@s{gt} : Returns information about block at depth @p{lt}depth@s{gt}@p{li)} @p{brk} getblock/monitorblocks give this information (this is one of the -testnet blocks): @p{brk} Code: { @p{brk} "hash":"000000002eb339613fd83ea65f3620cc85a8247893ea7f1f85e40fc9632db50f", @p{brk} "blockcount":21109, @p{brk} "version":1, @p{brk} "merkleroot":"c0efb898417b55dbec645eeda3e5a3c092c22e21e17f423876e858bc223e721c", @p{brk} "time":1294269726, @p{brk} "nonce":595884571, @p{brk} "difficulty":4.81431771, @p{brk} "tx":[ @p{brk} "ea214bb68aeca12eea6e8467b3b72dcf4c3aef0de015e5d21b51d63ed9fba1a9", @p{brk} "90727f2409ea326fcb5e218c1c4213608bf3f2e9d18b3191e52fff86ccda7701" @p{brk} ], @p{brk} "hashprevious":"0000000002889316c2e34614eadcafea44cf0899945dde0da0fa7a765058aca6" @p{brk} } @p{brk} The monitor JSON-RPC notification wraps that information with a call to "monitorblock" @p{--} see @s{(link)} for exactly what a notification looks like. @p{par} I'm thinking about adding notification for 0-confirmation wallet transactions, too; something like: @p{par} monitortx @p{lt}url@s{gt} [monitor=true] : POST to url when wallet transactions (sends and receives) are accepted. @p{par} Information posted would be the same as you get from calling gettransaction, and I'll change listmonitored to return lists of { "category" : block/tx, "url" : url }. @p{par} Possible reasons @p{(bf}NOT@p{bf)} to add this to mainline bitcoin: @p{par} 1. I'm using boost::xpressive (regular expression library) to parse the urls. Bitcoin is already dependent on lots of other pieces of Boost, and xpressive is compiled as a header-only dependency (no changes to the Makefiles)... but I wouldn't be surprised if using xpressive causes problems on SOME compiler somewhere. @p{par} 2. POSTing to https: URLs won't work if you're running on Windows (any windows/mingw experts want to take another crack at getting full openssl working?). @p{par} 3. Related to https/ssl: if you POST transactions to a non-ssl url, somebody eavesdropping on your packets will be able to figure out which bitcoin addresses belong to you. This is a potential privacy issue. @p{par} As always, feedback, encouragement, and reality-checks are welcome. @p{brk}