1

I am trying to use ZMQ feeds to monitor IRI nodes and addresses, but I am having trouble obtaining the "Message" in text and/or JSON.

I am using this code:

let zmq = require('zeromq')
let sock = zmq.socket('sub')
sock.connect('tcp://node.deviceproof.org:5556')
sock.subscribe('tx_trytes')
sock.subscribe('tx')
sock.on('message', async msg => {
    const data = msg.toString().split(' ') // Split to get topic & data
    if (data[0] === "tx") {
        console.log('Raw Object:', data[3])
    } else if (data[0] === "tx") {
        console.log("Transaction:", data[1]);
    }
})

I can get the "Raw transaction object" from this line,

console.log('Raw Object:', data[3])

But it comes in as trytes and I am only interested in the signatureMessageFragment (https://docs.iota.org/docs/dev-essentials/0.1/references/structure-of-a-transaction), which I would like in JSON and/or text. The IOTA docs on ZMQ events do not have any subscription topics to get what I am looking for (https://docs.iota.org/docs/node-software/0.1/iri/references/zmq-events).

Maybe I am missing something? I thought about bringing in the trytes and converting them to text, but I cannot find a IOTA API call for that in the IOTA JS library (https://github.com/iotaledger/iota.js/).

Any help, or suggestions would be much appreciated, and if you need any clarification on my question feel free to ask.

I believe this question is somewhat related to mine, ZeroMQ subscription to address not working

0

The way you are going about it is correct. There is no topic for just signatureMessageFragment.

In order to convert the proper trytes to text: https://www.npmjs.com/package/@iota/converter#module_converter.trytesToAscii

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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