@bpanel/faucet
v0.1.2
Published
A plugin for adding a faucet interface for your bPanel instance, includes rate limiting for the API requests
Downloads
11
Readme
bPanel Faucet Plugin
This plugin adds a rate limited faucet plugin to your bPanel instance. There are both client and server side components to this plugin, which means that a minimum version of bPanel v1.0.0-beta
is required (since older versions do not support backend plugins).
Features
- Multi-network support: Bitcoin, Bitcoin Cash, Handshake
- Automatic address validation
- Server-side rate limiting (defaults to 1 request per hour)
- Blacklisting all non-faucet wallet endpoints
- Displays faucet balance and a return address
- Plugs into the bPanel theming system for easy, custom skins
Installation
Make sure you've got the latest version of bpanel-cli
installed
$ npm install -g @bpanel/bpanel-cli
Then install the plugin with bpanel-cli:
$ bpanel-cli install @bpanel/faucet
Finally, if you've got bPanel already running, make sure to restart the server. Otherwise, just start bPanel as normal:
# from your bPanel project directory
$ npm run start
This plugin is purely an interface with a compatible wallet node. By default, you will need
to have a wallet server running on the node you're connecting to and it will need to have
a (funded) wallet with the id faucet
in order to have full functionality. See steps below
for additional configuration options.
Development and Setup
By default, the plugin will blacklist all backend calls to wallet endpoints not made to a wallet with
the id faucet
. This is to avoid accidentally opening up other wallets on your server to the faucet service.
Faucet Admin
Absent any other kind of authentication, you can set the config variable faucet-admin
in your bPanel configs
which will disable the blacklisting and rate limiting. This can be helpful when testing during development.
Faucet ID
Another useful configuration is faucet-id
which lets you set a custom wallet id for the faucet source.
For example, if you're using a dedicated node for your faucet, you might just want to use your primary
wallet since that is the default wallet created by a bcoin, bcash, or hsd node.
Faucet Passphrase
If your faucet wallet has a passphrase set (highly recommended), you can set it for your client with the
faucet-passphrase
config.
Setting configs
The bPanel Faucet plugin uses the bPanel configuration system, built with
bcfg. These can be set at runtime (i.e. npm run start -- --faucet-admin=true --faucet-id=foobar
), in your bpanel's config.js
file or with an environment variable
(BPANEL_FAUCET_ID=primary
). Read more about bPanel's configurations
here.
Customizing the Rate Limiter
The rate limiter uses the express-rate-limit middleware
for Express. To customize the limiter, you can change the options in the apiLimiter
handler in
/server/handlers.js
.