Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: MrKain on June 14, 2013, 06:48:05 PM



Title: latest transactions
Post by: MrKain on June 14, 2013, 06:48:05 PM

I'm trying to write a program to display the latest transactions on the bitcoin
network as they happen..

I call getinfo to get the block count , and then I call getblockhash with this
number, and then call getblock with the hash..

However, I can only get information on completed blocks.

How do services like https://blockchain.info/ get the latest transactions
for incomplete blocks ?


Title: Re: latest transactions
Post by: grue on June 14, 2013, 07:02:47 PM
getrawmempool
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list


Title: Re: latest transactions
Post by: MrKain on June 14, 2013, 07:33:18 PM


yes, getrawmempool lists the transactions in bitcoind's memory, - but that
still doesnt help - the transactions are in alphabetical order not as they are
received --

how can i get bitcoind to give them to me, in the order it got them ?



Title: Re: latest transactions
Post by: grue on June 15, 2013, 01:43:35 AM


yes, getrawmempool lists the transactions in bitcoind's memory, - but that
still doesnt help - the transactions are in alphabetical order not as they are
received --

how can i get bitcoind to give them to me, in the order it got them ?
That is not supported by bitcoind. You can do one of the following:

  • poll the daemon frequently and use a delta filter with a database to find "new" transactions
  • modify bitcoind to run a command when it receives a transaction. good ideas are: a) hook CTxMemPool::accept() or b) modify walletnotify rpc command to alert for all transactions, not just your own
  • steal procure data from blockchain.info

tl;dr there's no ez solution, you'll have to get your hands dirty.