npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ethwatcher

v0.2.0

Published

Ethereum blockchain watcher library.

Downloads

25

Readme

ethwatcher

Build Status codecov

Ethereum blockchain watcher library.

Usage in command line

  1. Install
$ npm install -g ethwatcher
  1. Run ethwatcher
$ ethwatcher

  Usage: ethwatcher [options] [command]

  Options:

    -V, --version  output the version number
    -h, --help     output usage information

  Commands:

    config         Create the ethwatcher tool config.
    confirmed      Check the transaction is confirmed.
    watch          Watch the latest block and find transactions related to the address.
    help [cmd]     display help for [cmd]
  1. Run ethwatcher config to generate config file
$ ethwatcher config -h https://host:port/path

[Info] Config was saved: /Users/test/Desktop/t/ethwatcher.yaml
  1. Confirm the transaction
$ ethwatcher confirmed -c ./ethwatcher.yaml -x 0x1b1c51f6c750443c4dad33765715bb674c624fc54219ac4f22c5e328ce57c126 -n 10000 -s 1

[Info] Start to check params
[Debug] Tx hash: 0x1b1c51f6c750443c4dad33765715bb674c624fc54219ac4f22c5e328ce57c126 Count: 10000
[Debug] Block Number Now: 323803 Tx was in Block: 311306
[Info] 0x1b1c51f6c750443c4dad33765715bb674c624fc54219ac4f22c5e328ce57c126 had been confirmed 10000 times.
  1. Watch the address
$ ethwatcher watch -c ./ethwatcher.yaml -a 30b82c8694b59695d78f33a7ba1c2a55dfa618d5 -s 3 -l

[Info] Start to check params
[Debug] Address: 0x30b82c8694b59695d78f33a7ba1c2a55dfa618d5
[Debug] Block Number Now: 323835 transactions count: 0
[Debug] Block Number Now: 323836 transactions count: 0
[Debug] Block Number Now: 323837 transactions count: 0
[Debug] Block Number Now: 323838 transactions count: 0
[Debug] Block Number Now: 323839 transactions count: 0
[Debug] Block Number Now: 323840 transactions count: 0
[Debug] Block Number Now: 323841 transactions count: 0
[Debug] Block Number Now: 323842 transactions count: 1
[Info] Your got total 1 transactions.
[Info] Tx hash: 0xd69c18340ad10cfcd34d21d195544eb10d0e34fdcf9f32a252c180efcfbc3578
[Info] From: 0x30b82C8694b59695d78f33a7bA1C2A55dfA618d5
[Info] To: null
[Info] Value: 0
[Info] Nonce: 1097

Usage in library

  • Requirement: web3-eth (change in the future)
  1. Install library
$ npm install ethwatcher
  1. Confirm the transaction
const EthProvider = require('ethwatcher').ethProvider;
const confirmed = require('ethwatcher').confirmed; // const confirmed = require('ethwatcher/lib/confirmed');
const eth = new EthProvider('http://localhost:8545');
const txHash = '0xc16c42e9f1ab9031ca5125352df82587dfc4a066c3ace96a1037b7abb3f25b90';
const numberCount = 100;
const retrySeconds = 3;

confirmed(eth, txHash, numberCount, retrySeconds).then((confirmed) => {
  if (confirmed === true) {
    console.log(`${txHash} had been confirmed ${numberCount} times.`);
  } else {
    console.log('Please check your environment.');
  }
}).catch((err) => {
  console.log(`Confirm error: ${err.message}`);
});
  1. Watch the address
const EthProvider = require('ethwatcher').ethProvider;
const watch = require('ethwatcher').watch;
const eth = new EthProvider('http://localhost:8545');
const address = '0x30b82c8694b59695d78f33a7ba1c2a55dfa618d5'; // const watch = require('ethwatcher/lib/watch');
const retrySeconds = 3;
const watchFrom = false;
const watchTo = true;

watch(eth, address, retrySeconds, watchFrom, watchTo).then((txs) => {
  console.log(`Your got total ${txs.length} transactions.`);
  txs.forEach((tx) => {
    console.log(tx);
  });
}).catch((err) => {
  console.log(`Watch error: ${err.message}`);
});

Test

$ npm run test

Development

  1. Fork this repo and clone to your computer.
  2. Start a ethereum blockchain service, you can use ganache-cli, you can also use docker container see ethdock.
  3. Install packages
$ npm install
  1. Start to develop and have fun.

Demo

ethwatcher-demo

TODO

  • [ ] Watch multiple addresses at the same time
  • [ ] Update validator of URL format from RFC

Contribution

Thank you for considering to help out with the source code!

License

MIT