2

How is it possible to get the latest transactions txid in real-time? I mean to implement something similar to what blockchain.info does on its homepage. How do they do it to get all transactions info that happens on the network? I'm talking about zero-confirmation transactions.

EDIT I have found out the API getrawmempool. Does this answer the question? Does it contain all the real-time transactions in the network for the current live block?

1
  • Yes, getrawmempool will contain all unconfirmed transactions which have been verified and accepted as valid by your node but have not yet been included in a block. Due to transaction malleability (or moreso a misunderstanding of how to check transactions going through) and double-spends I would use this for notification purposes only, unless of course you value being able to credit a client immediately and are willing to deal with a few reversed payments in order to provide this convenience.
    – Mark
    Commented Apr 13, 2014 at 17:05

4 Answers 4

1

-walletnotify=<cmd> Execute command when a wallet transaction changes (%s in cmd is replaced by TxID), if you only care about wallet transaction.

If you want any TxID, I think that is not possible with the standard client. You could however program something yourself that listens for message passing between the Bitcoin software and the operating system, or you can fork the client of course.

In my opinion the layered approach is preferable, as it is more flexible and secure (although you have less possibilities). For the layered approach I see two possibilities:

  • The Wireshark option (i.e. hooking into the Windows networking implementation and filtering Bitcoin messages).
  • Create a SOCKS server and let the Bitcoin client connect to the network through it (using the -proxy option), and then log and process all passing messages.
1

blockchain.info offers a web socket for real time information about blocks and tranasactions. Have a look at https://blockchain.info/it/api/api_websocket

-- UPDATE

to avoid relying on third party services, I would now suggest to use a bitcoin node with zmq

1
  • "I mean to implement something similar to what blockchain.info does on its homepage. How do they do it to get all transactions info that happens on the network? I'm talking about zero-confirmation transactions."
    – Jori
    Commented Apr 13, 2014 at 11:06
0

A synced bitcoind daemon has a command showing txid of transactions passing thru it. It may be impossible to see the whole network at once from one spot, or know whether you can or not.

0

getrawmempool is the solution as mentioned in the edit of the question and validated by the comment in the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.