<blockquote>
  <p>So let's imagine a Lightning Network made up of thousand of nodes. Transactions are routed until the moment comes where all the channels need to be closed and commited I presume. Which node actually takes care of this?</p>
</blockquote>

<p>No, that is not how lightning works. All channels are not created and closed at the same time. They are created individually and closed individually. Each channel has its own 2-of-2 multisig, not the entire route. And channels are not established just for one route, that would be inefficient. Routing happens because there are channels that are already open between people and it is more efficient to route than it is to establish a new channel.</p>

<p>When a channel is closed, the two people in that channel will create the final commitment transaction for that channel and once that is broadcast and confirmed, the channel is closed.</p>

<blockquote>
  <p>who will actually pay the fees to the BTC network?</p>
</blockquote>

<p>With the current lightning protocol, the person who requested the creation of a channel will be the one who pays any transaction fees. Although if both parties mutually requested the creation of the channel, they can probably split the fees with a bit of manual transaction modification/creation.</p>

<blockquote>
  <p>Whoever is listening and has the transactions in hand can build this huge transaction (as long as the timelocks are respected) and soon it will be mined.</p>
</blockquote>

<p>No. Commitment transactions require the signatures of the parties involved in the channel.</p>

CC BY-SA 3.0
2017-07-04T18:09:09.303Z
Ok but how does the fee economy within LN work? I remember reading that  all nodes that help route the transaction to destination is incentivized to do this via fees. How so?
Luca Matteis
CC BY-SA 3.0
2017-07-04T18:12:37.923Z
The fees work via the differences in channel balances. For example (values not representative of actual), for a route of `A -> B -> C-> D->` where A sends D 0.5 BTC, A, via its channel with B, would send to B 0.52. Then B, via its channel with C, would send to C 0.51. Then C, via its channel with D, would send to D 0.5. In this way, B and C collect their fees from their channel balances and D receives the amount that he asked for.
Ava Chow
CC BY-SA 3.0
2017-07-04T22:14:58.007Z
When A sends to B 0.52 btc, does it have 0.5 btc as output to D and 0.2 to B? Then B sets as output 0.1 for C and 0.5 to D. And finally C just a single output of 0.5 to D?

Also, if the A->B channel ends, and the 0.52 tx is commited to the blockchain, D has his money and so does B (the 0.2 fee), but what about C and D?
Luca Matteis
CC BY-SA 3.0
2017-07-04T23:04:00.503Z
No. When A sends 0.52 to B, B gets all of the 0.52 in his `A <-> B` channel. Then B sends 0.51 to C and C gets all 0.51 in his `B <-> C` channel. Then C sends 0.5 to D and D gets 0.5 in his `C <-> D` channel. So if the `A <-> B` channel closes, D has his 0.5 from the `C <-> D` channel and A still has spent 0.52 which is now with B. With LN, A doesn't actually directly make an output to D unless they have a channel open with each other.
Ava Chow
CC BY-SA 3.0
2017-12-14T17:22:23.677Z
but what would make the lightning network commit to the blockchain in a timely fashion? what if on 2020 adding a transaction to the blockchain takes 10 months, how  lightning network solves that?
Nir O.
CC BY-SA 3.0
2017-12-14T17:27:33.593Z
@NirO. LN does not solve that problem. If there is so many transactions in the future that that happens, something else will need to be done to increase the onchain transaction capacity.
Ava Chow
CC BY-SA 3.0
2017-07-04T18:03:05.510Z
2017-07-04T18:03:05.510Z
Ava Chow
<p>So let's imagine a Lightning Network made up of thousand of nodes. Transactions are routed until the moment comes where all the channels need to be closed and commited I presume. Which node actually takes care of this? </p>

<p>I'm a bit confused of this process and it's not clear how the final transaction will be built, and more importantly, who will actually pay the fees to the BTC network?</p>

<p>I imagine this huge transaction will have lots inputs-ouputs based on the parties involved in the network for that moment of time. </p>

<p>I'm thinking it's a race game, right? So any node can broadcast this huge transaction to the blockchain, and since all the inputs-outputs have all the right signatures of the participants, all the money and fees will go to the nodes that helped route the transactions around, and of course all the money will correctly go to the right destinations.</p>

<p>Also, I'm thinking this is not something that happens every 10 mins or so. Whoever is listening and has the transactions in hand can build this huge transaction (as long as the timelocks are respected) and soon it will be mined.</p>

<p>But still, if the fee for the this huge tx is higher than what that single node got for routing it, what's the incentive for them to actually broadcast it rather than letting another node broadcast it, and hence put the burden on another node to pay the fees.</p>

<transaction-fees><lightning-network><ln-closing-channels>
In a Lightning Network who commits to the blockchain the final transaction?
Luca Matteis
# In a Lightning Network who commits to the blockchain the final transaction?

(Asked by: username_0 on 2017-07-04)

So let's imagine a Lightning Network made up of thousand of nodes. Transactions are routed until the moment comes where all the channels need to be closed and commited I presume. Which node actually takes care of this?

I'm a bit confused of this process and it's not clear how the final transaction will be built, and more importantly, who will actually pay the fees to the BTC network?

I imagine this huge transaction will have lots inputs-ouputs based on the parties involved in the network for that moment of time.

I'm thinking it's a race game, right? So any node can broadcast this huge transaction to the blockchain, and since all the inputs-outputs have all the right signatures of the participants, all the money and fees will go to the nodes that helped route the transactions around, and of course all the money will correctly go to the right destinations.

Also, I'm thinking this is not something that happens every 10 mins or so. Whoever is listening and has the transactions in hand can build this huge transaction (as long as the timelocks are respected) and soon it will be mined.

But still, if the fee for the this huge tx is higher than what that single node got for routing it, what's the incentive for them to actually broadcast it rather than letting another node broadcast it, and hence put the burden on another node to pay the fees.

**Tags:** transaction-fees, lightning-network, ln-closing-channels


---

## 1 answers

### Answer by username_1 on 2017-07-04. Score: 6 | Accepted answer

> So let's imagine a Lightning Network made up of thousand of nodes. Transactions are routed until the moment comes where all the channels need to be closed and commited I presume. Which node actually takes care of this?

No, that is not how lightning works. All channels are not created and closed at the same time. They are created individually and closed individually. Each channel has its own 2-of-2 multisig, not the entire route. And channels are not established just for one route, that would be inefficient. Routing happens because there are channels that are already open between people and it is more efficient to route than it is to establish a new channel.

When a channel is closed, the two people in that channel will create the final commitment transaction for that channel and once that is broadcast and confirmed, the channel is closed.

> who will actually pay the fees to the BTC network?

With the current lightning protocol, the person who requested the creation of a channel will be the one who pays any transaction fees. Although if both parties mutually requested the creation of the channel, they can probably split the fees with a bit of manual transaction modification/creation.

> Whoever is listening and has the transactions in hand can build this huge transaction (as long as the timelocks are respected) and soon it will be mined.

No. Commitment transactions require the signatures of the parties involved in the channel.

> **Comments:**
> **username_0**: Ok but how does the fee economy within LN work? I remember reading that  all nodes that help route the transaction to destination is incentivized to do this via fees. How so?  
> **username_1**: The fees work via the differences in channel balances. For example (values not representative of actual), for a route of `A -> B -> C-> D->` where A sends D 0.5 BTC, A, via its channel with B, would send to B 0.52. Then B, via its channel with C, would send to C 0.51. Then C, via its channel with D, would send to D 0.5. In this way, B and C collect their fees from their channel balances and D receives the amount that he asked for.  
> **username_0**: When A sends to B 0.52 btc, does it have 0.5 btc as output to D and 0.2 to B? Then B sets as output 0.1 for C and 0.5 to D. And finally C just a single output of 0.5 to D?  Also, if the A->B channel ends, and the 0.52 tx is commited to the blockchain, D has his money and so does B (the 0.2 fee), but what about C and D?  
> **username_1**: No. When A sends 0.52 to B, B gets all of the 0.52 in his `A <-> B` channel. Then B sends 0.51 to C and C gets all 0.51 in his `B <-> C` channel. Then C sends 0.5 to D and D gets 0.5 in his `C <-> D` channel. So if the `A <-> B` channel closes, D has his 0.5 from the `C <-> D` channel and A still has spent 0.52 which is now with B. With LN, A doesn't actually directly make an output to D unless they have a channel open with each other.  
> **username_2**: but what would make the lightning network commit to the blockchain in a timely fashion? what if on 2020 adding a transaction to the blockchain takes 10 months, how  lightning network solves that?  
> **username_1**: @NirO. LN does not solve that problem. If there is so many transactions in the future that that happens, something else will need to be done to increase the onchain transaction capacity.  

---

