3

Question

How can I check to see if ZeroMQ is not active due to a config error or due to lack of support at compile time?

Details

I'm seeing a lot of messages like this from the insight logs:

[2017-12-12T12:21:31.695Z] warn: ZMQ connection delay: tcp://127.0.0.1:28332

When I test to see if the port is open and listening with netstat -peanut or netcat -v localhost 28332 I can see that it is not (even though it's in bitcoind.conf).

bitcoind.conf

server=1
whitelist=0.0.0.0/0
txindex=1
addressindex=1
timestampindex=1
spentindex=1
zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubrawtxlock=tcp://127.0.0.1:28332
zmqpubhashblock=tcp://127.0.0.1:28332
rpcuser=user321
rpcpassword=local321
rpcport=9998
rpcallowip=0.0.0.0/0
uacomment=bitcore
#debug=1
#testnet=1

bitcore-node.json:

    {
        "network": "mainnet",
        "port": 3001,
        "services": [
            "bitcoind",
            "insight-api-dash",
            "insight-ui-dash",
            "web"
        ],
        "servicesConfig": {
            "bitcoind": {
                "connect": [{
                    "rpchost": "127.0.0.1",
                    "rpcport": 9998,
                    "rpcuser": "user321",
                    "rpcpassword": "local321",
                    "zmqpubrawtx": "tcp://127.0.0.1:28332"
                }]
            }
        }
    }

I'm pretty sure I compiled with zmq support, but since it's not actually listening I'm guessing that it's possible that I did not (i.e. although libzmq was present perhaps it was not in the right path to be detected).

How can I check to see if it's a config error or a compile error?

3 Answers 3

6

You should have a file named config.log in your Bitcoin Core working directory. Look in the file for ZMQ related lines. If ZMQ is enabled, you should see things like #define ENABLE_ZMQ 1. If it is not enabled, you should see things like #define ENABLE_ZMQ 0.

6

As this question is related to executable compilation which has to do with linking (static or dynamic), therefore the ultimate way to know if your compiled bitcoind executable has been compiled with 0mq support is simply:

ldd /usr/bin/bitcoind | grep -i mq

5

Since this question still comes up in search results, it's worth noting that bitcoin-cli now has a getzmqnotifications method. If you get something like this, you've successfully built with ZMQ:

$ bitcoin-cli getzmqnotifications
[
  {
    "type": "pubrawblock",
    "address": "tcp://127.0.0.1:28332",
    "hwm": 1000
  },
  {
    "type": "pubrawtx",
    "address": "tcp://127.0.0.1:28333",
    "hwm": 1000
  }
]

If you get

error code: -32601
error message:
Method not found

... you haven't.

PR that introduced the method: https://github.com/bitcoin/bitcoin/pull/13570

2
  • 1
    if you receive: [ ] (empty, but no error), what is then the state? Jan 4, 2022 at 3:14
  • 2
    Through trial and error, I have learned that an empty response [ ], means that zmq support IS compiled in, but the zmq ports have not been set up correctly (matching) in bitcoin.conf and lnd.conf.
    – ckapilla
    Apr 25, 2022 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.