I wan't to share a code snippet to track transactions using dogecoin ZeroMQ interface , useful if you want to create realtime notifications faster than using RPC.
I've used node, required packages are bitcoind-rpc and zeromq :
dogecoinlab@server:~/dogecoin-zmq$ yarn add bitcoind-rpc
dogecoinlab@server:~/dogecoin-zmq$ yarn add zeromq
the code :
`const zmq = require("zeromq")
const RpcClient = require('bitcoind-rpc');
var config = {
protocol: 'http',
user: 'dogetips',
pass: 'XXXXXXXXXXX',
host: '127.0.0.1',
port: '22555',
};
var rpc = new RpcClient(config);
async function run() {
const sock = new zmq.Subscriber
sock.connect("tcp://127.0.0.1:28332")
sock.subscribe("rawtx")
console.log("Subscriber connected to port 28332")
for await (const [topic, msg] of sock) {
rpc.decodeRawTransaction(msg.toString('hex'), function(err, resp) {
console.log(JSON.stringify(resp, null, 4))
})
}
}
run()`