mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
README: don't suggest low-level commands, talk about invoice, bolt11 and pay.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
cc4caf9d69
commit
3f2d93de93
1 changed files with 5 additions and 11 deletions
16
README.md
16
README.md
|
@ -102,27 +102,21 @@ You can check the status of the channel using `cli/lightning-cli getpeers`, whic
|
||||||
### Receiving and receiving payments
|
### Receiving and receiving payments
|
||||||
|
|
||||||
Payments in Lightning are invoice based.
|
Payments in Lightning are invoice based.
|
||||||
The recipient creates an invoice with the expected `<amount>` in millisatoshi, a `<label>` and a `<description>`:
|
The recipient creates an invoice with the expected `<amount>` in millisatoshi (or `"any"` for a donation), a unique `<label>` and a `<description>` the payer will see:
|
||||||
|
|
||||||
```
|
```
|
||||||
cli/lightning-cli invoice <amount> <label> <description>
|
cli/lightning-cli invoice <amount> <label> <description>
|
||||||
```
|
```
|
||||||
|
|
||||||
This returns a random value called `rhash` that is part of the invoice.
|
This returns some internal details, and a standard invoice string called `bolt11` (named after the [BOLT #11 lightning spec](https://github.com/lightningnetwork/lightning-rfc/blob/master/11-payment-encoding.md).
|
||||||
The recipient needs to communicate its ID `<recipient_id>`, `<rhash>` and the desired `<amount>` to the sender.
|
|
||||||
|
|
||||||
The sender needs to compute a route to the recipient, and use that route to actually send the payment.
|
The sender can feed this `bolt11` string to the `decodepay` command to see what it is, and pay it simply using the `pay` command:
|
||||||
The route contains the path that the payment will take through the Lightning Network and the respective funds that each node will forward.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
route=$(cli/lightning-cli getroute <recipient_id> <amount> 1 | jq --raw-output .route -)
|
cli/lightning-cli pay <bolt11>
|
||||||
cli/lightning-cli sendpay "$route" <rhash>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Notice that in the first step we stored the route in a variable and reused it in the second step.
|
Note that there are lower-level interfaces (and more options to these interfaces) for more sophisticated use.
|
||||||
`lightning-cli` should return a preimage that serves as a receipt, confirming that the payment was successful.
|
|
||||||
|
|
||||||
This low-level interface is still experimental and will eventually be complemented with a higher level interface that is easier to use.
|
|
||||||
|
|
||||||
## Further information
|
## Further information
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue