Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.
/ tezos-watcher Public archive

💸 Simple CLI and Golang library for monitoring Tezos nodes

Notifications You must be signed in to change notification settings

bobheadxi/tezos-watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tezos-watcher GoDoc Build Status codecov

Monitor your Tezos node.

Installing

To install the CLI, use the following go get command or check the releases page.

$> go get github.com/bobheadxi/tezos-watcher/cmd/tezos-watcher

Usage

CLI

Get the Tezos Alphanet up and running. Make sure to start up a node with the RPC endpoints exposed - for example:

$> ./alphanet.sh start --rpc-port 8732

Optionally grab some free Tezzies to start off.

You can now start watching your local node:

$> tezos-watcher watch-chain

The -h flag offers documentation on the command line tool.

Library

w, _ := watcher.New(watcher.ConnectOpts{
  Host: "127.0.0.1", Port: "8732"})

quit := make(chan struct{})
defer close(quit)
statusCh, errCh := w.WatchBlock(watcher.BlockOptions{
  Chain: "main",
  Block: "head",
  Rate:  1 * time.Second,
}, quit)

for {
  select {
  case err := <-errCh:
    if err != nil {
      return
    }
  case event := <-statusCh:
    output, _ := json.Marshal(event)
    println(string(output))
  }
}

Development

$> make          # install dependencies, install tezos-watcher CLI
$> make node     # start up Tezos sandbox node
$> make test     # execute tests against sandbox node

Notes

This project was written as part of a pre-task for a job.

About

💸 Simple CLI and Golang library for monitoring Tezos nodes

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published