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

bitcoin-cash-faucet

v1.0.9

Published

A bitcoin faucet utility

Downloads

43

Readme

bitcoin-cash-faucet

A simple on-chain bitcoin cash faucet.

This tool uses a bitcoin script contract written with CashScript, which uses introspection to return the whole value of a contract back to itself in the first output, minus some available payout.

Relative timelocks are used to prevent paying out more times than once per given interval (one block by default).

It is a contract anyone can spend to send a set amount of coins to an address for free, without work.

Usage

Install the package in your preferred node environment, e.g.:

npm i bitcoin-cash-faucet # -g

Help may be shown with the -h flag

$ bitcoin-cash-faucet [--testnet]

━━━ Options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

--address #0    recieving address to send coins to
--fee #0        a custom fee, if mutliple inputs
--period #0     how often (in blocks) the contract can pay
--payout #0     how much the contract pays (satoshi)
--index #0      a nonce to force uniqueness with identical parameters

To see the default faucet balance on testnet4:

npx bitcoin-cash-faucet --testnet

which returns:

# contract index     # 1
contract address:      bchtest:pq75zmtt8d84nqnxv8vx3wj06mmzlhjnwu2n8uh89l
contract balance:      10797

The above indicates the contract number, deposit address and a balance of 10797 sats.

For mainnet:

npx bitcoin-cash-faucet 

Which returns:

# contract index     # 1
contract address:      bitcoincash:pq75zmtt8d84nqnxv8vx3wj06mmzlhjnwuwprm4szr
contract balance:      7576373

Getting a payout of testnet coins

To use the faucet, drop your address with the --address flag:

npx bitcoin-cash-faucet --testnet --address bchtest:qzz0tq2rg2xjgswchsvdrqzudsle8vje9g0zyhnap8

which returns:

# contract index     # 1
contract address:      bchtest:pq75zmtt8d84nqnxv8vx3wj06mmzlhjnwu2n8uh89l
contract balance:      4002
payout:              - 848
fee paid:            - 152
===================================
new contract balance:  3002

Indicating 848 was paid, 152 was given as a fee, and 3002 was returned to the contract.

Abusing

Let's get more coins by hitting the faucet again:

npx bitcoin-cash-faucet --testnet --address bchtest:qzz0tq2rg2xjgswchsvdrqzudsle8vje9g0zyhnap8

It throws an error indicating the transaction was rejected by BIP68 (timelock) rules,

# contract index     # 1
contract address:      bchtest:pq75zmtt8d84nqnxv8vx3wj06mmzlhjnwu2n8uh89l
contract balance:      2002
payout:              - 848
fee paid:            - 152
===================================
new contract balance:  1002
Internal Error: Transaction failed with reason: the transaction was rejected by network rules.

non-BIP68-final (code 64)

meep debug --tx=0200000001adcfc4865e56e6d1c8fe3b1543bcc9e5f7adcd1e4ae8fb1bda9465ae14da8eb6000000001f1e5102e80351b2757c00a26900cd02a914c1a97e01877e88c0c67c9400cca10100000002ea0300000000000017a9143d416d6b3b4f59826661d868ba4fd6f62fde53778750030000000000001976a91484f58143428d2441d8bc18d1805c6c3f93b2592a88ac41840100 --idx=0 --amt=2002 --pkscript=a9143d416d6b3b4f59826661d868ba4fd6f62fde537787

non-BIP68-final (code 64)

More faucets

The contract includes a index, or parameter to make the contract unique. If the first faucet is busy (already used that block), it should be possible to fire up another contract and fund it by changing this parameter:

npx bitcoin-cash-faucet --testnet --index 2
# contract index     # 2
contract address:      bchtest:pzvv2yhpsq2twj3kxgmsd76de4y785d3evmwavdl69
contract balance:      0

npx bitcoin-cash-faucet --testnet --index 3
# contract index     # 3
contract address:      bchtest:pzpzxvw8kluds32v3lpa9mq43l2rdpny656agju0lt
contract balance:      0

npx bitcoin-cash-faucet --testnet --index 1231232134
# contract index     # 1231232134
contract address:      bchtest:prgdau8978p7sg5prxy2ggsdcj859wzzayg7nf2e20
contract balance:      0

Obviously each new contract would need funding, and it would be fairly trivial for one party to collect all tBCH from every contract with little work every block.