I call:
bitcoind -zmqpubrawtx=ipc:///tmp/bitcoind.tx.raw
or even call:
bitcoind -zmqpubhashtx=tcp://127.0.0.1:9050 - zmqpubrawtx=ipc:///tmp/bitcoind.tx.raw
where 9050 is port from bicoin config. File /tmp/bitcoind.tx.raw is empty i has lenght=0 How can I dump transactions? I read, this file is websocket and I must subscribe to it:
Client side, then, the ZeroMQ subscriber socket must have the ZMQ_SUBSCRIBE
option set to one or either of these prefixes (for instance, just hash);
without doing so will result in no messages arriving. Please see
contrib/zmq/zmq_sub.py for a working example."
How can I read it programically? I try create c++ program from Python sources and https://github.com/plq/zmq.git
include
#include <iostream>
#include <cstdlib>
#include <cstring>
#include "zmq.hpp"
using std::cout;
using std::endl;
void recv_multipart(zmq::socket_t &socket) {
int64_t more=-1;
size_t more_size = sizeof (more);
while(more) {
zmq::message_t response;
socket.recv(&response);
std::string response_str((const char *)response.data(),
response.size());
cout << response_str << endl;
socket.getsockopt(ZMQ_RCVMORE, &more, &more_size);
}
}
int main(int argc, char **argv) {
zmq::context_t context(1);
zmq::socket_t socket(context, ZMQ_SUB);
socket.setsockopt(ZMQ_SUBSCRIBE, "hashblock");
socket.setsockopt(ZMQ_SUBSCRIBE, "hashtx");
socket.setsockopt(ZMQ_SUBSCRIBE, "rawblock");
socket.setsockopt(ZMQ_SUBSCRIBE, "rawtx");
//socket.connect(/*argv[2]*/"ipc:///tmp/bitcoind.tx.raw");
socket.connect("tcp://127.0.0.1:28332");
size_t arg_len= std::strlen("Unknown");
zmq::message_t message(arg_len);
std::memcpy(message.data(), "Unknown", arg_len);
socket.send(message);
recv_multipart(socket);
return 0;
}