Research/Bitcoin Dev Archive / lightning-dev list
Proposal for skip channel confirmation.
7 messages, Aug 24 to 27, 2020. Started by Roei Erez.
Roei Erez (2), Antoine Riard (2), ZmnSCPxj (2), Matt Corallo
Hello everyone,
I would like to discuss the ability to skip a channel funding transaction confirmation, making the channel fully operational before its on-chain confirmation (aka a zero-conf channel). Till confirmation, this channel requires trust between its two parties and in the case of a remote initiator, it puts the received funds of the local party at risk. Nevertheless, there are cases where it makes sense to support this behavior. For example, in cases both parties decide to trust each other. Or, in cases where trust between the parties already exists (buying a pre-loaded channel from a service like Bitrefill).
The motivation is gained from the "Immediate on-boarding" use case:
* Bob is connected to a routing node and issues an invoice with a
routing hint that points to a fake channel between Bob and that node.
* When Alice pays Bob's invoice, the routing node intercepts the HTLC
and holds it.
* Then, the routing node does the following:
* Opens a channel to Bob where Bob has a choice of skipping funding
confirmation (channel is open and active).
* Pays Bob the original Alices' invoice (potentially, minus a service fee)
Quoted text (1 line)
>From Bob perspective it is his choice on whether to agree for the
payment via this channel (and by that increase the trust) or disagree and wait for confirmation. Another practical way for Bob is to skip confirmation and "hold" the payment by not providing the pre-image.
Right now different implementations support zero-conf channels in different ways. These implementations have defined their own way on how to agree on a short_channel_id (fake one) before the transaction is confirmed.
The following suggests some changes to the funding flow to support that:
1. accept_channel message - in case the fundee wants to skip
confirmation he sends minimum_depth=0
2. funding_signed message - no change.
3. funding_locked message - if fundee has sent minimum_depth=0, then
both parties send funding_locked while the channel_id is derived using a
convention agreed on both. One proposal for such convention is to take it
from the temporary_channel_id provided in previous open_channel
message as follows:
* Use the first 8 bytes to initialize an unsigned integer,
call it shortID
* Apply this transformation: shortID / 2^6 + 100,000
* The above transformation ensures the block height falls in the
range of 100,000 - 2^18+100,000. The rationale is that the id will
never point to a valid mined transaction and the first 100,000 blocks
are left for testing in other chains.
* Assuming the temporary_channel_id is some random number, it is
not likely that the derived short_channel_id will conflict with other
channels in both peers but both peers should validate that before
sending funding_locked.
4. When the channel is confirmed gossip messages such as
channel_update are re-broadcasted and refers to the confirmed
channel_id (such as the case with re-org).
I created a PR in LND that implements these changes https://github.com/lightningnetwork/lnd/pull/4424
Cheers, Roei
A few notes.
Given gossip messages will be rejected by many nodes if no such on-chain transaction exists, I don't think you can "re-broadcast" gossip messages at that time, instead I believe you simply need to not gossip until the funding transaction has some confirmations. Still, this shouldn't prevent receiving payments, as invoices carrying a last-hop hint should be able to indicate any short_channel_id value and have it be accepted.
It may make sense to reuse some "private short channel ID negotiation" feature for the temporary 0-conf short channel id value.
One thing this protocol doesn't capture is unidirectional 0-conf - maybe the channel initiator is happy to receive payments (since its their funds which opened the channel, this is reasonable), but the channel initie-ee (?) isn't (which, again, is reasonable). This leaves only the push_msat value pay-able, and only once, but is a perfectly reasonable trust model and I believe some wallets use this today.
Matt
On 8/24/20 4:16 AM, Roei Erez wrote:
Quoted text (68 lines)
> Hello everyone, > > I would like to discuss the ability to skip a channel funding > transaction confirmation, making the channel fully operational before > its on-chain confirmation (aka a zero-conf channel). > Till confirmation, this channel requires trust between its two parties > and in the case of a remote initiator, it puts the received funds of > the local party at risk. > Nevertheless, there are cases where it makes sense to support this > behavior. For example, in cases both parties decide to trust each > other. Or, in cases where trust between the parties already exists > (buying a pre-loaded channel from a service like Bitrefill). > > The motivation is gained from the "Immediate on-boarding" use case: > * Bob is connected to a routing node and issues an invoice with a > routing hint that points to a fake channel between Bob and that node. > * When Alice pays Bob's invoice, the routing node intercepts the HTLC > and holds it. > * Then, the routing node does the following: > * Opens a channel to Bob where Bob has a choice of skipping funding > confirmation (channel is open and active). > * Pays Bob the original Alices' invoice (potentially, minus a service fee) > > From Bob perspective it is his choice on whether to agree for the > payment via this channel (and by that increase the trust) or disagree > and wait for confirmation. > Another practical way for Bob is to skip confirmation and "hold" the > payment by not providing the pre-image. > > Right now different implementations support zero-conf channels in > different ways. These implementations have defined their own way on > how to agree on a short_channel_id (fake one) before the transaction > is confirmed. > > The following suggests some changes to the funding flow to support that: > 1. accept_channel message - in case the fundee wants to skip > confirmation he sends minimum_depth=0 > 2. funding_signed message - no change. > 3. funding_locked message - if fundee has sent minimum_depth=0, then > both parties send funding_locked while the channel_id is derived using a > convention agreed on both. One proposal for such convention is to take it > from the temporary_channel_id provided in previous open_channel > message as follows: > * Use the first 8 bytes to initialize an unsigned integer, > call it shortID > * Apply this transformation: shortID / 2^6 + 100,000 > * The above transformation ensures the block height falls in the > range of 100,000 - 2^18+100,000. The rationale is that the id will > never point to a valid mined transaction and the first 100,000 blocks > are left for testing in other chains. > * Assuming the temporary_channel_id is some random number, it is > not likely that the derived short_channel_id will conflict with other > channels in both peers but both peers should validate that before > sending funding_locked. > 4. When the channel is confirmed gossip messages such as > channel_update are re-broadcasted and refers to the confirmed > channel_id (such as the case with re-org). > > I created a PR in LND that implements these changes > https://github.com/lightningnetwork/lnd/pull/4424 > > Cheers, > Roei > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev >
Hi Roei,
You might have a mechanism to lower trust in zero-conf channel opener. Actually the local party can be in charge of broadcasting the funding transaction, thus ensuring it's well-propagated across network mempools and then start to accept incoming payment on the zero-conf channel. Per BIP 125 rules, a malicious funder/opener would have to pay a higher fee to replace the channel funding tx and thus double-spend the HTLC. A local party may require a higher fee funding transaction than it is necessary wrt ongoing congestion to increase level of protection. And I think it's okay on the economic-side, you will amortize this fee premium on the channel lifecycle. Until the transaction gets confirmed you might only accept HTLC under this fee. So you have game-theory security for your zero-conf channels as it would cost more in fees than a HTLC double-spend win for the malicious opener, under the assumption of non-miner-collusion with the attacker.
Actually this higher fee could be attached by a zero-conf channel insurance service through a CPFP on a special output, and spread across a batch of funding transaction, thus replacement cost would be far higher for attacker but give the same value protection to any user involved in the batch. That said, it might be a bit slower and more expensive than a UX-fast zero-conf channel, as it's likely offered by wallet today, so maybe not a user demand for zero-conf channel improved safety.
With regards to the current proposal in itself, skimming quickly on BOLT 2 we don't explicitly require minimum_depth > 0 ? So only the new requirement zero-conf chan is about the channel identifier in the lack of an anchoring block ? If the channel is private, it doesn't matter id to be random, that's just a convention between channel peers. A local alias short_channel_id can be sent to any potential payer.
Overall, I lean to think this kind of proposal might belong to a higher layer spec, as it's more a matter of policy between nodes than a global network mechanism. Such higher spec could gather specifications on other point-to-point Lightning programmable interfaces, like onion content, assuming we keep track of collision types. It would fasten ecosystem features while letting BOLT specifications focus on the core layer requirements. Though it might be too early for such a thing.
Cheers, Antoine
Le lun. 24 août 2020 à 20:22, Matt Corallo <lf-lists at mattcorallo.com> a écrit :
Quoted text (106 lines)
> A few notes. > > Given gossip messages will be rejected by many nodes if no such on-chain > transaction exists, I don't think you can > "re-broadcast" gossip messages at that time, instead I believe you simply > need to not gossip until the funding > transaction has some confirmations. Still, this shouldn't prevent > receiving payments, as invoices carrying a last-hop > hint should be able to indicate any short_channel_id value and have it be > accepted. > > It may make sense to reuse some "private short channel ID negotiation" > feature for the temporary 0-conf short channel id > value. > > One thing this protocol doesn't capture is unidirectional 0-conf - maybe > the channel initiator is happy to receive > payments (since its their funds which opened the channel, this is > reasonable), but the channel initie-ee (?) isn't > (which, again, is reasonable). This leaves only the push_msat value > pay-able, and only once, but is a perfectly > reasonable trust model and I believe some wallets use this today. > > Matt > > On 8/24/20 4:16 AM, Roei Erez wrote: > > Hello everyone, > > > > I would like to discuss the ability to skip a channel funding > > transaction confirmation, making the channel fully operational before > > its on-chain confirmation (aka a zero-conf channel). > > Till confirmation, this channel requires trust between its two parties > > and in the case of a remote initiator, it puts the received funds of > > the local party at risk. > > Nevertheless, there are cases where it makes sense to support this > > behavior. For example, in cases both parties decide to trust each > > other. Or, in cases where trust between the parties already exists > > (buying a pre-loaded channel from a service like Bitrefill). > > > > The motivation is gained from the "Immediate on-boarding" use case: > > * Bob is connected to a routing node and issues an invoice with a > > routing hint that points to a fake channel between Bob and that node. > > * When Alice pays Bob's invoice, the routing node intercepts the HTLC > > and holds it. > > * Then, the routing node does the following: > > * Opens a channel to Bob where Bob has a choice of skipping funding > > confirmation (channel is open and active). > > * Pays Bob the original Alices' invoice (potentially, minus a service > fee) > > > > From Bob perspective it is his choice on whether to agree for the > > payment via this channel (and by that increase the trust) or disagree > > and wait for confirmation. > > Another practical way for Bob is to skip confirmation and "hold" the > > payment by not providing the pre-image. > > > > Right now different implementations support zero-conf channels in > > different ways. These implementations have defined their own way on > > how to agree on a short_channel_id (fake one) before the transaction > > is confirmed. > > > > The following suggests some changes to the funding flow to support that: > > 1. accept_channel message - in case the fundee wants to skip > > confirmation he sends minimum_depth=0 > > 2. funding_signed message - no change. > > 3. funding_locked message - if fundee has sent minimum_depth=0, then > > both parties send funding_locked while the channel_id is derived > using a > > convention agreed on both. One proposal for such convention is to > take it > > from the temporary_channel_id provided in previous open_channel > > message as follows: > > * Use the first 8 bytes to initialize an unsigned integer, > > call it shortID > > * Apply this transformation: shortID / 2^6 + 100,000 > > * The above transformation ensures the block height falls in the > > range of 100,000 - 2^18+100,000. The rationale is that the > id will > > never point to a valid mined transaction and the first > 100,000 blocks > > are left for testing in other chains. > > * Assuming the temporary_channel_id is some random number, it is > > not likely that the derived short_channel_id will conflict > with other > > channels in both peers but both peers should validate that > before > > sending funding_locked. > > 4. When the channel is confirmed gossip messages such as > > channel_update are re-broadcasted and refers to the confirmed > > channel_id (such as the case with re-org). > > > > I created a PR in LND that implements these changes > > https://github.com/lightningnetwork/lnd/pull/4424 > > > > Cheers, > > Roei > > _______________________________________________ > > Lightning-dev mailing list > > Lightning-dev at lists.linuxfoundation.org > > https://www.learnbitcoin.com/archive/lists/lightning-dev > > > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev >
Good morning Antoine,
Quoted text (2 lines)
> Hi Roei, > You might have a mechanism to lower trust in zero-conf channel opener. Actually the local party can be in charge of broadcasting the funding transaction, thus ensuring it's well-propagated across network mempools and then start to accept incoming payment on the zero-conf channel. Per BIP 125 rules, a malicious funder/opener would have to pay a higher fee to replace the channel funding tx and thus double-spend the HTLC. A local party may require a higher fee funding transaction than it is necessary wrt ongoing congestion to increase level of protection. And I think it's okay on the economic-side, you will amortize this fee premium on the channel lifecycle. Until the transaction gets confirmed you might only accept HTLC under this fee. So you have game-theory security for your zero-conf channels as it would cost more in fees than a HTLC double-spend win for the malicious opener, under the assumption of non-miner-collusion with the attacker.
Since RBF is opt-in for Bitcoin Core nodes, and I believe most miners are running Bitcoin Core, it is trivial to double-broadcast. i.e. I send my high-fee RBF-enabled channel funding to you, at the same time I send a conflicting low-fee RBF-disabled transaction (that pays the entire channel amount to myself) to all the miners I can find.
Since the miners received an RBF-disabled tx, they will not evict it even if they see a higher-fee RBF-enabled tx. And your fullnode will not see the conflicting low-fee RBF-disabled tx either because it is lower fee than what you have in your mempool and you will reject it.
You really have to trust that I do not do this when I offer a channel to you.
There Ain't No Such Thing As A Global Mempool!
Regards, ZmnSCPxj
Hi Matt and thanks for your notes.
On Mon, 24 Aug 2020 at 22:22, Matt Corallo <lf-lists at mattcorallo.com> wrote:
Quoted text (7 lines)
> > A few notes. > > Given gossip messages will be rejected by many nodes if no such on-chain transaction exists, I don't think you can > "re-broadcast" gossip messages at that time, instead I believe you simply need to not gossip until the funding > transaction has some confirmations. Still, this shouldn't prevent receiving payments, as invoices carrying a last-hop > hint should be able to indicate any short_channel_id value and have it be accepted.
You are right. They really should be broadcasted once after the funding transaction is sufficiently deep. I confused that with the exchange of channel_update privately between them before the channel is confirmed so they both will be able to relay payments using this channel.
Quoted text (8 lines)
> > It may make sense to reuse some "private short channel ID negotiation" feature for the temporary 0-conf short channel id > value. > > One thing this protocol doesn't capture is unidirectional 0-conf - maybe the channel initiator is happy to receive > payments (since its their funds which opened the channel, this is reasonable), but the channel initie-ee (?) isn't > (which, again, is reasonable). This leaves only the push_msat value pay-able, and only once, but is a perfectly > reasonable trust model and I believe some wallets use this today.
Although this proposal addresses the bi-directional zero-conf channel
both parties are able to "hold" any payment.
When the payee decides not to release the preimage based on some
policy (total funds at risk, wait for confirmation)
the channel becomes unidirectional.
Implementing a unidirectional channel this way also has some advantages such as:
1. It gives you the ability to increase trust on an existing zero-conf
channel. Sometimes this is preferable because
it saves the need to open additional channels and it shortens the
trust period (waiting for confirmation for a
previously opened channel).
2. The funds sent to the channel acceptor can be a result of a
lightning payment, including proof of payment for the
payer.
Roei
Quoted text (72 lines)
> > Matt > > On 8/24/20 4:16 AM, Roei Erez wrote: > > Hello everyone, > > > > I would like to discuss the ability to skip a channel funding > > transaction confirmation, making the channel fully operational before > > its on-chain confirmation (aka a zero-conf channel). > > Till confirmation, this channel requires trust between its two parties > > and in the case of a remote initiator, it puts the received funds of > > the local party at risk. > > Nevertheless, there are cases where it makes sense to support this > > behavior. For example, in cases both parties decide to trust each > > other. Or, in cases where trust between the parties already exists > > (buying a pre-loaded channel from a service like Bitrefill). > > > > The motivation is gained from the "Immediate on-boarding" use case: > > * Bob is connected to a routing node and issues an invoice with a > > routing hint that points to a fake channel between Bob and that node. > > * When Alice pays Bob's invoice, the routing node intercepts the HTLC > > and holds it. > > * Then, the routing node does the following: > > * Opens a channel to Bob where Bob has a choice of skipping funding > > confirmation (channel is open and active). > > * Pays Bob the original Alices' invoice (potentially, minus a service fee) > > > > From Bob perspective it is his choice on whether to agree for the > > payment via this channel (and by that increase the trust) or disagree > > and wait for confirmation. > > Another practical way for Bob is to skip confirmation and "hold" the > > payment by not providing the pre-image. > > > > Right now different implementations support zero-conf channels in > > different ways. These implementations have defined their own way on > > how to agree on a short_channel_id (fake one) before the transaction > > is confirmed. > > > > The following suggests some changes to the funding flow to support that: > > 1. accept_channel message - in case the fundee wants to skip > > confirmation he sends minimum_depth=0 > > 2. funding_signed message - no change. > > 3. funding_locked message - if fundee has sent minimum_depth=0, then > > both parties send funding_locked while the channel_id is derived using a > > convention agreed on both. One proposal for such convention is to take it > > from the temporary_channel_id provided in previous open_channel > > message as follows: > > * Use the first 8 bytes to initialize an unsigned integer, > > call it shortID > > * Apply this transformation: shortID / 2^6 + 100,000 > > * The above transformation ensures the block height falls in the > > range of 100,000 - 2^18+100,000. The rationale is that the id will > > never point to a valid mined transaction and the first 100,000 blocks > > are left for testing in other chains. > > * Assuming the temporary_channel_id is some random number, it is > > not likely that the derived short_channel_id will conflict with other > > channels in both peers but both peers should validate that before > > sending funding_locked. > > 4. When the channel is confirmed gossip messages such as > > channel_update are re-broadcasted and refers to the confirmed > > channel_id (such as the case with re-org). > > > > I created a PR in LND that implements these changes > > https://github.com/lightningnetwork/lnd/pull/4424 > > > > Cheers, > > Roei > > _______________________________________________ > > Lightning-dev mailing list > > Lightning-dev at lists.linuxfoundation.org > > https://www.learnbitcoin.com/archive/lists/lightning-dev > >
Hi Zeeman,
Quoted text (3 lines)
> i.e. I send my high-fee RBF-enabled channel funding to you, at the same time I send a conflicting low-fee RBF-disabled transaction (that pays the entire channel amount to myself) to all the miners I can find.
Mapping miners mempools will be a cost in spying infrastructure and thus make the malicious routing node job harder, providing a security improvement for zero-conf channels. I used "lower trust" intentionally, it's not binary (what about opening a channel with a reorg-powerful counterparty ?).
Quoted text (3 lines)
> And your fullnode will not see the conflicting low-fee RBF-disabled tx either because it is lower fee than what you have in your mempool and you will reject it.
I was assuming a no-mempool mobile LN client, thus not going to be blind by your high-fee RBF. But still able to speak with the p2p network thus you can actively seek that your transaction has been accepted by ~100 peers.
Overall, I don't think this scheme is worthy to work on unless double-spend of zero-conf chans become a real issue, just to mention we have potential solutions in this case.
Quoted text (1 line)
> There Ain't No Such Thing As A Global Mempool!
I know :)
Le mar. 25 août 2020 à 03:38, ZmnSCPxj <ZmnSCPxj at protonmail.com> a écrit :
Quoted text (37 lines)
> Good morning Antoine, > > > Hi Roei, > > You might have a mechanism to lower trust in zero-conf channel opener. > Actually the local party can be in charge of broadcasting the funding > transaction, thus ensuring it's well-propagated across network mempools and > then start to accept incoming payment on the zero-conf channel. Per BIP 125 > rules, a malicious funder/opener would have to pay a higher fee to replace > the channel funding tx and thus double-spend the HTLC. A local party may > require a higher fee funding transaction than it is necessary wrt ongoing > congestion to increase level of protection. And I think it's okay on the > economic-side, you will amortize this fee premium on the channel lifecycle. > Until the transaction gets confirmed you might only accept HTLC under this > fee. So you have game-theory security for your zero-conf channels as it > would cost more in fees than a HTLC double-spend win for the malicious > opener, under the assumption of non-miner-collusion with the attacker. > > Since RBF is opt-in for Bitcoin Core nodes, and I believe most miners are > running Bitcoin Core, it is trivial to double-broadcast. > i.e. I send my high-fee RBF-enabled channel funding to you, at the same > time I send a conflicting low-fee RBF-disabled transaction (that pays the > entire channel amount to myself) to all the miners I can find. > > Since the miners received an RBF-disabled tx, they will not evict it even > if they see a higher-fee RBF-enabled tx. > And your fullnode will not see the conflicting low-fee RBF-disabled tx > either because it is lower fee than what you have in your mempool and you > will reject it. > > You really have to trust that I do not do this when I offer a channel to > you. > > There Ain't No Such Thing As A Global Mempool! > > Regards, > ZmnSCPxj >
Good morning Antoine,
Quoted text (4 lines)
> Hi Zeeman, > > > i.e. I send my high-fee RBF-enabled channel funding to you, at the same time I send a conflicting low-fee RBF-disabled transaction (that pays the entire channel amount to myself) to all the miners I can find. > Mapping miners mempools will be a cost in spying infrastructure and thus make the malicious routing node job harder, providing a security improvement for zero-conf channels. I used "lower trust" intentionally, it's not binary (what about opening a channel with a reorg-powerful counterparty ?).
A reorg-powerful entity would destroy all assumptions depended upon by higher layers, I think, and would be an extinction event on all higher layers. In particular, any timelock-based higher layer is at risk for anyone powerful enough to reorg, as they could potentially delay non-timelocked transactions to after the timelock expires.
Mapping miner nodes is indeed a cost, but not a high one IMO --- presumably miners are the ones who get blocks earlier than everyone else, and would be incentivized to e.g. unsolicited `block` push, though I am uncertain if that has ever been implemented.
Quoted text (3 lines)
> > And your fullnode will not see the conflicting low-fee RBF-disabled tx either because it is lower fee than what you have in your mempool and you will reject it. > > I was assuming a no-mempool mobile LN client, thus not going to be blind by your high-fee RBF. But still able to speak with the p2p network thus you can actively seek that your transaction has been accepted by ~100 peers.
That seems to be a fairly high amount of bandwidth in `inv` messages? You also need to select the peers in a way that attackers find hard to predict, else sybil is possible. Hmmm.
Quoted text (1 line)
> Overall, I don't think this scheme is worthy to work on unless double-spend of zero-conf chans become a real issue, just to mention we have potential solutions in this case.
0-conf is simply not safe, and I do not think this increases the costs on breaking the mechanism enough.
With all that said, once deeply confirmed, the channel becomes perfectly safe. And in general, most 0-conf channel mechanisms are usually set up such that the one offering the 0-conf channel is a fiat-to-Bitcoin exchange, with a `push_msat` non-gift that is actually the equivalent amount of a number of fiat units. As it involves fiat, tr\*st is necessary anyway, so it is a negligible degradation of security in practice. And once the channel *does* get confirmed deeply, it is upgraded automatically to trust-reduced.
Regards, ZmnSCPxj