Bitcoin Forum
May 26, 2024, 05:00:41 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: track blocks  (Read 2861 times)
flower1024 (OP)
Legendary
*
Offline Offline

Activity: 1428
Merit: 1000


View Profile
August 06, 2012, 02:31:34 PM
 #1

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)
flower1024 (OP)
Legendary
*
Offline Offline

Activity: 1428
Merit: 1000


View Profile
August 06, 2012, 02:59:23 PM
 #2

i guess i just use blockchain.info's api
it looks very promising
Revalin
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g


View Profile
August 07, 2012, 01:25:41 AM
 #3

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.

      War is God's way of teaching Americans geography.  --Ambrose Bierce
Bitcoin is the Devil's way of teaching geeks economics.  --Revalin 165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
flower1024 (OP)
Legendary
*
Offline Offline

Activity: 1428
Merit: 1000


View Profile
August 07, 2012, 06:32:26 AM
 #4

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!