Research/Bitcoin Dev Archive / lightning-dev list
LN without SegWit: less efficient or less secure?
11 messages, Jan 14 to 16, 2017. Started by Andrés G. Aragoneses.
Andrés G. Aragoneses (4), Anthony Towns (3), Rusty Russell, Matt Corallo, Stefano Pepe, Christian Decker
Hi there,
Seems like the list is a bit dormant these days.
Is it because of the low chances of SegWit activation given that it stalled at ~26%?
On this topic, I would like to ask about the feasibility of LN without SegWit, given these circumstances.
Some has been said in the past, I've been reading through the archives. But in them, everybody seemed overly enthusiastic about the activation of SegWit (maybe given that OP_CLTV and OP_CSV activated without hassle).
I also stumbled across some notes about a talk on this topic ("BIPs necessary for lightning"): https://diyhpl.us/wiki/transcripts/scalingbitcoin/hong-kong/overview-of-bips-necessary-for-lightning/ In it, the 3-levels of LN are explained, level 1 with OP_CLTV, level 2 with OP_CVS and level 3 with SegWit+SigHash new opcodes.
That link, the level I'm interested in (2), seems to only highlight about how inefficient would be compared to level3. However, Joseph Poon has been quoted also mentioning "security" problems involved in level2 vs level3: http://www.bitcoinisle.com/2016/11/12/whats-left-before-bitcoins-lightning-network-goes-live/:
"...while aspects of Lightning are possible without the fix, the technology would be far less secure without it"
This contrasts to what is said in this other article: https://bitcoinmagazine.com/articles/lightning-network-one-step-closer-to-reality-as-lightning-labs-announces-alpha-release-1484333955 :
"[level3] would allow users to outsource channel monitoring, which means they won’t have to constantly keep an eye on the Bitcoin blockchain. Meanwhile channels could be kept open longer and closed quicker. It would offer a better user experience overall”.
Which one is more accurate? Is the security problems only related to having to watch the blockchain? If yes, why cannot one outsource this job to a server (e.g. the hypothetical server of your light-wallet) in level2?
Thanks in advance for any clarifications,
Andres
"Andrés G. Aragoneses " <knocte at gmail.com> writes:
Quoted text (3 lines)
> Hi there, > > Seems like the list is a bit dormant these days.
Yes, most of the activity has been on the github repository:
https://github.com/lightningnetwork/lightning-rfc
Quoted text (9 lines)
> Is it because of the low chances of SegWit activation given that it stalled > at ~26%? > > On this topic, I would like to ask about the feasibility of LN without > SegWit, given these circumstances. > > Some has been said in the past, I've been reading through the archives. But > in them, everybody seemed overly enthusiastic about the activation of > SegWit (maybe given that OP_CLTV and OP_CSV activated without hassle).
If segwit doesn't activate, something is badly broken in Bitcoin. This is not really a lightning issue; there's been no significant technical objection to segwit, and it really does make Bitcoin work better.
I'm glad that miners are cautious with their upgrades, and segwit adoption will take time to roll out across products anyway. Let's look again in 6 months.
Quoted text (3 lines)
> Which one is more accurate? Is the security problems only related to having > to watch the blockchain? If yes, why cannot one outsource this job to a > server (e.g. the hypothetical server of your light-wallet) in level2?
Yes, the problem is outsourcing. You can't hand the outsourcer a penalty transaction signature if you don't know what the bad transaction will look like. And if the signatures are part of the transaction ID, you don't.
Hope that helps, Rusty.
On January 15, 2017 9:30:48 PM EST, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (3 lines)
>If segwit doesn't activate, something is badly broken in Bitcoin. This >is not really a lightning issue; there's been no significant technical >objection to segwit, and it really does make Bitcoin work better.
Depends on your point of view.... If you want a digital gold and don't care too much about payments, segwit not activating may be a good thing. It is a strong indication of how hard it is to change Bitcoin, and may even be an indication Bitcoin will never change in a major way again - a strong confirmation of exactly what you'd want from Bitcoin.
Rusty,I'm on the side that has given nothing to the code but is following with a lot of attention the evolution of LN and Segwit.We are ready to help. What can be done in your opinion?
Stefano Pepe CEO, UniquID Inc. http://uniquid.com
On Sun, Jan 15, 2017 at 6:39 PM -0800, "Rusty Russell" <rusty at rustcorp.com.au> wrote:
"Andrés G. Aragoneses " writes:
Quoted text (4 lines, sent without quote marks)
> Hi there, > > Seems like the list is a bit dormant these days. Yes, most of the activity has been on the github repository:
https://github.com/lightningnetwork/lightning-rfc
Quoted text (24 lines, sent without quote marks)
> Is it because of the low chances of SegWit activation given that it stalled > at ~26%? > > On this topic, I would like to ask about the feasibility of LN without > SegWit, given these circumstances. > > Some has been said in the past, I've been reading through the archives. But > in them, everybody seemed overly enthusiastic about the activation of > SegWit (maybe given that OP_CLTV and OP_CSV activated without hassle). If segwit doesn't activate, something is badly broken in Bitcoin. This is not really a lightning issue; there's been no significant technical objection to segwit, and it really does make Bitcoin work better. I'm glad that miners are cautious with their upgrades, and segwit adoption will take time to roll out across products anyway. Let's look again in 6 months. > Which one is more accurate? Is the security problems only related to having > to watch the blockchain? If yes, why cannot one outsource this job to a > server (e.g. the hypothetical server of your light-wallet) in level2? Yes, the problem is outsourcing. You can't hand the outsourcer a penalty transaction signature if you don't know what the bad transaction will look like. And if the signatures are part of the transaction ID, you don't. Hope that helps, Rusty.
On 16 January 2017 at 10:30, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (10 lines)
> "Andrés G. Aragoneses " <knocte at gmail.com> writes: > > Hi there, > > > > Seems like the list is a bit dormant these days. > > Yes, most of the activity has been on the github repository: > > https://github.com/lightningnetwork/lightning-rfc > >
That's good! I will ask some question about that, bu in a different thread...
Quoted text (16 lines)
> > Is it because of the low chances of SegWit activation given that it > stalled > > at ~26%? > > > > On this topic, I would like to ask about the feasibility of LN without > > SegWit, given these circumstances. > > > > Some has been said in the past, I've been reading through the archives. > But > > in them, everybody seemed overly enthusiastic about the activation of > > SegWit (maybe given that OP_CLTV and OP_CSV activated without hassle). > > If segwit doesn't activate, something is badly broken in Bitcoin. This > is not really a lightning issue; there's been no significant technical > objection to segwit, and it really does make Bitcoin work better. >
True.
But I guess we're learning that it can happen that technical improvements get non-technical impediments. In this case, my rough guess is that miners are afraid of losing their fee-gathering monopoly for moving money to layer2-actors (payment hubs), given that it will be much easier to spawn paymenthub nodes than mining nodes.
Given this, IMHO the only way to move forward would be to start running layer2 solutions in production in spite of the technical difficulties that SegWit non-activation implies. Then, when miners realize they cannot halt progress on layer2 development, they will probably start assuming they need to give up blocking, for the sake of not stagnating the currency (which would lead to the rise of usage of other chains I suppose).
Quoted text (15 lines)
> > I'm glad that miners are cautious with their upgrades, and segwit > adoption will take time to roll out across products anyway. Let's look > again in 6 months. > > > Which one is more accurate? Is the security problems only related to > having > > to watch the blockchain? If yes, why cannot one outsource this job to a > > server (e.g. the hypothetical server of your light-wallet) in level2? > > Yes, the problem is outsourcing. You can't hand the outsourcer a > penalty transaction signature if you don't know what the bad transaction > will look like. And if the signatures are part of the transaction ID, > you don't. >
Can you elaborate on this? From my limited understanding, I guess you're referring to detecting a broadcast of a transaction of a previous state of the payment channel. In this case, the HTLC-clock of the revocation transaction starts ticking, and the transaction to revoke this malicious move would need the ID of the transaction used to broadcast the bad state. Right?
If my assumption was correct, wouldn't it be possible to have an alternative Lightning-Level2? That is: without SegWit, but still with CSV. And, instead of using revocation, use shorter locktimes like the Spillman-style payment channels do (everytime there's a need to change direction)? I know that Spillman-style channels use nLockTime, which is vulnerable to malleability; so my question is: is there a way to create OP_CLTV/OP_CSV-style channels (instead of nLockTime-based, so malleability resistant) without using revocation methods?
Thanks
On Mon, Jan 16, 2017 at 01:00:48PM +1030, Rusty Russell wrote:
Quoted text (4 lines)
> > Which one is more accurate? Is the security problems only related to having > > to watch the blockchain? If yes, why cannot one outsource this job to a > > server (e.g. the hypothetical server of your light-wallet) in level2? > Yes, the problem is outsourcing.
I thought the big problem was setup; you can't setup a new channel with a stranger on the internet if they can coordinate with a miner to prevent you from being able to reclaim your funds. (I didn't think outsourcing was anywhere near ready, let alone already being blocked by miners :)
I have an idea on that though, I think... The idea when we were looking at BIP 62 as a solution (which would have still left signature malleability as a problem) was to have only one side pay into the funding transaction, so that the other side couldn't malleate it and prevent the inital refund. ie:
- Alice pays $X into an output redeemable by 2-of-2 multisig, Alice and Bob, signs it, works out the txid, but doesn't publish yet. - Alice asks Bob to sign a refund tx that spends that transaction giving $X back to Alice, with the usual HTLC behaviour so that it becomes unusable once the channel starts being used. - Once Bob does this and Alice is satisfied, Alice publishes the original $X tx and once it is in the blockchain the channel is open.
The problem is that if any third party malleability is possible, and happens to Alice's original tx, then Bob's signature on the refund tx is no longer useful, and unless Bob is kind enough to sign a new refund tx, Alice has lost her money.
Given there's no cost to Bob doing this, and potentially some profit if Bob can convince Alice to pay a 10% fee to get her money back (or even just the joy of vandalism if you're a troll or hate the idea of lightning or whatever), there could be lots of people filling the role of "Bob" and it could be hard to find someone safe to open a channel with, and, in effect, lightning isn't usable at all except with people you already know and trust, which isn't very decentralised.
Anyway my idea on avoiding this scenario: rather than have the funding transaction just have a single output and a fee, have two outputs and zero fee, the first being the funding output, and the second just being a P2PKH to yourself. In a second transaction, pay the entire second output as a fee, which will allow the unmalleated funding transaction to be propagated and mined via CPFP. Any malleated version of the first transaction will then be highly unlikely to get mined (or propogated), because it won't include any fees, and the second transaction won't be valid anymore, and nobody else will be able to generate a transaction that spends either output to help it get propogated.
For this to fail, your channel partner would need to conspire with a miner, and the miner would have to be lucky enough to beat all the honest miners, assuming you included a competitive fee. That seems pretty unlikely to me -- the miner would be giving up fee income now for the hope of a blackmail payment later. You could mitigate that further by giving channels an expiry time (ie, pay to (Alice and Bob) OR (CLTV 2 months, Alice)) so that you'd be guaranteed to get your funds back eventually. That makes blackmail and vandalism both hard and not profitable, which I think should be enough to make it vanishingly rare.
So I /think/ that's actually sufficient to get lightning working reliably on *today's* bitcoin blockchain, even prior to segwit activating?
(If you wanted to partner with a couple of miners and submit transactions directly, paying for them out of band, you could avoid the CPFP step too, but that wouldn't be at all decentralised)
(If both Alice and Bob separately setup funding transactions, once they're in the blockchain, they can be combined to fund a single channel as far as I can see)
(I might be mistaken, but I don't see "ancestor feerate" mentioned in the Bitcoin Unlimited git history and CPFP was a 0.13.0 feature, so I think that means that Bitcoin Unlimited miners won't mine CPFP transactions, and thus, with the approach outlined above, wouldn't mine transactions for people setting up lightning channels. So I think this gives everyone what they want? :)
Cheers, aj
On 16 January 2017 at 14:31, Anthony Towns <aj at erisian.com.au> wrote:
Quoted text (41 lines)
> On Mon, Jan 16, 2017 at 01:00:48PM +1030, Rusty Russell wrote: > > > Which one is more accurate? Is the security problems only related to > having > > > to watch the blockchain? If yes, why cannot one outsource this job to a > > > server (e.g. the hypothetical server of your light-wallet) in level2? > > Yes, the problem is outsourcing. > > I thought the big problem was setup; you can't setup a new channel with a > stranger on the internet if they can coordinate with a miner to prevent > you from being able to reclaim your funds. (I didn't think outsourcing > was anywhere near ready, let alone already being blocked by miners :) > > I have an idea on that though, I think... The idea when we were looking at > BIP 62 as a solution (which would have still left signature malleability > as a problem) was to have only one side pay into the funding transaction, > so that the other side couldn't malleate it and prevent the inital > refund. ie: > > - Alice pays $X into an output redeemable by 2-of-2 multisig, Alice and > Bob, > signs it, works out the txid, but doesn't publish yet. > - Alice asks Bob to sign a refund tx that spends that transaction giving > $X > back to Alice, with the usual HTLC behaviour so that it becomes unusable > once the channel starts being used. > - Once Bob does this and Alice is satisfied, Alice publishes the original > $X tx and once it is in the blockchain the channel is open. > > The problem is that if any third party malleability is possible, and > happens to Alice's original tx, then Bob's signature on the refund tx is > no longer useful, and unless Bob is kind enough to sign a new refund tx, > Alice has lost her money. > > Given there's no cost to Bob doing this, and potentially some profit if > Bob can convince Alice to pay a 10% fee to get her money back (or even > just the joy of vandalism if you're a troll or hate the idea of lightning > or whatever), there could be lots of people filling the role of "Bob" > and it could be hard to find someone safe to open a channel with, and, > in effect, lightning isn't usable at all except with people you already > know and trust, which isn't very decentralised. >
But I thought this problem was already solved by using OP_CLTV/OP_CSV -style channels instead of Spillman-style ones?
On Mon, Jan 16, 2017 at 02:44:43PM +0800, Andrés G. Aragoneses wrote:
Quoted text (4 lines)
> But I thought this problem was already solved by using OP_CLTV/OP_CSV -style > channels instead of Spillman-style ones? > See: > http://bitcoin.stackexchange.com/a/48546/2751
The approach described there is to have a channel timeout (adding the "customer signs, but locktime greater than refund time" alternative to the P2SH address). The lightning spec doesn't currently do that (see the "Funding Transaction Output" section of [0]). Lightning uses CLTV and CSV to make the HTLC steps work, that is to make the channel bidirectional, rather than being limited to having one end take the role of customer sending money to the merchant on the other end.
[0] https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md
It's not a 100% solution on its own though -- the "merchant" in this scenario can choose not to provide the second signature back to the customer ever, in which case the customer can't access their funds again until the refund time arrives. Better than being never able to access their funds again, of course, which is what you get if you use the current method, without segwit, and get malleated.
Cheers, aj
On 16 January 2017 at 15:32, Anthony Towns <aj at erisian.com.au> wrote:
Quoted text (15 lines)
> On Mon, Jan 16, 2017 at 02:44:43PM +0800, Andrés G. Aragoneses wrote: > > But I thought this problem was already solved by using OP_CLTV/OP_CSV > -style > > channels instead of Spillman-style ones? > > See: > > http://bitcoin.stackexchange.com/a/48546/2751 > > The approach described there is to have a channel timeout (adding the > "customer signs, but locktime greater than refund time" alternative to > the P2SH address). The lightning spec doesn't currently do that (see the > "Funding Transaction Output" section of [0]). Lightning uses CLTV and CSV > to make the HTLC steps work, that is to make the channel bidirectional, > rather than being limited to having one end take the role of customer > sending money to the merchant on the other end. >
Ok but I also read the last paragraph of the last version of the Lightning paper which I quote:
"A further stop-gap solution using OP CHECKSEQUENCEVERIFY 57or a less-optimal use of OP CHECKLOCKTIMEVERIFY will be described in a future paper by Rusty Russell. An updated version of this paper will also include these constructions."
So I guess I was confused by thinking that Lightning Level1 and Level2 was referring to this, and maybe someone forgot to update the paper to include L1&L2.
But no, we're talking about using CLTV (or CSV, I guess?) for the refund transaction instead of for the HTLC. Would we be able to call this an hypothetical Level2.5 of LN? (Level 3 being the one requiring SeqWit).
Quoted text (11 lines)
> > [0] https://github.com/lightningnetwork/lightning-rfc/blob/master/03- > transactions.md > > It's not a 100% solution on its own though -- the "merchant" in this > scenario can choose not to provide the second signature back to the > customer ever, in which case the customer can't access their funds > again until the refund time arrives. Better than being never able to > access their funds again, of course, which is what you get if you use > the current method, without segwit, and get malleated. >
Exactly, that's why I think L2.5 would be the only feasible solution in lack of L3.
Quoted text (5 lines)
> > Cheers, > aj > >
On Mon, Jan 16, 2017 at 12:57:49PM +0800, Andrés G. Aragoneses wrote:
Quoted text (5 lines)
> But I guess we're learning that it can happen that technical improvements > get non-technical impediments. In this case, my rough guess is that miners > are afraid of losing their fee-gathering monopoly for moving money to > layer2-actors (payment hubs), given that it will be much easier to spawn > paymenthub nodes than mining nodes.
This is a very common misconception among people. Lightning does not reduce the fees that the miners may collect, it increases their reach into transactions that they could not otherwise serve.
Think of it like this, there are nowadays many applications that are completely unfeasible in Bitcoin due to the high transaction fees. The transaction fees are high because an on-chain payment requires a lot of resources, i.e., storage, processing and bandwidth. These applications suddenly become possible with L2 protocols, so this adds to the reach of Bitcoin itself.
On the other hand Lightning requires strong guarantees that the transactions will be settled in a certain timeframe, for its security. Hence, Lightning will always attach higher than average fees to the on-chain transactions for setup and settlement of its channels. This is okay since coins on these channels may have been transferred hundreds if not millions of times back and forth, so the these high on-chain fees have been amortized over time, and we happily pay them.
With the (1) extension of Bitcoin's reach and (2) the higher than usual fees for setup and settlement, I'm absolutely convinced that miners will have a net gain when Lightning rolls out. Lightning is not cutting into the miner's profit, it opens up new possibilities.
Quoted text (6 lines)
> Given this, IMHO the only way to move forward would be to start running > layer2 solutions in production in spite of the technical difficulties that > SegWit non-activation implies. Then, when miners realize they cannot halt > progress on layer2 development, they will probably start assuming they need > to give up blocking, for the sake of not stagnating the currency (which > would lead to the rise of usage of other chains I suppose).
That may not all that easy since it'd require a major overhaul of some parts of the current protocol and would add a lot of complexity that segwit'd allow us to sidestep.
Quoted text (8 lines)
> If my assumption was correct, wouldn't it be possible to have an > alternative Lightning-Level2? That is: without SegWit, but still with CSV. > And, instead of using revocation, use shorter locktimes like the > Spillman-style payment channels do (everytime there's a need to change > direction)? I know that Spillman-style channels use nLockTime, which is > vulnerable to malleability; so my question is: is there a way to create > OP_CLTV/OP_CSV-style channels (instead of nLockTime-based, so malleability > resistant) without using revocation methods?
We actually have a protocol that does just that: my Duplex Micropayment Channels, but it has been neglected a bit lately and simply is not at the same development level as Lightning is. Furthermore it assumes that we have a malleability fix, otherwise the invalidation tree construction does not work.
Quoted text (5 lines)
> Thanks > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev
On Mon, Jan 16, 2017 at 04:26:15PM +0800, Andrés G. Aragoneses wrote:
Quoted text (10 lines)
> Ok but I also read the last paragraph of the last version of the Lightning > paper which I quote: > "A further stop-gap solution using OP CHECKSEQUENCEVERIFY > 57or a less-optimal use of OP CHECKLOCKTIMEVERIFY will be described > in a future paper by Rusty Russell. An updated version of this paper will > also include these constructions." > > So I guess I was confused by thinking that Lightning Level1 and Level2 was > referring to this, and maybe someone forgot to update the paper to include L1& > L2.
The three levels from the Scaling Bitcoin Hong Kong talk aren't really tightly defined/analysed; it's not worth reading *too* much into them. The third level in particular conflates segwit and the SIGHASH_NOINPUT idea; the former fixes malleability, but the latter would fix malleability and allow much better trustless outsourcing.
So:
level 1 -- CLTV only, no CSV; channels have a fixed end date, and every commitment has a fixed must-spend/obsolete-by date as well. no longer relevant.
level 2 -- CLTV and CSV, but second and third party malleability still possible. the current state of affairs. can only fund channels on one side or second party malleability messes you over, and may need to do something clever to avoid third party malleability (like introduce a time limit on the channel), but otherwise works great.
level 3(a) -- CLTV, CSV and segwit -- malleability isn't relevant. outsourcing of channel monitoring is inelegant (effectively infeasible?), because you need to provide whoever does the monitor with signed penalty txns for every possible transaction
level 3(b) -- CLTV, CSV and SIGHASH_NOINPUT (with or without segwit) -- all the benefits of 3(a) and you can cheaply get someone else to monitor the blockchain for you, making a "lite" lightning node feasible
The lightning paper itself is mostly designed around "level 0" when there wasn't even an OP_CLTV and you had to have intermediate layers of transactions using nLockTime to enforce the delay. (No doubt there will be "level 4" down the line when MAST/signature aggregation or something that makes things even more amazing)
Quoted text (3 lines)
> But no, we're talking about using CLTV (or CSV, I guess?) for the refund > transaction instead of for the HTLC. Would we be able to call this an > hypothetical Level2.5 of LN? (Level 3 being the one requiring SeqWit).
I think everyone's been focussed on 3(a) because getting rid of malleability is obviously a great thing for everyone in bitcoin, and segwit makes that actually possible. I'm not sure if there are actually variations of level 2 to justify a 2(a)/2(b) or 2.5 or similar.
Cheers, aj