3

With getrawmempool it gets me txids, however it just dumps the whole mempool on me. This isn't convenient if I want to quickly detect new transactions. Is it possible to only get newly broadcasted transactions?

Is there another way to sort of stream them from bitcoin-core into my program?

orion3
  • 173
  • 5

2 Answers2

4

You can use the ZMQ interface to receive a ZMQ notification when a new transaction is received. You can have it give you the txid, the raw transaction, or both.

Andrew Chow
  • 67,209
  • 5
  • 76
  • 149
0

I think what you are looking for is walletnotify. You can set on bitcoin.conf file.

For example

walletnotify=/home/process_tx.sh

That will call /home/process_tx.sh passing as parameter the transaction hash Or you can also run bitcoind with using -walletnotify

bitcoind -walletnotify=/home/process_tx.sh

carvmarc
  • 126
  • 3
  • 1
    As far as I understand, `walletnotify` only notifies of transactions made to the address that belong to that wallet. I'm interested in collecting all transactions that are broadcasted. – orion3 Aug 17 '17 at 04:20
  • In that case, you should use ZMQ as sugest by @Andrew Chow – carvmarc Aug 17 '17 at 15:08