This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
go-monero/pkg
Ciro S. Costa ac58bd1fd1 add zmq support
here i add `pkg/zmq`, a package aimed at providing one with the ability
of subscribing to zmq topics that the monero daemon published messages
to.

as exaplined under [1], there are four topics that one can subscribe to:

	-  json-minimal-txpool_add
	-  json-full-txpool_add
	-  json-minimal-chain_main
	-  json-full-chain_main

in the implementation provided here, one goes about listening to these
by:

	1. creating a client aiming at a topic
	2. telling the client to listen
	3. consuming typed objects from a "stream" object

e.g.:

	client := zmq.NewClient(endpoint, zmq.TopicMinimalTxPoolAdd)
	defer client.Close()

	stream, _ := client.Listen(ctx)
	for {
		select {
		case err := <-stream.ErrC:
			panic(err)
		case tx := <-stream.MinimalTxPoolAddC:
			fmt.Println(tx)
		}
	}

CLI users can also make use of it via `monero daemon zmq`:

	$ monero daemon zmq \
		--topic json-minimal-chain_main  \
		--endpoint tcp://127.0.0.1:18085

[1]: https://github.com/monero-project/monero/blob/master/docs/ZMQ.md

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
2021-07-28 07:37:23 -04:00
..
constant cmd: improve pretty-printing, add get-version 2021-07-16 07:48:30 -04:00
http source formatting 2021-07-18 17:22:57 -04:00
levin fix small lint issues 2021-07-17 12:04:11 -04:00
pointer add pkg/pointer package 2021-06-12 16:13:23 -04:00
rpc add get-accounts; add addr shortener 2021-07-22 07:49:15 -04:00
zmq add zmq support 2021-07-28 07:37:23 -04:00