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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cogitojs/faucet

v0.3.0

Published

Simple faucet with REST API

Downloads

39

Readme

faucet

This is a very simple faucet Express app. It supports the following REST call:

POST /donate/<ethereum address>

Installation

Cogito Faucet is a NodeJS program. It can be installed by running

npm install -g @cogitojs/faucet

or alternatively

yarn global install @cogitojs/faucet

Parameters

The cogito-faucet command takes the following arguments:

  • <account>, this first argument is the account number from which Ether will be donated. Needs to include the 0x prefix.
  • -d or --donation followed by an amount of Ether. This is the amount of Ether that is donated per request. Defaults to 0.1.
  • -p or --provider followed by the provider URL. This specifies the full URL of the node in your blockchain network (including http or https and port number if needed). Defaults to http://localhost:8545.
  • --port followed by a port number. The port that the faucet listens on. Defaults to 3001

The private key that corresponds with the account is specified as an environment variable:

COGITO_FAUCET_PRIVATE_KEY=C87509A1C067BBDE78BEB793E6FA76530B6382A4C0241E5E4A9EC0A0F44DC0D3

Example

This runs a faucet that hands out Ether in amount of 0.01 from the account 0x627306090abab3a6e1400e9345bc60c78a8bef57, using its corresponding private key. It uses the Ethereum node at ip address 192.168.1.112:

COGITO_FAUCET_PRIVATE_KEY=C87509A1C067BBDE78BEB793E6FA76530B6382A4C0241E5E4A9EC0A0F44DC0D3 \
cogito-faucet --donation 0.01 --provider http://192.168.1.112:8545 0x627306090abab3a6e1400e9345bc60c78a8bef57

Using the faucet

After the faucet is started, you can use test it by performing a post using e.g. curl:

curl -X POST -D - http://localhost:3001/donate/0xdf562290eceb83d659e23252ae8d38fa0bbc06e8

or using httpie:

http POST http://localhost:3001/donate/0xdf562290eceb83d659e23252ae8d38fa0bbc06e8

When using a deployed network, you may want to increase the timeouts. For curl:

curl -X POST -m 600 -D - https://blockchain.deployed.com/faucet/donate/0x6b0be084e6ffc7d6cace8e01e2814c869257c3aa

for httpie:

http --timeout=600 POST https://blockchain.deployed.com/faucet/donate/0x6b0be084e6ffc7d6cace8e01e2814c869257c3aa

This will give the network 10min.