Each PUB notification has a topic and body, where the header
Each PUB notification has a topic and body, where the header
corresponds to the notification type. For instance, for the
corresponds to the notification type. For instance, for the
notification `-zmqpubhashtx` the topic is `hashtx` (no null
notification `-zmqpubhashtx` the topic is `hashtx` (no null
terminator) and the body is the transaction hash (32
terminator). These options can also be provided in bitcoin.conf.
bytes) for all but `sequence` topic. For `sequence`, the body
is structured as the following based on the type of message:
The topics are:
`sequence`: the body is structured as the following based on the type of message:
<32-bytehash>C : Blockhash connected
<32-bytehash>C : Blockhash connected
<32-bytehash>D : Blockhash disconnected
<32-bytehash>D : Blockhash disconnected
@ -102,7 +104,24 @@ is structured as the following based on the type of message:
Where the 8-byte uints correspond to the mempool sequence number.
Where the 8-byte uints correspond to the mempool sequence number.
These options can also be provided in bitcoin.conf.
`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).
`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).
`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).
`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).
**_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.
ZeroMQ endpoint specifiers for TCP (and others) are documented in the
ZeroMQ endpoint specifiers for TCP (and others) are documented in the