Title: track blocks Post by: flower1024 on August 06, 2012, 02:31:34 PM hello,
i want to write a small program which track bitcoin blocks and looks for certain addresses. what is the easiest way to get notified when a new block arrives? i'd prefer to run a stock bitcoind. with "getinfo" i get the current block count. is there any way to get a json representation of a specific block which includes all transaction in it? (notification or polling does not really matter. its not that time sensitive) Title: Re: track blocks Post by: flower1024 on August 06, 2012, 02:59:23 PM i guess i just use blockchain.info's api
it looks very promising Title: Re: track blocks Post by: Revalin on August 07, 2012, 01:25:41 AM bitcoind does what you need. From "bitcoind --help":
-blocknotify=<cmd> Execute command when the best block changes (%s in cmd is replaced by block hash) Then whenever you're notified of a new block use getreceivedbyaddress or listreceivedbyaddress to see if your address has received anything. Quote is there any way to get a json representation of a specific block which includes all transaction in it? Yes, getblock does exactly that. Title: Re: track blocks Post by: flower1024 on August 07, 2012, 06:32:26 AM bitcoind does what you need. From "bitcoind --help": -blocknotify=<cmd> Execute command when the best block changes (%s in cmd is replaced by block hash) Then whenever you're notified of a new block use getreceivedbyaddress or listreceivedbyaddress to see if your address has received anything. Quote is there any way to get a json representation of a specific block which includes all transaction in it? Yes, getblock does exactly that. thanks i dont have a bitcoind here right now and the internet says "getblock" is not available. i'll try it tonight. |