dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.2k forks source link

Failing to listen to zeromq (zmq) messages produced by dashd on windows 10. #1731

Open craigbroadbear opened 6 years ago

craigbroadbear commented 6 years ago

Running dashd 0.12.2.1 on Windows 10. Node.js v8.9.1 npm zeromq 4.6

Any ideas? Code follows.

------------- zmqTest.js


const zmq = require('zeromq')
    , zmqSock = zmq.socket('sub');

zmqSock.on('message', (topic, msg)=>{
    console.log('work: %s %s', topic, JSON.stringify(msg, null,2));
});

zmqSock.on('connect', (fd, endPoint) =>{
    console.log('ZMQ connected to:' + endPoint);
});

zmqSock.on('connect_delay', (fd, endPoint) =>{
    console.log('ZMQ connection delay:' + endPoint);
});

zmqSock.on('disconnect', (fd, endPoint) =>{
    console.log('ZMQ disconnect:' + endPoint);
});

zmqSock.subscribe('hashblock');
zmqSock.subscribe('rawtx');
zmqSock.subscribe('rawtxlock');

zmqSock.connect('tcp://127.0.0.1:18332');

----------- dash.conf file is: server=1 testnet=1 whitelist=0.0.0.0/0 txindex=1 addressindex=1 timestampindex=1 spentindex=1 zmqpubrawtx=tcp://127.0.0.1:18332 zmqpubrawtxlock=tcp://127.0.0.1:18332 zmqpubhashblock=tcp://127.0.0.1:18332 rpcuser=dash rpcpassword=local321 rpcport=9998 rpcallowip=0.0.0.0/0 uacomment=bitcore debug=zmq

nmarley commented 6 years ago

const zmq = require('zeromq')

Should this be const zmq = require('zmq') instead? I'm just comparing this code to https://github.com/dashevo/bitcore-node-dash/blob/master/lib/services/bitcoind.js#L9

Can you try that and see if it works?

craigbroadbear commented 6 years ago

I tried that first, it did not work. zmq is an early version of zeromq.

craigbroadbear commented 6 years ago

It seems the Windows build has been compiled with ENABLE_ZMQ undefined.

nmarley commented 6 years ago

Hey @craigbroadbear, do you know if you got the binary from the official releases at https://github.com/dashpay/dash/releases? Also, have you tried with the latest release (0.12.2.3)?

craigbroadbear commented 6 years ago

Yes that is where I downloaded from. I have tested with an old version as well as the latest, 0.12.2.3.

craigbroadbear commented 6 years ago

I tried to do a windows cross build of the latest source on linux but ran into all sorts of problems with missing libraries and whatnot. For now I am forgetting about zmq and polling the RPC port to do what i need.

ghanavati27 commented 6 years ago

Same problem here. I using windows server 2016 and Node.js v8.9.4 and zeromq 4.6.0 Dash core do not send messages to my script, while other cores(like bitcoin core , bitcoinabc ,...) working very well with my script. @craigbroadbear , For now I am forgetting about zmq and using walletnotify instead of it.

jhodges10 commented 6 years ago

I've had this same problem before as well. I'm not compiling my own Windows builds right now so I'm working off of whatever is put on the wallets page and it doesn't currently appear to play nice with ZMQ.

My fix was just to use Linux instead 😢