Is there a Python client to listen to all latest transaction from the Bitcoin network? How does blockchain.info doing it?
Blockchain.info uses a special system that doesn't involve Python (as far as we know), they're most likely using a modifed node that notifies them of transactions.
The easy way
Just use Blockchain.info's transaction notification service. Their websockets api lets anyone subscribe to any bitcoin address.
The hard way
If you want to listen to all latest transactions, and not to addresses you own, you're going to need more in depth control. Otherwise use Bitcoind and its
walletnotify parameter. Check out PyNode, a Bitcoin node implementation in Python.
You could write python code that polls an instance of bitcoin-qt/bitcoind, the reference client. Here are the RPC calls, available via HTTP requests:
getrawmempool can could be polled to return unconfirmed transactions that have been locally seen. (I believe
-walletnotify will only notify about wallet-relevant transactions, but tailing the debug log could be another way to learn of new unconfirmed transactions.) By using the
-blocknotify command-line option, your external scripts can receive notification when new blocks are discovered, which might also include transactions that were never in the local unconfirmed pool.
You'd have to run with the
-txindex option, so that you could pull all new transaction details out of the local blockchain, rather than just those from your wallet.
It looks to me like chainsnort is just what you're looking for: https://bitcointalk.org/index.php?topic=373490.0
The publicly available version uses Python websockets and connects to blockchain.info to listen to all new transactions in real time. There is also an RPC version to get the same type of data straight from your own bitcoind node, without relying on blockchain.info, but it's still in private beta.