Bitcoin Forum

Bitcoin => Project Development => Topic started by: mad-max on December 22, 2016, 04:42:25 PM



Title: How do I use ZeroMQ to monitor addresses?
Post by: mad-max on December 22, 2016, 04:42:25 PM
Hello!

We're developing a Bitcoin service and we need to monitor local addresses for new transactions and transaction updates (confirmations).

ZeroMQ built into bitcoind looks like a pretty cool feature, however, as I see, it only receives IDs of the new transactions.

Is it possible to map transaction ID to Bitcoin address without issuing an RPC call to the node?

We don't want to flood the server with RPC requests, because new transactions are appearing very quickly.

Any suggestions are highly appreciated!  :D

Thank you!


Title: Re: How do I use ZeroMQ to monitor addresses?
Post by: mad-max on December 22, 2016, 06:30:32 PM
I've worked out the following scheme:

1. Listen for rawtx topic using ZeroMQ in order to receive raw transaction body.
2. Parse binary body and extract addresses from output scripts.
3. Compare addresses with local database in order to find matches.

Of course, list of pending transactions could be loaded into memory entirely in order to prevent too much requests to the database. Each address takes 20 bytes of memory, so you could store ~50K of them in 1MB of RAM.

Is this an optimal way to monitor specific addresses?


Title: Re: How do I use ZeroMQ to monitor addresses?
Post by: MithrilMan on December 25, 2016, 02:55:45 AM
is the rawtx validated or does it requires tx validation?


Title: Re: How do I use ZeroMQ to monitor addresses?
Post by: achow101 on December 25, 2016, 04:36:45 AM
is the rawtx validated or does it requires tx validation?
Before Core gives the user access to anything, it will always validate the data. The transaction is already validated when it tells you about it.


Title: Re: How do I use ZeroMQ to monitor addresses?
Post by: MithrilMan on December 25, 2016, 11:43:49 AM
thanks