Skip to content
Very compact node watcher for EOSIO blockchains
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

npm version

Watcher for EOSIO blockchains

This watcher is meant to be extremely lightweight and fast. It has no dependencies and is a total of around 10kb.

It is best used on either the same machine as the running node, or within the local network of the node.

Note that this gets actions from get_block so it does not catch inlines.


npm i -S watcheosio


const NodeWatcher = require('watcheosio');

// Just a method to log out incoming action data.
const log = data => console.log('data', data);

const parsers = {
    // Using a wildcard for contract

    // Using a wildcard for action

    // Using a global catch-all wildcard

    // Catching only specific actions on specific contracts

const options = {
    startingBlock:0,      // Start at last/head block
    // startingBlock:-20,    // Start at last/head block - NUMBER
    // startingBlock:511500,   // Start at specific block
    interval:50,            // The poll interval to use. (For catching up to head block only)

    // An array of endpoints.
    // Will be used in a Round-Robin fashion so that you don't hit a single endpoint
    // repeatedly and cause mass loads. Fetch failures will simply move to the next endpoint and
    // retry block fetch (up to 5 times)

    // Calls method on every block after fetching block data from chain.
    // This allows you to cache your own "currentBlock" variable for later use.
    blockTracker:(block, head) => console.log(`Block: ${block} | Head: ${head} | Behind: ${head - block}`)

const watcher = new NodeWatcher(parsers, options);

// Starts watching.

// Pauses temporarily.
// watcher.pause();
// -------------------------------------
// Call watcher.start() again to unpause.
You can’t perform that action at this time.