Skip to content

getAlby/nwc-faucet

Repository files navigation

NWC Faucet

Build and test your application end to end without needing a real lightning wallet!

NWC Faucet allows you to create test wallets / dummy NWC connections for rapid app development and testing.

Try it now

Powered by Alby Hub

API

Create new wallets

To create a new wallet with a starting balance of 10,000 sats:

curl -X POST https://faucet.nwc.dev?balance=10000

returns a connection string like this:

nostr+walletconnect://98e3f640a3d7dba6620f38b15abb4f4d58824bc309bb9f2bbee1eb55308e6eab?relay=wss://relay.getalby.com/v1&secret=09fc2a6cd2cfb6b61bc14fa943cc9dbd3303d6e07a3e459b8bb33c69ca54de68&[email protected]

The name of the wallet is the same as the username part of the lightning address (lud16 parameter above), in this case nwc1769067475.

Top up a wallet

Then you can top up any wallet that was created by the faucet. The amount parameter is in sats.

curl -X POST https://faucet.nwc.dev/wallets/nwc1769067475/topup?amount=10000

Make an invoice

Create a BOLT-11 lightning invoice from the faucet's main wallet. The amount parameter is in sats.

curl -X POST https://faucet.nwc.dev/make-invoice?amount=1000

You can optionally include a description:

curl -X POST "https://faucet.nwc.dev/make-invoice?amount=1000&description=Test%20payment"

Pay an invoice

Pay a BOLT-11 lightning invoice from the faucet's main wallet.

curl -X POST https://faucet.nwc.dev/pay-invoice?invoice=lnbc...

Development

Setup env

Configure your .env file for your Alby Hub based on where it is deployed.

⚠️ this app MUST be used with a hub that has no channels and MUST have an Alby subscription. To pay for the subscription, you should use another Alby Hub with channels.

You can get the ALBY_HUB_URL and AUTH_TOKEN by logging into Alby Hub and Going to settings -> Developer. If you use Alby Cloud, you'll also need to provide ALBY_HUB_NAME and ALBY_HUB_REGION to route requests to your hub.

cp .env.example .env
yarn install
yarn dev

Production

yarn build
yarn start

About

Create test wallets for building NWC apps

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors