Skip to content
ZeroMQ plugin for EOS.io nodeos
C++ CMake JavaScript
Branch: master
Clone or download
Pull request Compare This branch is 59 commits ahead, 1 commit behind tsouza:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
include/eosio/zmq_plugin
reader
.gitignore
CMakeLists.txt
README.md
zmq_plugin.cpp Fixing compatibility erros for nodeos 1.8.0 Jul 17, 2019

README.md

ØMQ Nodeos Plugin

Lighter version of the eosio zmq_plugin

Configuration

The following configuration statements in config.ini are recognized:

Make sure zmq is loaded after the chain plugin.

plugin = eosio::chain_plugin
plugin = eosio::zmq_plugin
  • zmq-enable-actions = true/false -- enable action output (default: false)

  • zmq-enable-transactions = true/false -- enable transactions output (default: false)

  • zmq-action-blacklist = CODE::ACTION -- filter out a specific action

Action onblock in eosio account is ignored and is not producing a ZMQ event. These actions are generated every 0.5s, and ignored in order to save the CPU resource.

Socket options

Both socket types are disabled by default, you need to explicitly enable them

PUSH/PULL

  • zmq-enable-push-socket = true/false -- enables sending messages on push/pull pattern (blocking)

    • If multiple clients are connected, messages will be distributed in a round-robin fashion to the clients
  • zmq-sender-bind = ENDPOINT

    • specifies the PUSH socket binding endpoint.
    • Default value: tcp://127.0.0.1:5556.

PUB/SUB

  • zmq-enable-pub-socket = true/false -- enables sending messages on pub/sub pattern (non-blocking)

    • In the case multiple subscribers are connected all messages will be sent to all subscribers
  • zmq-publisher-bind = ENDPOINT

    • specifies the PUSH socket binding endpoint.
    • Default value: tcp://127.0.0.1:5557.

Whitelist options

  • zmq-whitelist-accounts-file = FILENAME -- whilelist accounts from a file (one account name per line)

  • zmq-whitelist-account = ACCOUNT -- sets up a whitelist, so that only traces for specified accounts are exported. Multiple options define multiple accounts to trace. If the account is a contract, all its actions (including inline actions) are exported. Also all transfers to and from the account, system actions, and third-party notifications are triggering the trace export. Whitelisted accounts will override the blacklist.

  • zmq-use-bloom-filter -- WARNING: experimental bloom filter, optimized for large lists.

Whitelist HTTP API (hot-reload, no need to restart nodeos)

Example to set a new whitelist

curl -sL -X POST -d '["eosio.token","eosio","eosio.forum"]' http://127.0.0.1:8888/v1/zmq/set_whitelist

Get the current whitelist with

curl -sL http://127.0.0.1:8888/v1/zmq/get_whitelist

Compiling

Clone the zmq_plugin repo:

apt-get install -y pkg-config libzmq5-dev libnorm-dev
mkdir ${HOME}/build
cd ${HOME}/build/
git clone https://github.com/eosrio/eos_zmq_plugin.git

Change to the eos repository folder and run:

LOCAL_CMAKE_FLAGS="-DEOSIO_ADDITIONAL_PLUGINS=${HOME}/build/eos_zmq_plugin" ./scripts/eosio_build.sh

Reading data from the socket

This sample code uses the zeromq prebuilt bindings for Node.js.

cd reader
npm install
node reader.js

Original Plugin Author

You can’t perform that action at this time.