Each of these three actor runs a Lightning Development Kit (LDK) Lightning Node.
Each actor remains self-custodial.
- Exchange: Lightning-enabled exchange, like Coinbase or Kraken.
- User: This self-custodial user wants the USD stability, also known as the Stable Receiver.
- LSP: "Lightning Service Provider." This actor is the Stable Provider.
graph LR
Exchange <---> LSP/Server <---> User/Mobile
To run this demo, you will need Rust installed. You must also be connected to the internet to use Mutinynet for testing.
Clone the repo and open it in two windows.
In this example, a user onboards to a Stable Channel from an exchange.
The user onboards by paying himselg via a Bolt11 Lightning invoice. The LSP creates this channel for the user and provides this stabiltiy service.
- In one window, run:
cargo run --features user
- In the other window, run:
cargo run --features lsp
- In a third window, run:
cargo run --features exchange
then
lsp getaddress
and
exchange getaddress
Go to https://faucet.mutinynet.com/ and send some test sats to these two addresses. Wait for them to confirm.
lsp balance
and
exchange balance
Open a channel between the exchange and the LSP. We will use this for routing.
exchange openchannel
Let's see if the channel got confirmed on the blockchain. Check if "channel_ready" equals "true."
lsp listallchannels
or
exchange listallchannels
Create a JIT invoice that will route from the exchange, through the Lightning Service Provider, and finally to the user.
user getjitinvoice
The LSP intercepts the payment, takes out a channel open fee, puts in matching Liquidity, and sends the rest to the user.
exchange payjitinvoice
Now the LSP has two channels. 1 to the exchange and one to the user.
lsp listallchannels
And the user has one channel:
user listallchannels
Using the command:
user startstablechannel CHANNEL_ID IS_STABLE_RECEIVER EXPECTED_DOLLAR_AMOUNT EXPECTED_BTC_AMOUNT
or:
user startstablechannel cca0a4c065e678ad8aecec3ae9a6d694d1b5c7512290da69b32c72b6c209f6e2 true 4.0 0