How to get notification about new transaction?

+2 votes

How to get notifications about new transactions?

E.g. I need to use a custom shell script to send push notifications on new transactions with specific OP_RETURN to a mobile app.
asked Nov 18, 2015 by Igor Barinov

1 Answer

0 votes

Thanks for this question. Unfortunately it's not possible right now, but it's a great feature request.

In the meantime you will need to use some kind of polling via the API. You can look for new transactions by repeatedly calling getrawmempool, looking for changes in the output of getbestblockhash and getblockcount to identify new blocks and calling getblock with the second parameter of true to get a list of transactions in each block. Given a particular transaction ID, you can retrieve that transaction's contents using getrawtransaction – the OP_RETURN payload will be in the data field of the output.

answered Nov 18, 2015 by MultiChain