You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
9544ab6 doc: Improve ZMQ documentation (node01)
Pull request description:
This PR intends to clarify:
. when ZMQ notifications occur
. the message structure of each topic
Closesbitcoin/bitcoin#23452 (comment)
ACKs for top commit:
theStack:
ACK 9544ab6
Tree-SHA512: 3b1314ad5eb8c359ffabd91ce9b47cf6cf8efa69be083a3bb5d865833ac67d7a88a8e012c4a4f59f2cd2a0e7f491e828897e85e9d01bae72ee83c4a6ad459f6e
Copy file name to clipboardExpand all lines: doc/zmq.md
+23-4Lines changed: 23 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,9 +91,11 @@ For instance:
91
91
Each PUB notification has a topic and body, where the header
92
92
corresponds to the notification type. For instance, for the
93
93
notification `-zmqpubhashtx` the topic is `hashtx` (no null
94
-
terminator) and the body is the transaction hash (32
95
-
bytes) for all but `sequence` topic. For `sequence`, the body
96
-
is structured as the following based on the type of message:
94
+
terminator). These options can also be provided in bitcoin.conf.
95
+
96
+
The topics are:
97
+
98
+
`sequence`: the body is structured as the following based on the type of message:
97
99
98
100
<32-byte hash>C : Blockhash connected
99
101
<32-byte hash>D : Blockhash disconnected
@@ -102,7 +104,24 @@ is structured as the following based on the type of message:
102
104
103
105
Where the 8-byte uints correspond to the mempool sequence number.
104
106
105
-
These options can also be provided in bitcoin.conf.
107
+
`rawtx`: Notifies about all transactions, both when they are added to mempool or when a new block arrives. This means a transaction could be published multiple times. First, when it enters the mempool and then again in each block that includes it. The messages are ZMQ multipart messages with three parts. The first part is the topic (`rawtx`), the second part is the serialized transaction, and the last part is a sequence number (representing the message count to detect lost messages).
108
+
109
+
| rawtx | <serialized transaction> | <uint32 sequence number in Little Endian>
110
+
111
+
`hashtx`: Notifies about all transactions, both when they are added to mempool or when a new block arrives. This means a transaction could be published multiple times. First, when it enters the mempool and then again in each block that includes it. The messages are ZMQ multipart messages with three parts. The first part is the topic (`hashtx`), the second part is the 32-byte transaction hash, and the last part is a sequence number (representing the message count to detect lost messages).
112
+
113
+
| hashtx | <32-byte transaction hash in Little Endian> | <uint32 sequence number in Little Endian>
114
+
115
+
116
+
`rawblock`: Notifies when the chain tip is updated. Messages are ZMQ multipart messages with three parts. The first part is the topic (`rawblock`), the second part is the serialized block, and the last part is a sequence number (representing the message count to detect lost messages).
117
+
118
+
| rawblock | <serialized block> | <uint32 sequence number in Little Endian>
119
+
120
+
`hashblock`: Notifies when the chain tip is updated. Messages are ZMQ multipart messages with three parts. The first part is the topic (`hashblock`), the second part is the 32-byte block hash, and the last part is a sequence number (representing the message count to detect lost messages).
121
+
122
+
| hashblock | <32-byte block hash in Little Endian> | <uint32 sequence number in Little Endian>
123
+
124
+
**_NOTE:_** Note that the 32-byte hashes are in Little Endian and not in the Big Endian format that the RPC interface and block explorers use to display transaction and block hashes.
106
125
107
126
ZeroMQ endpoint specifiers for TCP (and others) are documented in the
0 commit comments