Mar 3 2020 - Wallets, Dev Tools, Keysend

New Wallet Functionality

The wallet structure has been completely re-written / tested over the last few months to include permission capabilities and now supports multiple wallets per user*. The main benefit here is to separate the wallet functionality from the "products" (paywalls / faucets / etc). We can then attach wallets to these products and handle the actual money flow separately.

Paywall Wallet - All paywalls will have funds deposited in a Paywall Wallet which is generated when you first sign up. The goal is here eventually you will be able to tie certain wallets to certain paywalls.

Faucet Wallet - this hasn't been figured out yet, but infrastructure is there to do it. No changes to faucets.

Outsourced Wallets API

There is an API available to interact with these wallets with basic permissions (invoice, read, admin) which enable a host of flexibility in regards to segmentation of funds. You can have these wallets power your custodial service and relieve you of the headaches involved with balance management, send/receive, etc.

All of the basic functionality you would expect are included at the moment: create invoice, pay invoice, transfer between wallets, get balance, lnurl withdraw, get transactions

Example: A custodial LN blackjack site, user wants to deposit funds, LNPay.co wallet is created and invoice is generated from this wallet, user deposits funds, transfers are made between dealer wallet and user wallet as gameplay goes on, user withdraws from wallet. Access key for the wallet can be saved for user to recover.

An example in the wild: @talvasconcelos has built a smooth web based SparkPay PoS system using the outsource wallet API - check it out!

Obviously this wallet implementation is custodial, but that shouldn't hold you up from finding early product-market fit for your idea! Eventually there will be a non-custodial aspect to this as the space and the tools mature.

The API is also a good fit for hardware applications - check out the LNPay M5StackSats and Quickening implementation if you want to get your hands dirty and see it in action.

Developer Tools

There are a few new features added to help developers get their apps running smoothly.

Event Webhooks

This is a huge addition. Polling sux and everyone knows that. These webhooks enable you to receive a JSON object upon event trigger - see the events below. You can check out the documentation here. I really tried to take my time with this and think it all the way through. It may seem a bit verbose, but it is built to give as much flexibility to the developer as possible in the short and long term.

Webhooks must be configured / created through the LNPay.co dashboard at this time. The dashboard has some helpful features - webhook request log, send test requests that follow schema, redeliver requests, enable/disable hook, add secret for signature verification, and more. At the moment you must subscribe to ALL events per webhook, but the ability to choose events will be added soon.

Events

  • Wallet Transfer OUT

  • Wallet Transfer IN

  • Wallet Receive

  • Wallet Send

  • Wallet Create

  • Faucet Conversion

  • Paywall Conversion

  • Paywall Create

API Logging

Search and view API requests that have been made for easy debugging.

Fun stuff - Custodial Keysend!

I've been looking forward to keysend functionality for a while - and now that it is finally here I wanted to play around with it. The wallets now have "custodial" keysend receive functionality. You can see the keysend command to send to your wallet at the top of the wallet's page.

To send a keysend payment to one of your wallets:

lncli sendpayment \
-d 033868c219bdb51a33560d854d500fe7d3898a1ad9e05dd89d0007e11313588500 \
-a NUM_SATS \
--keysend \
--data 696969=77695f736b6c6c78435149377975724b69304e434354633077774f

The key part here is the 696969=77695f736b6c6c78435149377975724b69304e434354633077774fwhich includes the hex encoded wallet invoice key - wi_skllxCQI7yurKi0NCCTc0wwO and will direct the pushed payment to the correct wallet. At the moment only receiving is supported, sending will be added later on.

*Special thanks to @BTCSocialist for helping think through the wallet stuff, and for his work in the trenches finding pain points. Check out his FOSS multi-wallet project LNBits.com