Bitcoin Forum
May 13, 2024, 09:55:12 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How do I use ZeroMQ to monitor addresses?  (Read 702 times)
mad-max (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
December 22, 2016, 04:42:25 PM
 #1

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!  Cheesy

Thank you!
1715594112
Hero Member
*
Offline Offline

Posts: 1715594112

View Profile Personal Message (Offline)

Ignore
1715594112
Reply with quote  #2

1715594112
Report to moderator
1715594112
Hero Member
*
Offline Offline

Posts: 1715594112

View Profile Personal Message (Offline)

Ignore
1715594112
Reply with quote  #2

1715594112
Report to moderator
1715594112
Hero Member
*
Offline Offline

Posts: 1715594112

View Profile Personal Message (Offline)

Ignore
1715594112
Reply with quote  #2

1715594112
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
mad-max (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
December 22, 2016, 06:30:32 PM
 #2

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?
MithrilMan
Hero Member
*****
Offline Offline

Activity: 554
Merit: 502

Developer!


View Profile WWW
December 25, 2016, 02:55:45 AM
 #3

is the rawtx validated or does it requires tx validation?

Huntercoin: Mithril Edition - Alternative client for Huntercoin - (Discontinued)
HUC: HMSCYGYJ5wo9FiniVU4pXWGUu8E8PSmoHE  - BTC: 1DKLf1QKAZ5njucq37pZhMRG67qXDP3vPC
rant to people who pretend things for free
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
December 25, 2016, 04:36:45 AM
 #4

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.

MithrilMan
Hero Member
*****
Offline Offline

Activity: 554
Merit: 502

Developer!


View Profile WWW
December 25, 2016, 11:43:49 AM
 #5

thanks

Huntercoin: Mithril Edition - Alternative client for Huntercoin - (Discontinued)
HUC: HMSCYGYJ5wo9FiniVU4pXWGUu8E8PSmoHE  - BTC: 1DKLf1QKAZ5njucq37pZhMRG67qXDP3vPC
rant to people who pretend things for free
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!