mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 16:06:26 +00:00
completed revision
This commit is contained in:
parent
8cb60b7999
commit
0faec3b4d6
@ -2,160 +2,204 @@
|
|||||||
|
|
||||||
> :information_source: **NOTE:** This is a draft in progress, so that I can get some feedback from early reviewers. It is not yet ready for learning.
|
> :information_source: **NOTE:** This is a draft in progress, so that I can get some feedback from early reviewers. It is not yet ready for learning.
|
||||||
|
|
||||||
In this chapter you will learn how to pay an invoice using `lightning-cli pay ` command. As we did in previous chapter we already have an invoice to pay.
|
In this chapter you will learn how to pay an invoice using `lightning-cli pay ` command.
|
||||||
|
|
||||||
Check ln invoice:
|
## Checking your Balance
|
||||||
|
|
||||||
`lntb1m1p03ft7lpp5zve4dsgwgdxekqqq39vhgcnv6gfa2g2ktqy9lf0aph60d0388xmqdqqcqzpgsp545a9fphd8m5ayplcu8m5845cr4m0zcnyxddwv4g3zm32yprkfd4q9qy9qsq3s4y6cmyvh0qw9qm0sf80llxyyjy9xwrjds7lpkqhzv247jsm6q5me8t9e6ftquma664gz5u4a2rvs0yf4f0mlwtwfs6as5uj5djzhcqpnqlcj
|
Obviously, the first thing you need to do is make sure that you have enough funds to pay the invoice. In this case, we have the channel that we set up previously with `032a7572dc013b6382cde391d79f292ced27305aa4162ec3906279fc4334602543`, which contains 100,000 sats. This will be channel used to pay the invoice.
|
||||||
`
|
|
||||||
|
|
||||||
This invoice starts with prefix ln+tb+1m that indicates milli, so you should multi by 0.001. That means we'll pay an invoice by 100,000 satoshis.
|
|
||||||
|
|
||||||
The value `amount` could be a number in that currency, followed by an optional `multiplier` letter.
|
|
||||||
|
|
||||||
The following `multiplier` letters are defined:
|
|
||||||
|
|
||||||
* `m` (milli): multiply by 0.001
|
|
||||||
* `u` (micro): multiply by 0.000001
|
|
||||||
* `n` (nano): multiply by 0.000000001
|
|
||||||
* `p` (pico): multiply by 0.000000000001
|
|
||||||
|
|
||||||
### Understanding your invoice
|
|
||||||
|
|
||||||
If you want to decode your lightning invoice you should use `lightning-cli decodepay ` command that receives a string and checks and parses as specified by the [BOLT 11 specification](https://github.com/lightningnetwork/lightning-rfc/blob/master/11-payment-encoding.md).
|
|
||||||
|
|
||||||
On success it returns an object with the following fields:
|
|
||||||
|
|
||||||
* currency: Currency.
|
|
||||||
* timestamp: the UNIX-style timestamp of the invoice.
|
|
||||||
* expiry: the number of seconds this is valid after timestamp.
|
|
||||||
* payee: the public key of the recipient.
|
|
||||||
* payment_hash: the payment hash of the request.
|
|
||||||
* signature: the DER-encoded signature.
|
|
||||||
* description: Description.
|
|
||||||
|
|
||||||
```
|
|
||||||
c$lightning-cli --network=testnet decodepay lntb1m1p03ft7lpp5zve4dsgwgdxekqqq39vhgcnv6gfa2g2ktqy9lf0aph60d0388xmqdqqcqzpgsp545a9fphd8m5ayplcu8m5845cr4m0zcnyxddwv4g3zm32yprkfd4q9qy9qsq3s4y6cmyvh0qw9qm0sf80llxyyjy9xwrjds7lpkqhzv247jsm6q5me8t9e6ftquma664gz5u4a2rvs0yf4f0mlwtwfs6as5uj5djzhcqpnqlcj
|
|
||||||
{
|
|
||||||
"currency": "tb",
|
|
||||||
"created_at": 1595191263,
|
|
||||||
"expiry": 3600,
|
|
||||||
"payee": "0302d48972ba7eef8b40696102ad114090fd4c146e381f18c7932a2a1d73566f84",
|
|
||||||
"msatoshi": 100000000,
|
|
||||||
"amount_msat": "100000000msat",
|
|
||||||
"description": "First LN Payment - Learning Bitcoin and Lightning from the Command line.",
|
|
||||||
"min_final_cltv_expiry": 40,
|
|
||||||
"payment_secret": "ad3a5486ed3ee9d207f8e1f743d6981d76f16264335ae6551116e2a204764b6a",
|
|
||||||
"features": "028200",
|
|
||||||
"payment_hash": "133356c10e434d9b0000895974626cd213d5215658085fa5fd0df4f6be2739b6",
|
|
||||||
"signature": "30450221008c2a4d636465de07141b7c1277ffe621244299c39361ef86c0b898aafa50de8102204de4eb2e7495839beeb5540a9caf543641e44d52fdfdcb7261aec29c951b215f"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
Check payee value is the same as identity_pubkey value seen previous chapter.
|
|
||||||
|
|
||||||
**"identity_pubkey": "0302d48972ba7eef8b40696102ad114090fd4c146e381f18c7932a2a1d73566f84",**
|
|
||||||
|
|
||||||
### Check your balance
|
|
||||||
|
|
||||||
As we did in previous chapter we have established an channel with a total capacity of 280,000 sats. This will be channel used to pay the invoice.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
c$ lightning-cli --network=testnet listfunds
|
c$ lightning-cli --network=testnet listfunds
|
||||||
{
|
{
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"txid": "9843c037f54a4660b297a9f2454e11d26d8659f084a284a5740bb15cb1d97aa6",
|
"txid": "66694d23ca15efe379e5f4a71d9be1a2d65e383b89ee3abe126ee36a12f23c1d",
|
||||||
"output": 0,
|
"output": 1,
|
||||||
"value": 19238,
|
"value": 99847,
|
||||||
"amount_msat": "19238000msat",
|
"amount_msat": "99847000msat",
|
||||||
"scriptpubkey": "0014aa572371f29310cd677d039cdcd054156c1a9545",
|
"scriptpubkey": "00142fe02e5be9283e8c5bcb93ae61421baf8cb64f9c",
|
||||||
"address": "tb1q4ftjxu0jjvgv6emaqwwde5z5z4kp49299gmdpd",
|
"address": "tb1q9lszuklf9qlgck7tjwhxzssm47xtvnuu4jslf8",
|
||||||
"status": "confirmed",
|
"status": "confirmed",
|
||||||
"blockheight": 1780768,
|
"blockheight": 1862856,
|
||||||
"reserved": false
|
"reserved": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"channels": [
|
"channels": [
|
||||||
{
|
{
|
||||||
"peer_id": "0302d48972ba7eef8b40696102ad114090fd4c146e381f18c7932a2a1d73566f84",
|
"peer_id": "032a7572dc013b6382cde391d79f292ced27305aa4162ec3906279fc4334602543",
|
||||||
"connected": true,
|
|
||||||
"state": "CHANNELD_AWAITING_LOCKIN",
|
|
||||||
"channel_sat": 280000,
|
|
||||||
"our_amount_msat": "280000000msat",
|
|
||||||
"channel_total_sat": **280000**,
|
|
||||||
"amount_msat": "280000000msat",
|
|
||||||
"funding_txid": "9843c037f54a4660b297a9f2454e11d26d8659f084a284a5740bb15cb1d97aa6",
|
|
||||||
"funding_output": 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Paying your invoice
|
|
||||||
|
|
||||||
You should use `lightning-cli pay ` command to pay the invoice. The pay RPC command attempts to find a route to the given destination, and send the funds asked in amount value.
|
|
||||||
|
|
||||||
Notice amount is expressed in milli-satoshi.
|
|
||||||
|
|
||||||
```
|
|
||||||
c$lightning-cli --network=testnet pay
|
|
||||||
lntb1m1p03ft7lpp5zve4dsgwgdxekqqq39vhgcnv6gfa2g2ktqy9lf0aph60d0388xmqdqqcqzpgsp545a9fphd8m5ayplcu8m5845cr4m0zcnyxddwv4g3zm32yprkfd4q9qy9qsq3s4y6cmyvh0qw9qm0sf80llxyyjy9xwrjds7lpkqhzv247jsm6q5me8t9e6ftquma664gz5u4a2rvs0yf4f0mlwtwfs6as5uj5djzhcqpnqlcj
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"payment_hash": "133356c10e434d9b0000895974626cd213d5215658085fa5fd0df4f6be2739b6",
|
|
||||||
"destination": "0302d48972ba7eef8b40696102ad114090fd4c146e381f18c7932a2a1d73566f84",
|
|
||||||
"msatoshi": 100000000,
|
|
||||||
"amount_msat": "100000000msat",
|
|
||||||
"msatoshi_sent": 100000000,
|
|
||||||
"amount_sent_msat": "100000000msat",
|
|
||||||
"created_at": 1595191379,
|
|
||||||
"status": "complete",
|
|
||||||
"payment_preimage": "8b7549ffd4e648374669d47992c1ab44086501d5dd85d7e3d15766d70e9196e3",
|
|
||||||
"bolt11": "lntb1m1p03ft7lpp5zve4dsgwgdxekqqq39vhgcnv6gfa2g2ktqy9lf0aph60d0388xmqdqqcqzpgsp545a9fphd8m5ayplcu8m5845cr4m0zcnyxddwv4g3zm32yprkfd4q9qy9qsq3s4y6cmyvh0qw9qm0sf80llxyyjy9xwrjds7lpkqhzv247jsm6q5me8t9e6ftquma664gz5u4a2rvs0yf4f0mlwtwfs6as5uj5djzhcqpnqlcj"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check your balance
|
|
||||||
|
|
||||||
We've performed payment successfully and gets decreased channel balance on our side. Now it has 180,000 as available balance.
|
|
||||||
|
|
||||||
```
|
|
||||||
c$ lightning-cli --network=testnet listfunds
|
|
||||||
{
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"txid": "9843c037f54a4660b297a9f2454e11d26d8659f084a284a5740bb15cb1d97aa6",
|
|
||||||
"output": 0,
|
|
||||||
"value": 19238,
|
|
||||||
"amount_msat": "19238000msat",
|
|
||||||
"scriptpubkey": "0014aa572371f29310cd677d039cdcd054156c1a9545",
|
|
||||||
"address": "tb1q4ftjxu0jjvgv6emaqwwde5z5z4kp49299gmdpd",
|
|
||||||
"status": "confirmed",
|
|
||||||
"blockheight": 1780768,
|
|
||||||
"reserved": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"channels": [
|
|
||||||
{
|
|
||||||
"peer_id": "0302d48972ba7eef8b40696102ad114090fd4c146e381f18c7932a2a1d73566f84",
|
|
||||||
"connected": true,
|
"connected": true,
|
||||||
"state": "CHANNELD_NORMAL",
|
"state": "CHANNELD_NORMAL",
|
||||||
"short_channel_id": "1780768x12x1",
|
"short_channel_id": "1862856x29x0",
|
||||||
"channel_sat": 180000,
|
"channel_sat": 100000,
|
||||||
"our_amount_msat": "180000000msat",
|
"our_amount_msat": "100000000msat",
|
||||||
"channel_total_sat": 280000,
|
"channel_total_sat": 100000,
|
||||||
"amount_msat": "280000000msat",
|
"amount_msat": "100000000msat",
|
||||||
"funding_txid": "9843c037f54a4660b297a9f2454e11d26d8659f084a284a5740bb15cb1d97aa6",
|
"funding_txid": "66694d23ca15efe379e5f4a71d9be1a2d65e383b89ee3abe126ee36a12f23c1d",
|
||||||
"funding_output": 1
|
"funding_output": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
If you didn't have enough funds, you'd need to create a new channel.
|
||||||
|
|
||||||
|
## Paying Your Invoice
|
||||||
|
|
||||||
|
You use `lightning-cli pay ` command to pay an invoice. It will attempt to find a route to the given destination and send the funds asked in amount value.
|
||||||
|
|
||||||
|
```
|
||||||
|
c$ lightning-cli --network=testnet pay lntb100u1p0cwnqtpp5djkdahy4hz0wc909y39ap9tm3rq2kk9320hw2jtntwv4x39uz6asdr5ge5hyum5ypxyugzsv9uk6etwwssz6gzvv4shymnfdenjqsnfw33k76twypskuepqf35kw6r5de5kueeqveex7mfqw35x2gzrdakk6ctwvssxc6twv5hqcqzpgsp5a9ryqw7t23myn9psd36ra5alzvp6lzhxua58609teslwqmdljpxs9qy9qsq9ee7h500jazef6c306psr0ncru469zgyr2m2h32c6ser28vrvh5j4q23c073xsvmjwgv9wtk2q7j6pj09fn53v2vkrdkgsjv7njh9aqqtjn3vd
|
||||||
|
{
|
||||||
|
"destination": "032a7572dc013b6382cde391d79f292ced27305aa4162ec3906279fc4334602543",
|
||||||
|
"payment_hash": "6cacdedc95b89eec15e5244bd0957b88c0ab58b153eee549735b995344bc16bb",
|
||||||
|
"created_at": 1602704828.948,
|
||||||
|
"parts": 1,
|
||||||
|
"msatoshi": 10000000,
|
||||||
|
"amount_msat": "10000000msat",
|
||||||
|
"msatoshi_sent": 10000000,
|
||||||
|
"amount_sent_msat": "10000000msat",
|
||||||
|
"payment_preimage": "1af4a9bb830e49b6bc8f0bef980630e189e3794ad1705f06ad1b9c71571dce0c",
|
||||||
|
"status": "complete"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Note that here all the amounts are in `msats`, not `sats`!
|
||||||
|
|
||||||
|
### Paying Your Invoice Across the Network
|
||||||
|
|
||||||
|
Note that you do _not_ need to have a channel with a node in order to pay them. There just needs to be a reasonable route across the Lightning Network that you're connected too.
|
||||||
|
|
||||||
|
Imagine that you received this payment request:
|
||||||
|
```
|
||||||
|
c$ lightning-cli --network=testnet decodepay lntb111110p1p0cw43ppp5u0ngjytlw6ywec3x784jale4xd7h058g9u4mthcaf9rl2f7g8zxsdp2t9hh2gr0wajjqmt9ypnx7u3qv35kumn9wgs8gmm0yyxqyjw5qcqp2sp5kj4xhrthmfgcgyl84zaqpl9vvdjwm5x368kr09fu5nym74setw4s9qy9qsq8hxjr73ee77vat0ay603e4w9aa8ag9sa2n55xznk5lsfrjffxxdj2k0wznvcfa98l4a57s80j7dhg0cc03vwqdwehkujlzxgm0xyynqqslwhvl
|
||||||
|
{
|
||||||
|
"currency": "tb",
|
||||||
|
"created_at": 1602704929,
|
||||||
|
"expiry": 604800,
|
||||||
|
"payee": "02f3d74746934494fa378235e5bc44cfdbb5b8779d839263fb7f9218be032f6f61",
|
||||||
|
"msatoshi": 11111,
|
||||||
|
"amount_msat": "11111msat",
|
||||||
|
"description": "You owe me for dinner too!",
|
||||||
|
"min_final_cltv_expiry": 10,
|
||||||
|
"payment_secret": "b4aa6b8d77da518413e7a8ba00fcac6364edd0d1d1ec37953ca4c9bf56195bab",
|
||||||
|
"features": "028200",
|
||||||
|
"payment_hash": "e3e689117f7688ece226f1eb2eff35337d77d0e82f2bb5df1d4947f527c8388d",
|
||||||
|
"signature": "304402203dcd21fa39cfbcceadfd269f1cd5c5ef4fd4161d54e9430a76a7e091c929319b02202559ee14d984f4a7fd7b4f40ef979b743f187c58e035d9bdb92f88c8dbcc424c"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
If you tried to pay it, and you didn't have a connection through the Lightning Network to the recipient, you could expect an error like this:
|
||||||
|
```
|
||||||
|
c$ lightning-cli --network=testnet pay lntb111110p1p0cw43ppp5u0ngjytlw6ywec3x784jale4xd7h058g9u4mthcaf9rl2f7g8zxsdp2t9hh2gr0wajjqmt9ypnx7u3qv35kumn9wgs8gmm0yyxqyjw5qcqp2sp5kj4xhrthmfgcgyl84zaqpl9vvdjwm5x368kr09fu5nym74setw4s9qy9qsq8hxjr73ee77vat0ay603e4w9aa8ag9sa2n55xznk5lsfrjffxxdj2k0wznvcfa98l4a57s80j7dhg0cc03vwqdwehkujlzxgm0xyynqqslwhvl
|
||||||
|
{
|
||||||
|
"code": 210,
|
||||||
|
"message": "Ran out of routes to try after 11 attempts: see `paystatus`",
|
||||||
|
"attempts": [
|
||||||
|
{
|
||||||
|
"status": "failed",
|
||||||
|
"failreason": "Error computing a route to 02f3d74746934494fa378235e5bc44cfdbb5b8779d839263fb7f9218be032f6f61: \"Could not find a route\" (205)",
|
||||||
|
"partid": 1,
|
||||||
|
"amount": "11111msat"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
```
|
||||||
|
But what if a host that you had a channel with (say, `032a7572dc013b6382cde391d79f292ced27305aa4162ec3906279fc4334602543`) opened a channel with the intended recipient?
|
||||||
|
|
||||||
|
In that case, when you go to pay the invoice, it will _automatically work_!
|
||||||
|
```
|
||||||
|
c$ lightning-cli --network=testnet pay lntb111110p1p0cw43ppp5u0ngjytlw6ywec3x784jale4xd7h058g9u4mthcaf9rl2f7g8zxsdp2t9hh2gr0wajjqmt9ypnx7u3qv35kumn9wgs8gmm0yyxqyjw5qcqp2sp5kj4xhrthmfgcgyl84zaqpl9vvdjwm5x368kr09fu5nym74setw4s9qy9qsq8hxjr73ee77vat0ay603e4w9aa8ag9sa2n55xznk5lsfrjffxxdj2k0wznvcfa98l4a57s80j7dhg0cc03vwqdwehkujlzxgm0xyynqqslwhvl
|
||||||
|
{
|
||||||
|
"destination": "02f3d74746934494fa378235e5bc44cfdbb5b8779d839263fb7f9218be032f6f61",
|
||||||
|
"payment_hash": "e3e689117f7688ece226f1eb2eff35337d77d0e82f2bb5df1d4947f527c8388d",
|
||||||
|
"created_at": 1602709081.324,
|
||||||
|
"parts": 1,
|
||||||
|
"msatoshi": 11111,
|
||||||
|
"amount_msat": "11111msat",
|
||||||
|
"msatoshi_sent": 12111,
|
||||||
|
"amount_sent_msat": "12111msat",
|
||||||
|
"payment_preimage": "ec7d1b28a7b877cd92b83be396899e8bfc3ecb0b4f944f65afb4be7d0ee72617",
|
||||||
|
"status": "complete"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
That's the true beauty of the Lightning Network there: with no effort from the peer-to-peer participants, their individual channels become a network!
|
||||||
|
|
||||||
|
> :book: ***How Do Payments Work Across the Network?*** Say that node A (`03240a4878a9a64aea6c3921a434e573845267b86e89ab19003b0c910a86d17687`) has a channel open with node B (`0302d48972ba7eef8b40696102ad114090fd4c146e381f18c7932a2a1d73566f84`), node B has a channel open with node C (`02f3d74746934494fa378235e5bc44cfdbb5b8779d839263fb7f9218be032f6f61`) and node A receives an invoice from node C for 11,111 msat. Node A pay node B the 11,111 msat, plus a small fee, and then node B passes it on to node C. Easy enough. Except remember that all channels actually are just records of who owns how much of the Funding Transaction. So what really happens is 11,111 msat of the Funding Transaction on channel A-B shifts from A to B, and then 11,111 msat of the Funding Transaction on channel B-C shifts from B to C. This means that two things are required for this payment to work: first, each channel must have sufficient capacity for the payment; and second, the payer for each channel must own enough of the capacity to make the payment.
|
||||||
|
|
||||||
|
### Check your balance
|
||||||
|
|
||||||
|
Having successfully made a payment, you should see that your funds have changed accordingly.
|
||||||
|
|
||||||
|
Here's what funds looked like for the paying node following the initial payment of 10,000 satoshis:
|
||||||
|
```
|
||||||
|
c$ lightning-cli --network=testnet listfunds
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"txid": "66694d23ca15efe379e5f4a71d9be1a2d65e383b89ee3abe126ee36a12f23c1d",
|
||||||
|
"output": 1,
|
||||||
|
"value": 99847,
|
||||||
|
"amount_msat": "99847000msat",
|
||||||
|
"scriptpubkey": "00142fe02e5be9283e8c5bcb93ae61421baf8cb64f9c",
|
||||||
|
"address": "tb1q9lszuklf9qlgck7tjwhxzssm47xtvnuu4jslf8",
|
||||||
|
"status": "confirmed",
|
||||||
|
"blockheight": 1862856,
|
||||||
|
"reserved": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"channels": [
|
||||||
|
{
|
||||||
|
"peer_id": "032a7572dc013b6382cde391d79f292ced27305aa4162ec3906279fc4334602543",
|
||||||
|
"connected": true,
|
||||||
|
"state": "CHANNELD_NORMAL",
|
||||||
|
"short_channel_id": "1862856x29x0",
|
||||||
|
"channel_sat": 90000,
|
||||||
|
"our_amount_msat": "90000000msat",
|
||||||
|
"channel_total_sat": 100000,
|
||||||
|
"amount_msat": "100000000msat",
|
||||||
|
"funding_txid": "66694d23ca15efe379e5f4a71d9be1a2d65e383b89ee3abe126ee36a12f23c1d",
|
||||||
|
"funding_output": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Note that the channel capacity remains at 100,000 satoshis (it never changes!), but that `our_amount` is now just 90,000 satoshis (or 90,000,000 msat).
|
||||||
|
|
||||||
|
After paying the second invoice, for 11,111 msat, the funds change again accordingly:
|
||||||
|
```
|
||||||
|
$ lightning-cli --network=testnet listfunds
|
||||||
|
{
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"txid": "66694d23ca15efe379e5f4a71d9be1a2d65e383b89ee3abe126ee36a12f23c1d",
|
||||||
|
"output": 1,
|
||||||
|
"value": 99847,
|
||||||
|
"amount_msat": "99847000msat",
|
||||||
|
"scriptpubkey": "00142fe02e5be9283e8c5bcb93ae61421baf8cb64f9c",
|
||||||
|
"address": "tb1q9lszuklf9qlgck7tjwhxzssm47xtvnuu4jslf8",
|
||||||
|
"status": "confirmed",
|
||||||
|
"blockheight": 1862856,
|
||||||
|
"reserved": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"channels": [
|
||||||
|
{
|
||||||
|
"peer_id": "032a7572dc013b6382cde391d79f292ced27305aa4162ec3906279fc4334602543",
|
||||||
|
"connected": true,
|
||||||
|
"state": "CHANNELD_NORMAL",
|
||||||
|
"short_channel_id": "1862856x29x0",
|
||||||
|
"channel_sat": 89987,
|
||||||
|
"our_amount_msat": "89987000msat",
|
||||||
|
"channel_total_sat": 100000,
|
||||||
|
"amount_msat": "100000000msat",
|
||||||
|
"funding_txid": "66694d23ca15efe379e5f4a71d9be1a2d65e383b89ee3abe126ee36a12f23c1d",
|
||||||
|
"funding_output": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Note here that an additional 1,889msat was lost, which is 2 satoshis, or less than a cent currently. That was the fee for sending the intermediary node sending the 11,111 msat transaction on to its final destination. Fees are cheap on Lightning, which is one of its compelling features!
|
||||||
|
|
||||||
## Summary: Paying a Invoice
|
## Summary: Paying a Invoice
|
||||||
|
|
||||||
We've created an invoice by 100,000 satoshis using a second machine and we've payed it using our main Lightning network node c-lightning. The channel was created with an initial amount of 280,000 satoshis. This is called Total capacity channel. Later we've payed invoice we proved local balance was reduced remaining at 180,000 satoshis.
|
Once you've got an invoice, it's easy enough to pay with a single command in Lightning. Even if you don't have a channel to a recipient, payment is that simple, provided that there's a route between you and the destination node.
|
||||||
|
|
||||||
## What's Next?
|
## What's Next?
|
||||||
|
|
||||||
Continue "Understanding Your Lightning Setup" with [§19.3: Closing a Channel](19_3_Closing_a_Channel.md).
|
Continue "Using Lighting" with [§19.3: Closing a Channel](19_3_Closing_a_Channel.md).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user