7

I would like to consume events from my Iota Zmq node. Can somebody help me to do it? I enabled Zmq on my iota node by adding those lines in my iota.ini file :

ZMQ_ENABLED = true
ZMQ_PORT = 5555

I wrote a java code to consume events from Iota.

import org.zeromq.ZMQ;

public class hwclient {

    public static void main(String[] args) {
        ZMQ.Context context = ZMQ.context(1);


        ZMQ.Socket requester = context.socket(ZMQ.SUB);
        requester.connect("tcp://localhost:5555");
        requester.subscribe("tx");

        while(true){
            byte[] reply = requester.recv(0);
            System.out.println("Received " + new String(reply) );
        }
}

Here is the output :

Received tx IMRGHSFJUXITJDQPRWEKDUNUTUKHZAH9GDSGMMNWSBQDQTRMQMWGQHWBDLYJGQOWPPTHUND9NKIWA9999 GHU9DEKYVCWMXCHZSFBJRGEPFPXLHZILQSHTHMQRTHHDVUGEPLACJKEYDGZEWKSSZAHXJIHMDHHKWPLRA -28000000 FUJITSU99999999999999999999 1518709734 1 3 JEPCONFYKXWSFJKICXDCKPHQJLDPVULCQFCIYILCNHPKFLBVVSWDKOTYZJIREHHUZ9BYTZ9IKJPXCVSA9 SHJTYLOUEYEMZCNGUJWVOLNVQRESMODFFZUVGTPUJLMWGAXGDIFIRDX9DZLEWNQOXXF9EPRMVGRYZ9999 MNKWAFLRGJEKHEOBNGZENCUZBQKYQTDKGDALVDYFYIWJTC9JSTSPMHFQ9LRSYGQSTKSREEBIENGEZ9999 1518709795728
Received tx SHJTYLOUEYEMZCNGUJWVOLNVQRESMODFFZUVGTPUJLMWGAXGDIFIRDX9DZLEWNQOXXF9EPRMVGRYZ9999 GHU9DEKYVCWMXCHZSFBJRGEPFPXLHZILQSHTHMQRTHHDVUGEPLACJKEYDGZEWKSSZAHXJIHMDHHKWPLRA 0 FUJITSU99999999999999999999 1518709734 2 3 JEPCONFYKXWSFJKICXDCKPHQJLDPVULCQFCIYILCNHPKFLBVVSWDKOTYZJIREHHUZ9BYTZ9IKJPXCVSA9 IQZJZFXI9ILJIXKTIZCKHLSFRLSJT9QAD9ODNELQKQTZOKRPMBEFOYBOPYAQFMGJITRQODLKFBCX99999 MNKWAFLRGJEKHEOBNGZENCUZBQKYQTDKGDALVDYFYIWJTC9JSTSPMHFQ9LRSYGQSTKSREEBIENGEZ9999 1518709795730
Received tx HWRIZHP99IGYDPLGL99PHENUOQTAFFIDEDDCEAQIYDIJIHTOEDSXHOJFSLATMEBFVPCSVWTVCBJD99999 IOTASPAM9DOT9COM9999999999EPCRCYAIECWCNP9TEXEZMFRNDHYTGGDOSMEYGNIJOPXOOSGZUZRJRAE 0 GYC99999999IOTASPAM9DOT9COM 1518709794 0 0 EUXAXCY9HXYBIVEFVJIBHTQA9YOQTVJZAXUZIDUABDLOUSVTAKNIXHIAJELAAWXBDHBQTATYDFGJZICPD JMY9ENSJVTZHWOARQCVSMAFXBLZHSGNEPDTQSJL9UXSAKNNMSODXR9LYEJTTMOPQJUVAZCVJXRKLZ9999 FYNDHEWNKARCZLWY9AREAAKLJHGWVKFHM9Q9AKZZYIXQSEBGUAUFONCBIJ9QDGHUPDXOICGBHPPOZ9999 1518709796597
Received tx BZBAKG9ADEAHPAAEINWKXEHIFTYFAWMXSQAIFORQTN9VWPDXGDIKTIUDH9RFEMIGFLKBUZKDVJM999999 EREBUS999999999999999999999999999999999999999999999999999999999999999999999999999 0 999999999999999999999999999 1518709792 0 0 POXLEAPZZGXHJQAR9WXTOWAEPRUKKPBUMWOVKDW9HJ9PNMSCONRDIFNRJJPFIIFLVTHYWOZLXBUMWZCTC THR9VUXZTLOPA9UASTSOMRIIJVSFPZCQBCLT9YLVLYCYZ9DFTASDMRSYY9BIEUNJSCHXHLUELDHD99999 ZMWMJNRVDAFGFLOYPKHEUSFDDKJLHOKAFURJAFBWBIDMZBOTLXRTYTGWQKTQOAGFTECM9QNPSZUZA9999 1518709796754
Received tx FKSJTVQFVXAULNNVDAPLUXUON9THHLSPSUJIHEFFYHTAYZR9IXQFNPJXHVRHBWNFLBYPVVQJIIMVA9999 UBIAMVVHYNBIIDOIXMYWGVQSEFDGYUSWEYZTYKTIMWVYHGTCMEHQJINVEEGIHJ9WPWJVPSVXWHMYIWJRW 332198426 999999999999999999999999999 1518693519 3 3 OFLQWUTZKLQZXJBHEVWCZLWP9OZXHWYXJEBJJRTFGRFBBUHCXYRIIFIKKVIBIPRFVWBURGJ9V9PZVNFLX JMY9ENSJVTZHWOARQCVSMAFXBLZHSGNEPDTQSJL9UXSAKNNMSODXR9LYEJTTMOPQJUVAZCVJXRKLZ9999 BPQXEVSDXCLBOFJWKNBLYUSTMRYFZUNKHVWPDIEOXHIGVEURFFCIU9EKHAAHLGVBRWLFMRODQASPZ9999 1518709799638
Received tx LVHXOFERQOWNWLYAGBXGVJNGH9SULJFZVHRXL9JJWJ9RPDBZHRJWBXASVNJEMBLFMZUJMEKZHLUK99999 MQQKJGCJWFBRJXURYSERTNFVJAJXPLRXOLKMXCOZWIMUD9CVAFVHGSVZODVKNMKAXEDHOSJDRHAUEMURY 0 999999999999999999999999999 1518693503 2 3 OFLQWUTZKLQZXJBHEVWCZLWP9OZXHWYXJEBJJRTFGRFBBUHCXYRIIFIKKVIBIPRFVWBURGJ9V9PZVNFLX FKSJTVQFVXAULNNVDAPLUXUON9THHLSPSUJIHEFFYHTAYZR9IXQFNPJXHVRHBWNFLBYPVVQJIIMVA9999 JMY9ENSJVTZHWOARQCVSMAFXBLZHSGNEPDTQSJL9UXSAKNNMSODXR9LYEJTTMOPQJUVAZCVJXRKLZ9999 1518709799646

Please what represents each value? And how can I handle them?

1 Answer 1

6

Each record represents one transaction which was newly received by the node. I'll take apart one single line (which represents this transaction - so you can compare the values there). The Java code in iri that builds these tx messages is here.

  • tx - this is a transaction received
  • IMRGHSFJUXITJDQPRWEKDUNUTUKHZAH9GDSGMMNWSBQDQTRMQMWGQHWBDLYJGQOWPPTHUND9NKIWA9999 - transaction hash (to look the transaction up via the API if desired)
  • GHU9DEKYVCWMXCHZSFBJRGEPFPXLHZILQSHTHMQRTHHDVUGEPLACJKEYDGZEWKSSZAHXJIHMDHHKWPLRA - address
  • -28000000 - amount
  • FUJITSU99999999999999999999 - tag
  • 1518709734 - timestamp of creating bundle (in seconds since epoch)
  • 1 - index in bundle
  • 3 - number of transactions in bundle
  • JEPCONFYKXWSFJKICXDCKPHQJLDPVULCQFCIYILCNHPKFLBVVSWDKOTYZJIREHHUZ9BYTZ9IKJPXCVSA9 - bundle hash
  • SHJTYLOUEYEMZCNGUJWVOLNVQRESMODFFZUVGTPUJLMWGAXGDIFIRDX9DZLEWNQOXXF9EPRMVGRYZ9999 - trunk transaction hash
  • MNKWAFLRGJEKHEOBNGZENCUZBQKYQTDKGDALVDYFYIWJTC9JSTSPMHFQ9LRSYGQSTKSREEBIENGEZ9999 - branch transaction hash
  • 1518709795728 - attachment timestamp (in millisecond since epoch)
5
  • Thanks. I've already found a good link in javascript but I forgot to add an answer to my question here. Btw "tx" represents the topic I listen to. :)
    – Parker
    Commented Feb 16, 2018 at 12:11
  • @Parker yes, you can listen to other topics if you are interested in tip selection statistics for example. If you want transactions, tx is the right one.
    – mihi
    Commented Feb 16, 2018 at 20:45
  • @mihi Is it possible to subscribe to a specific tag? And do all nodes implement ZMQ?
    – mike
    Commented Sep 14, 2018 at 14:27
  • Okay, the ZMQ can be enabled/disabled via configuration. Do you know what node operators do in practice?
    – mike
    Commented Sep 14, 2018 at 14:33
  • since I don't run a node, I don't know what they do and what they use ZMQ for. I doubt that anyone makes his ZMQ port public, though.
    – mihi
    Commented Sep 14, 2018 at 18:38

Your Answer

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

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