Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Scriptless Scripts with ECDSA

14 messages, Apr 26 to May 24, 2018. Started by Pedro Moreno Sanchez.

Olaoluwa Osuntokun (4), Benjamin Mord (4), Pedro Moreno Sanchez (2), ZmnSCPxj (2), Greg Sanders, Jim Posen

Permalink First message in the Wayback Machine

Pedro Moreno Sanchez permalink original

Hello guys,

as some of you already know, I am working on some cryptographic constructions that might be of interest and useful for the Lightning Network.

Recently, I have come up with a scriptless version of the adaptor signatures and the contract required in the Lighting Network using only 2-party ECDSA signatures. The main advantage is that, instead of waiting for Schnorr signatures to be deployed in Bitcoin so that Poelstra's scriptless scripts can be used, I believe that this ECDSA-version of the scriptless scripts can be directly applied today.

Details are in the attached PDF. I am looking forward to hearing your comments and suggestions.

Cheers, Pedro.

ZmnSCPxj in reply to Pedro Moreno Sanchez permalink original

Good morning Pedro,

This is certainly of great interest to me; unfortunately I am not a mathematician and probably cannot review if the math is correct or not. In particular it seems to me, naively, to be able to implement my AMP idea which supports both path decorrelation and proof-of-payment, which is based on SS and HD.

The Lightning BOLT 1.0 spec is mostly frozen and we have good inter-implementation working of HTLCs. Supporting SS, whether on top of ECDSA or Bellare-Neven, will be a large effort, and it is not clear to me if it is easy to switch between ECDSA and Bellare-Neven dynamically (i.e. if one hop supports ECDSA SS and the next hop supports Bellare-Neven SS).

It is also not clear to me how well B-N signature aggregation can work for Lightning use-cases; certainly onchain claims of unilateral closes can be made smaller with signature aggregation, but for mutual closes, there is only one input, unless we support close aggregation somehow (involving more than two parties, so much more effort). A 2-of-2 with a single signature (which I believe is the basis of your SS work?) would let the mutual close and commitment transactions be smaller by one signature and one pubkey, though.

At the Lightning BOLT spec level:

1.  We need a new global feature bit, `option_support_scriptless`, which would support routing of scriptless-script conditional payments.  Paying via SS can only be done if the entire route supports this option, which may hamper adoption and complicate routing implementations (cannot route an SS payment through nodes that do not  support SS).
2.  Depending on how easy it would be to translate between ECDSA and Bellare-Neven SS, maybe only a local-level feature bit for `option_support_scriptless_ecdsa` and `option_support_scriptless_bn`?
3.  Also affects BOLT11 as we would have to support both `SHA256(secret)` and `secret * G` in invoices, with the latter being used for SS payments.
4.  We may want intra-path decorrelation (indeed, aside from AMP, this is the other use of SS on Lightning).  This requires passing a blinding secret to each layer of the onion in the onion routes, I think (?).

Regards, ZmnSCPxj

Olaoluwa Osuntokun in reply to Pedro Moreno Sanchez permalink original

Hi Pedro,

Very cool stuff! When I originally discovered the Lindell's technique, my immediate thought was the we could phase this in as a way to _immediately_ (no additional Script upgrades required), replace the regular 2-of-2 mulit-sig with a single p2wkh. The immediate advantages of this would: be lower fees for opening/closing channels (as the public key script, and witness are smaller), openings and cooperative close transactions would blend in with the anonymity set of regular p2wkh transactions, and finally the htlc timeout+success transactions can be made smaller as we can remove the multi-sig. The second benefit is nerfed a bit if the channel are advertised, but non-advertised channels would be able to take advantage of this "stealth" feature.

The upside of the original application I hand in mind is that it wouldn't require any end-to-end changes, as it would only be a link level change (diff output for the funding transaction). If we wanted to allow these styles of channels to be used outside of non-advertised channels, then we would need to update the way channels are verified in the gossip layer.

Applying this to the realm of allowing us to use randomized payment identifiers across the route is obviously much, much doper. So then the question would be what the process of integrating the scheme into the existing protocol would look like. The primary thing we'd need to account for is the additional cryptographic overhead this scheme would add if integrated. Re-reviewing the paper, there's an initial setup and verification phase (which was omitted from y'alls note for brevity) where both parties need to complete before the actually signing process can take place. Ideally, we can piggy-back this setup on top of the existing accept_channel/open_channel dance both sides need to go through in order to advance the channel negotiation process today.

Conner actually started to implement this when we first discovered the scheme, so we have a pretty good feel w.r.t the implementation of the initial set of proofs. The three proofs required for the set up phase are:

  1. A proof that that the Paillier public key is well formed. In the paper
  they only execute this step for the party that wishes to _obtain_ the
  signature. In our case, since we'll need to sign for HTLCs in both
  directions, but parties will need to execute this step.
  2. A dlog proof for the signing keys themselves. We already do this more
or
  less, as if the remote party isn't able to sign with their target key,
then
  we won't be able to update the channel, or even create a valid commitment
in
  the first place.
  3. A proof that value encrypted (the Paillier ciphertext) is actually the
  dlog of the public key to be used for signing. (as an aside this is the
part
  of the protocol that made me do a double take when first reading it:
using one
  cryptosystem to encrypt the private key of another cryptosystem in order
to
  construct a 2pc to allow signing in the latter cryptosystem! soo clever!)

First, we'll examine the initial proof. This only needs to be done once by both parties AFAICT. As a result, we may be able to piggyback this onto the initial channel funding steps. Reviewing the paper cited on the Lindell paper [1], it appears this would take 1 RTT, so this shouldn't result in any additional round trips during the funding process. We should be able to use a Paillier modulos of 2048 bits, so nothing too crazy. This would just result in a slightly bigger opening message.

Skipping the second proofs as it's pretty standard.

The third proof as described (Section 6 of the Lindell paper) is interactive. It also contains a ZK range proof as a sub-protocol which as described in Appendix A is also interactive. However, it was pointed out to us by Omer Shlomovits on the lnd slack, that we can actually replace their custom range proofs with Bulletproofs. This would make this section non-interactive, allowing the proof itself to take 1.5 RTT AFAICT. Additionally, this would only need to be done once at the start, as AFIACT, we can re-use the encryption of the secp256k1 private key of both parties.

The current channel opening process requires 2 RTT, so it seems that we'd be able to easily piggy back all the opening proofs on top of the existing funding protocol. The main cost would be the increased size of these opening messages, and also the additional computational cost of operations within the Paillier modulus and the new range proof.

The additional components that would need to be modified are the process of
adding+settling an HTLC, and also the onion payload that drops off the point
whose dlog is r_1*alpha. Within the current protocol, adding and settling an
HTLC are more or less non-interactive, we have a single message for each,
which
is then staged to be committed in new commitments for both parties. With
this
new scheme (if I follow it correctly), adding an HTLC now requires N RTT:
  1. Alice sends A = G*alpha to Bob. Here alpha is the payment secret.
  2. Bob sends R_3 = (G*alpha)*r_2 (along w/ a proof of knowledge of r_2 and
  relation to A)
  3. Alice sends R_3' = (G*alpha)*r_3 (along with a similar proof as above)
4.
  Bob then computes c3 (the encrypted partial sig which when completed will
  reveal a) to Alice.
  5. Alice decrypts c3 to get the plaintext partial sig (s'), then finalizes
  the set up by sending s'' to Bob.

This process takes 2.5 RTT, and would require re-working the state machine slightly to only actually commit an HTLC after step 5 has been completed. When Bob obtains a from the next party in the path, we Alice can then then over the signature, from which Alice can extract alpha. So adding HTLCs is now a bit more interactive, but settling them is the same a before.

Finally, the onion payload would need to be re-interpreted in order to encode G*alpha which takes 33 bytes. We can shave this down to 32 by selecting the x coordinate (at the sender) to always be either even or odd. Currently, we have 12 unused bytes in the onion payload. The HMAC is currently 32 bytes. One path would be to allocate a portion of HMAC space to encoding this point. A 16-byte HMAC would probably have been enough in the beginning, so we can drop down to that. However, that still leaves 4 bytes somewhere that has to give...one could either obtain these extra bytes from the CLTV and Amount fields, or just have each hop consume an extra payload. The latter path would mean that the new upper hop limit is actually 10.

However, given that we would need need a new global feature bit in order to roll this out, it may make sense to re-work the onion format all together which would mean that we wouldn't need to hack the old format a bit to accommodate this additional data. One aspect of introducing a new end-to-end contract type which I hadn't considered before is that each new type effectively partitions the network. This is due to the fact that these HTLCs will now only be able to be carried along paths that understand this new feature. As a result, plausible path diversity takes as we can no longer utilize all channels on the network for routing. This would suggest that introducing new end to end contract types (if one wishes to use them widely across arbitrary channels and not for specific contract protocols) may be a strong point of synchronization w.r.t updates across the network. As a result, we may need to be a bit more discerning w.r.t new candidates for e2e contracts given the coordination costs.

So the takeaways are:
  * we can probably piggy back the extra proofs onto the channel opening
    process
      * one of the subproofs can use bulletproofs to make the proof shorter
and
        also non-interactive
  * adding an HTLC would take 2.5 RTT's, but settling is just as quick as
    before
  * the onion payload would either need to be hacked, or extended to support
    packaging the point.
  * the utility of the scheme won't shine until all/most of the network
uses it
  * we could start w/ just the introduction of the OG 2PC scheme as a
multi-sig
    replacement

[1]: https://eprint.iacr.org/2011/494.pdf (section 3.3)

-- Laolu

On Fri, Apr 27, 2018 at 11:42 AM Pedro Moreno Sanchez <pmorenos at purdue.edu> wrote:

Quoted text (24 lines)
> Hello guys,
>
> as some of you already know, I am working on some cryptographic
> constructions that might be of interest and useful for the Lightning
> Network.
>
> Recently, I have come up with a scriptless version of the adaptor
> signatures and the contract required in the Lighting Network using only
> 2-party ECDSA signatures. The main advantage is that, instead of waiting
> for Schnorr signatures to be deployed in Bitcoin so that Poelstra's
> scriptless scripts can be used, I believe that this ECDSA-version of the
> scriptless scripts can be directly applied today.
>
> Details are in the attached PDF. I am looking forward to hearing your
> comments and suggestions.
>
> Cheers,
> Pedro.
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
Olaoluwa Osuntokun in reply to ZmnSCPxj permalink original
Quoted text (5 lines)
> It is also not clear to me how well B-N signature aggregation can work for
> Lightning use-cases; certainly onchain claims of unilateral closes can be
> made smaller with signature aggregation, but for mutual closes, there is
> only one input, unless we support close aggregation somehow

>From the PoV, the two-stage HTLCs, depending on how cross-input sigagg was

implemented, this would allow us (using sighash_single+anyone_can_pay) to coalesce all the second-layer HTLCs for a particularly state+party into a single transaction with a single signature spending all HTLCs to the second layer/stage.

-- Laolu

On Sun, Apr 29, 2018 at 9:23 PM ZmnSCPxj via Lightning-dev < lightning-dev at lists.linuxfoundation.org> wrote:

Quoted text (50 lines)
> Good morning Pedro,
>
> This is certainly of great interest to me; unfortunately I am not a
> mathematician and probably cannot review if the math is correct or not.  In
> particular it seems to me, naively, to be able to implement my AMP idea
> which supports both path decorrelation and proof-of-payment, which is based
> on SS and HD.
>
> The Lightning BOLT 1.0 spec is mostly frozen and we have good
> inter-implementation working of HTLCs.  Supporting SS, whether on top of
> ECDSA or Bellare-Neven, will be a large effort, and it is not clear to me
> if it is easy to switch between ECDSA and Bellare-Neven dynamically (i.e.
> if one hop supports ECDSA SS and the next hop supports Bellare-Neven SS).
>
> It is also not clear to me how well B-N signature aggregation can work for
> Lightning use-cases; certainly onchain claims of unilateral closes can be
> made smaller with signature aggregation, but for mutual closes, there is
> only one input, unless we support close aggregation somehow (involving more
> than two parties, so much more effort).  A 2-of-2 with a single signature
> (which I believe is the basis of your SS work?) would let the mutual close
> and commitment transactions be smaller by one signature and one pubkey,
> though.
>
> At the Lightning BOLT spec level:
>
> 1.  We need a new global feature bit, `option_support_scriptless`, which
> would support routing of scriptless-script conditional payments.  Paying
> via SS can only be done if the entire route supports this option, which may
> hamper adoption and complicate routing implementations (cannot route an SS
> payment through nodes that do not  support SS).
>
> 2.  Depending on how easy it would be to translate between ECDSA and
> Bellare-Neven SS, maybe only a local-level feature bit for
> `option_support_scriptless_ecdsa` and `option_support_scriptless_bn`?
>
> 3.  Also affects BOLT11 as we would have to support both `SHA256(secret)`
> and `secret * G` in invoices, with the latter being used for SS payments.
>
> 4.  We may want intra-path decorrelation (indeed, aside from AMP, this is
> the other use of SS on Lightning).  This requires passing a blinding secret
> to each layer of the onion in the onion routes, I think (?).
>
>
> Regards,
> ZmnSCPxj
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
Olaoluwa Osuntokun in reply to Olaoluwa Osuntokun permalink original

Actually, just thought about this a bit more and I think it's possible to deploy this in unison with (or after) any sort of SS based on schnorr becomes possible in Bitcoin. My observation is that since both techniques are based on the same underlying technique (revealing a secret value in a signature) and they center around leveraging the onion payload to drop off a payment point (G*a, or G*a_1*a_2*a_3, etc), then the disclosure within the _links_ can be heterogeneous, as the same secret is still revealed in an end-to-end matter.

As an illustration, consider: A <-> B <-> C. The A <-> B link could use the 2pc pailier technique, while the B <-> C link could use the OG SS technique based on schnorr. If i'm correct, then this would mean that we can deploy both techniques, without worrying about fragmenting the network due to the existence of two similar but incompatible e2e payment routing schemes!

-- Laolu

On Mon, May 7, 2018 at 4:57 PM Olaoluwa Osuntokun <laolu32 at gmail.com> wrote:

Quoted text (232 lines)
> Hi Pedro,
>
> Very cool stuff! When I originally discovered the Lindell's technique, my
> immediate thought was the we could phase this in as a way to _immediately_
> (no
> additional Script upgrades required), replace the regular 2-of-2 mulit-sig
> with
> a single p2wkh. The immediate advantages of this would: be lower fees for
> opening/closing channels (as the public key script, and witness are
> smaller),
> openings and cooperative close transactions would blend in with the
> anonymity
> set of regular p2wkh transactions, and finally the htlc timeout+success
> transactions can be made smaller as we can remove the multi-sig. The second
> benefit is nerfed a bit if the channel are advertised, but non-advertised
> channels would be able to take advantage of this "stealth" feature.
>
> The upside of the original application I hand in mind is that it wouldn't
> require any end-to-end changes, as it would only be a link level change
> (diff
> output for the funding transaction). If we wanted to allow these styles of
> channels to be used outside of non-advertised channels, then we would need
> to
> update the way channels are verified in the gossip layer.
>
> Applying this to the realm of allowing us to use randomized payment
> identifiers
> across the route is obviously much, much doper. So then the question would
> be
> what the process of integrating the scheme into the existing protocol would
> look like. The primary thing we'd need to account for is the additional
> cryptographic overhead this scheme would add if integrated. Re-reviewing
> the
> paper, there's an initial setup and verification phase (which was omitted
> from
> y'alls note for brevity) where both parties need to complete before the
> actually signing process can take place. Ideally, we can piggy-back this
> setup
> on top of the existing accept_channel/open_channel dance both sides need
> to go
> through in order to advance the channel negotiation process today.
>
> Conner actually started to implement this when we first discovered the
> scheme,
> so we have a pretty good feel w.r.t the implementation of the initial set
> of
> proofs. The three proofs required for the set up phase are:
>
>   1. A proof that that the Paillier public key is well formed. In the paper
>   they only execute this step for the party that wishes to _obtain_ the
>   signature. In our case, since we'll need to sign for HTLCs in both
>   directions, but parties will need to execute this step.
>
>   2. A dlog proof for the signing keys themselves. We already do this more
> or
>   less, as if the remote party isn't able to sign with their target key,
> then
>   we won't be able to update the channel, or even create a valid
> commitment in
>   the first place.
>
>   3. A proof that value encrypted (the Paillier ciphertext) is actually the
>   dlog of the public key to be used for signing. (as an aside this is the
> part
>   of the protocol that made me do a double take when first reading it:
> using one
>   cryptosystem to encrypt the private key of another cryptosystem in order
> to
>   construct a 2pc to allow signing in the latter cryptosystem! soo clever!)
>
> First, we'll examine the initial proof. This only needs to be done once by
> both
> parties AFAICT. As a result, we may be able to piggyback this onto the
> initial
> channel funding steps. Reviewing the paper cited on the Lindell paper [1],
> it
> appears this would take 1 RTT, so this shouldn't result in any additional
> round
> trips during the funding process. We should be able to use a Paillier
> modulos
> of 2048 bits, so nothing too crazy. This would just result in a slightly
> bigger
> opening message.
>
> Skipping the second proofs as it's pretty standard.
>
> The third proof as described (Section 6 of the Lindell paper) is
> interactive.
> It also contains a ZK range proof as a sub-protocol which as described in
> Appendix A is also interactive. However, it was pointed out to us by Omer
> Shlomovits on the lnd slack, that we can actually replace their custom
> range
> proofs with Bulletproofs. This would make this section non-interactive,
> allowing the proof itself to take 1.5 RTT AFAICT. Additionally, this would
> only
> need to be done once at the start, as AFIACT, we can re-use the encryption
> of
> the secp256k1 private key of both parties.
>
> The current channel opening process requires 2 RTT, so it seems that we'd
> be
> able to easily piggy back all the opening proofs on top of the existing
> funding
> protocol. The main cost would be the increased size of these opening
> messages,
> and also the additional computational cost of operations within the
> Paillier
> modulus and the new range proof.
>
> The additional components that would need to be modified are the process of
> adding+settling an HTLC, and also the onion payload that drops off the
> point
> whose dlog is r_1*alpha. Within the current protocol, adding and settling
> an
> HTLC are more or less non-interactive, we have a single message for each,
> which
> is then staged to be committed in new commitments for both parties. With
> this
> new scheme (if I follow it correctly), adding an HTLC now requires N RTT:
>   1. Alice sends A = G*alpha to Bob. Here alpha is the payment secret.
>   2. Bob sends R_3 = (G*alpha)*r_2 (along w/ a proof of knowledge of r_2
> and
>   relation to A)
>   3. Alice sends R_3' = (G*alpha)*r_3 (along with a similar proof as
> above) 4.
>   Bob then computes c3 (the encrypted partial sig which when completed will
>   reveal a) to Alice.
>   5. Alice decrypts c3 to get the plaintext partial sig (s'), then
> finalizes
>   the set up by sending s'' to Bob.
>
> This process takes 2.5 RTT, and would require re-working the state machine
> slightly to only actually commit an HTLC after step 5 has been completed.
> When
> Bob obtains a from the next party in the path, we Alice can then then over
> the
> signature, from which Alice can extract alpha. So adding HTLCs is now a bit
> more interactive, but settling them is the same a before.
>
> Finally, the onion payload would need to be re-interpreted in order to
> encode
> G*alpha which takes 33 bytes. We can shave this down to 32 by selecting
> the x
> coordinate (at the sender) to always be either even or odd. Currently, we
> have
> 12 unused bytes in the onion payload. The HMAC is currently 32 bytes. One
> path
> would be to allocate a portion of HMAC space to encoding this point. A
> 16-byte
> HMAC would probably have been enough in the beginning, so we can drop down
> to
> that. However, that still leaves 4 bytes somewhere that has to give...one
> could
> either obtain these extra bytes from the CLTV and Amount fields, or just
> have
> each hop consume an extra payload. The latter path would mean that the new
> upper hop limit is actually 10.
>
> However, given that we would need need a new global feature bit in order to
> roll this out, it may make sense to re-work the onion format all together
> which
> would mean that we wouldn't need to hack the old format a bit to
> accommodate
> this additional data. One aspect of introducing a new end-to-end contract
> type
> which I hadn't considered before is that each new type effectively
> partitions
> the network. This is due to the fact that these HTLCs will now only be
> able to
> be carried along paths that understand this new feature. As a result,
> plausible
> path diversity takes as we can no longer utilize all channels on the
> network
> for routing. This would suggest that introducing new end to end contract
> types
> (if one wishes to use them widely across arbitrary channels and not for
> specific contract protocols) may be a strong point of synchronization w.r.t
> updates across the network. As a result, we may need to be a bit more
> discerning w.r.t new candidates for e2e contracts given the coordination
> costs.
>
> So the takeaways are:
>   * we can probably piggy back the extra proofs onto the channel opening
>     process
>       * one of the subproofs can use bulletproofs to make the proof
> shorter and
>         also non-interactive
>   * adding an HTLC would take 2.5 RTT's, but settling is just as quick as
>     before
>   * the onion payload would either need to be hacked, or extended to
> support
>     packaging the point.
>   * the utility of the scheme won't shine until all/most of the network
> uses it
>   * we could start w/ just the introduction of the OG 2PC scheme as a
> multi-sig
>     replacement
>
>
> [1]: https://eprint.iacr.org/2011/494.pdf (section 3.3)
>
> -- Laolu
>
>
> On Fri, Apr 27, 2018 at 11:42 AM Pedro Moreno Sanchez <pmorenos at purdue.edu>
> wrote:
>
>> Hello guys,
>>
>> as some of you already know, I am working on some cryptographic
>> constructions that might be of interest and useful for the Lightning
>> Network.
>>
>> Recently, I have come up with a scriptless version of the adaptor
>> signatures and the contract required in the Lighting Network using only
>> 2-party ECDSA signatures. The main advantage is that, instead of waiting
>> for Schnorr signatures to be deployed in Bitcoin so that Poelstra's
>> scriptless scripts can be used, I believe that this ECDSA-version of the
>> scriptless scripts can be directly applied today.
>>
>> Details are in the attached PDF. I am looking forward to hearing your
>> comments and suggestions.
>>
>> Cheers,
>> Pedro.
>>
>> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>
Olaoluwa Osuntokun in reply to Olaoluwa Osuntokun permalink original

FWIW, Conner pointed out that the initial ZK Proof for the correctness of the Paillier params (even w/ usage of bulletproofs) has multiple rounds of interaction, iirc up to 5+ (with additional pipelining) rounds of interaction.

-- Laolu

On Mon, May 7, 2018 at 5:14 PM Olaoluwa Osuntokun <laolu32 at gmail.com> wrote:

Quoted text (268 lines)
> Actually, just thought about this a bit more and I think it's possible to
> deploy this in unison with (or after) any sort of SS based on schnorr
> becomes
> possible in Bitcoin. My observation is that since both techniques are
> based on
> the same underlying technique (revealing a secret value in a signature) and
> they center around leveraging the onion payload to drop off a payment point
> (G*a, or G*a_1*a_2*a_3, etc), then the disclosure within the _links_ can be
> heterogeneous, as the same secret is still revealed in an end-to-end
> matter.
>
> As an illustration, consider: A <-> B <-> C. The A <-> B link could use
> the 2pc
> pailier technique, while the B <-> C link could use the OG SS technique
> based
> on schnorr. If i'm correct, then this would mean that we can deploy both
> techniques, without worrying about fragmenting the network due to the
> existence
> of two similar but incompatible e2e payment routing schemes!
>
> -- Laolu
>
>
> On Mon, May 7, 2018 at 4:57 PM Olaoluwa Osuntokun <laolu32 at gmail.com>
> wrote:
>
>> Hi Pedro,
>>
>> Very cool stuff! When I originally discovered the Lindell's technique, my
>> immediate thought was the we could phase this in as a way to
>> _immediately_ (no
>> additional Script upgrades required), replace the regular 2-of-2
>> mulit-sig with
>> a single p2wkh. The immediate advantages of this would: be lower fees for
>> opening/closing channels (as the public key script, and witness are
>> smaller),
>> openings and cooperative close transactions would blend in with the
>> anonymity
>> set of regular p2wkh transactions, and finally the htlc timeout+success
>> transactions can be made smaller as we can remove the multi-sig. The
>> second
>> benefit is nerfed a bit if the channel are advertised, but non-advertised
>> channels would be able to take advantage of this "stealth" feature.
>>
>> The upside of the original application I hand in mind is that it wouldn't
>> require any end-to-end changes, as it would only be a link level change
>> (diff
>> output for the funding transaction). If we wanted to allow these styles of
>> channels to be used outside of non-advertised channels, then we would
>> need to
>> update the way channels are verified in the gossip layer.
>>
>> Applying this to the realm of allowing us to use randomized payment
>> identifiers
>> across the route is obviously much, much doper. So then the question
>> would be
>> what the process of integrating the scheme into the existing protocol
>> would
>> look like. The primary thing we'd need to account for is the additional
>> cryptographic overhead this scheme would add if integrated. Re-reviewing
>> the
>> paper, there's an initial setup and verification phase (which was omitted
>> from
>> y'alls note for brevity) where both parties need to complete before the
>> actually signing process can take place. Ideally, we can piggy-back this
>> setup
>> on top of the existing accept_channel/open_channel dance both sides need
>> to go
>> through in order to advance the channel negotiation process today.
>>
>> Conner actually started to implement this when we first discovered the
>> scheme,
>> so we have a pretty good feel w.r.t the implementation of the initial set
>> of
>> proofs. The three proofs required for the set up phase are:
>>
>>   1. A proof that that the Paillier public key is well formed. In the
>> paper
>>   they only execute this step for the party that wishes to _obtain_ the
>>   signature. In our case, since we'll need to sign for HTLCs in both
>>   directions, but parties will need to execute this step.
>>
>>   2. A dlog proof for the signing keys themselves. We already do this
>> more or
>>   less, as if the remote party isn't able to sign with their target key,
>> then
>>   we won't be able to update the channel, or even create a valid
>> commitment in
>>   the first place.
>>
>>   3. A proof that value encrypted (the Paillier ciphertext) is actually
>> the
>>   dlog of the public key to be used for signing. (as an aside this is the
>> part
>>   of the protocol that made me do a double take when first reading it:
>> using one
>>   cryptosystem to encrypt the private key of another cryptosystem in
>> order to
>>   construct a 2pc to allow signing in the latter cryptosystem! soo
>> clever!)
>>
>> First, we'll examine the initial proof. This only needs to be done once
>> by both
>> parties AFAICT. As a result, we may be able to piggyback this onto the
>> initial
>> channel funding steps. Reviewing the paper cited on the Lindell paper
>> [1], it
>> appears this would take 1 RTT, so this shouldn't result in any additional
>> round
>> trips during the funding process. We should be able to use a Paillier
>> modulos
>> of 2048 bits, so nothing too crazy. This would just result in a slightly
>> bigger
>> opening message.
>>
>> Skipping the second proofs as it's pretty standard.
>>
>> The third proof as described (Section 6 of the Lindell paper) is
>> interactive.
>> It also contains a ZK range proof as a sub-protocol which as described in
>> Appendix A is also interactive. However, it was pointed out to us by Omer
>> Shlomovits on the lnd slack, that we can actually replace their custom
>> range
>> proofs with Bulletproofs. This would make this section non-interactive,
>> allowing the proof itself to take 1.5 RTT AFAICT. Additionally, this
>> would only
>> need to be done once at the start, as AFIACT, we can re-use the
>> encryption of
>> the secp256k1 private key of both parties.
>>
>> The current channel opening process requires 2 RTT, so it seems that we'd
>> be
>> able to easily piggy back all the opening proofs on top of the existing
>> funding
>> protocol. The main cost would be the increased size of these opening
>> messages,
>> and also the additional computational cost of operations within the
>> Paillier
>> modulus and the new range proof.
>>
>> The additional components that would need to be modified are the process
>> of
>> adding+settling an HTLC, and also the onion payload that drops off the
>> point
>> whose dlog is r_1*alpha. Within the current protocol, adding and settling
>> an
>> HTLC are more or less non-interactive, we have a single message for each,
>> which
>> is then staged to be committed in new commitments for both parties. With
>> this
>> new scheme (if I follow it correctly), adding an HTLC now requires N RTT:
>>   1. Alice sends A = G*alpha to Bob. Here alpha is the payment secret.
>>   2. Bob sends R_3 = (G*alpha)*r_2 (along w/ a proof of knowledge of r_2
>> and
>>   relation to A)
>>   3. Alice sends R_3' = (G*alpha)*r_3 (along with a similar proof as
>> above) 4.
>>   Bob then computes c3 (the encrypted partial sig which when completed
>> will
>>   reveal a) to Alice.
>>   5. Alice decrypts c3 to get the plaintext partial sig (s'), then
>> finalizes
>>   the set up by sending s'' to Bob.
>>
>> This process takes 2.5 RTT, and would require re-working the state machine
>> slightly to only actually commit an HTLC after step 5 has been
>> completed.  When
>> Bob obtains a from the next party in the path, we Alice can then then
>> over the
>> signature, from which Alice can extract alpha. So adding HTLCs is now a
>> bit
>> more interactive, but settling them is the same a before.
>>
>> Finally, the onion payload would need to be re-interpreted in order to
>> encode
>> G*alpha which takes 33 bytes. We can shave this down to 32 by selecting
>> the x
>> coordinate (at the sender) to always be either even or odd. Currently, we
>> have
>> 12 unused bytes in the onion payload. The HMAC is currently 32 bytes. One
>> path
>> would be to allocate a portion of HMAC space to encoding this point. A
>> 16-byte
>> HMAC would probably have been enough in the beginning, so we can drop
>> down to
>> that. However, that still leaves 4 bytes somewhere that has to give...one
>> could
>> either obtain these extra bytes from the CLTV and Amount fields, or just
>> have
>> each hop consume an extra payload. The latter path would mean that the new
>> upper hop limit is actually 10.
>>
>> However, given that we would need need a new global feature bit in order
>> to
>> roll this out, it may make sense to re-work the onion format all together
>> which
>> would mean that we wouldn't need to hack the old format a bit to
>> accommodate
>> this additional data. One aspect of introducing a new end-to-end contract
>> type
>> which I hadn't considered before is that each new type effectively
>> partitions
>> the network. This is due to the fact that these HTLCs will now only be
>> able to
>> be carried along paths that understand this new feature. As a result,
>> plausible
>> path diversity takes as we can no longer utilize all channels on the
>> network
>> for routing. This would suggest that introducing new end to end contract
>> types
>> (if one wishes to use them widely across arbitrary channels and not for
>> specific contract protocols) may be a strong point of synchronization
>> w.r.t
>> updates across the network. As a result, we may need to be a bit more
>> discerning w.r.t new candidates for e2e contracts given the coordination
>> costs.
>>
>> So the takeaways are:
>>   * we can probably piggy back the extra proofs onto the channel opening
>>     process
>>       * one of the subproofs can use bulletproofs to make the proof
>> shorter and
>>         also non-interactive
>>   * adding an HTLC would take 2.5 RTT's, but settling is just as quick as
>>     before
>>   * the onion payload would either need to be hacked, or extended to
>> support
>>     packaging the point.
>>   * the utility of the scheme won't shine until all/most of the network
>> uses it
>>   * we could start w/ just the introduction of the OG 2PC scheme as a
>> multi-sig
>>     replacement
>>
>>
>> [1]: https://eprint.iacr.org/2011/494.pdf (section 3.3)
>>
>> -- Laolu
>>
>>
>> On Fri, Apr 27, 2018 at 11:42 AM Pedro Moreno Sanchez <
>> pmorenos at purdue.edu> wrote:
>>
>>> Hello guys,
>>>
>>> as some of you already know, I am working on some cryptographic
>>> constructions that might be of interest and useful for the Lightning
>>> Network.
>>>
>>> Recently, I have come up with a scriptless version of the adaptor
>>> signatures and the contract required in the Lighting Network using only
>>> 2-party ECDSA signatures. The main advantage is that, instead of waiting
>>> for Schnorr signatures to be deployed in Bitcoin so that Poelstra's
>>> scriptless scripts can be used, I believe that this ECDSA-version of the
>>> scriptless scripts can be directly applied today.
>>>
>>> Details are in the attached PDF. I am looking forward to hearing your
>>> comments and suggestions.
>>>
>>> Cheers,
>>> Pedro.
>>>
>>> _______________________________________________
>>> Lightning-dev mailing list
>>> Lightning-dev at lists.linuxfoundation.org
>>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>>
>>
Benjamin Mord in reply to Olaoluwa Osuntokun permalink original

If I'm not mistaken, the scriptless scripts concept (as currently formulated) falls to Schor's algorithm, and at present there is no alternative implementation of the concept to fall back on. Correct? Lest we build a house of cards, I'd strongly urge everyone to not depend on functional concepts whose underlying cryptographic primitives cannot be swapped in an emergency.

Sure, we use ecdsa for example (which is also vulnerable to Schor's algorithm), but in contrast to scriptless scripts we have a variety of backup primitives at our disposal that fulfill the same functional objective.

If scriptless scripts are found possible under lattice-based cryptography for example, that would be something I suppose. The functional concept of scriptless scripts is indeed very awesome - we just need to add some cryptographic conservatism before we build on it.

Greg Sanders in reply to Benjamin Mord permalink original
Quoted text (1 line)
>From what I understand talking to folks, the linear properties of these

signature tricks are maintained under a number of post-quantum schemes.

On Tue, May 8, 2018 at 8:44 AM, Benjamin Mord <ben at mord.family> wrote:

Quoted text (25 lines)
>
> If I'm not mistaken, the scriptless scripts concept (as currently
> formulated) falls to Schor's algorithm, and at present there is no
> alternative implementation of the concept to fall back on. Correct? Lest we
> build a house of cards, I'd strongly urge everyone to not depend on
> functional concepts whose underlying cryptographic primitives cannot be
> swapped in an emergency.
>
> Sure, we use ecdsa for example (which is also vulnerable to Schor's
> algorithm), but in contrast to scriptless scripts we have a variety of
> backup primitives at our disposal that fulfill the same functional
> objective.
>
> If scriptless scripts are found possible under lattice-based cryptography
> for example, that would be something I suppose. The functional concept of
> scriptless scripts is indeed very awesome - we just need to add some
> cryptographic conservatism before we build on it.
>
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
Benjamin Mord in reply to Greg Sanders permalink original

That would be awesome. Do you have a reference?

As pertains to the whole of asymmetric cryptography, I believe there are not a variety of post quantum schemes, there is only one*: lattice-based cryptography. (Which scares me, because it is not all that different from the others.)

(* Actually, in contexts where time can be used for asymmetry, as in TESLA, we can then use hash functions to create something like asymmetric signatures as well. But the functional context has to be compatible with delayed verification.)

(But I do not mean to focus exclusively on Schor's algorithm, the history of even pre-quantum cryptanalysis shows that primitives tend to have finite lifespan. Redundancy of any sort of good, even when not focused specifically on quantum risks.)

On Tue, May 8, 2018, 8:58 AM Greg Sanders <gsanders87 at gmail.com> wrote:

Quoted text (31 lines)
> From what I understand talking to folks, the linear properties of these
> signature tricks are maintained under a number of post-quantum schemes.
>
> On Tue, May 8, 2018 at 8:44 AM, Benjamin Mord <ben at mord.family> wrote:
>
>>
>> If I'm not mistaken, the scriptless scripts concept (as currently
>> formulated) falls to Schor's algorithm, and at present there is no
>> alternative implementation of the concept to fall back on. Correct? Lest we
>> build a house of cards, I'd strongly urge everyone to not depend on
>> functional concepts whose underlying cryptographic primitives cannot be
>> swapped in an emergency.
>>
>> Sure, we use ecdsa for example (which is also vulnerable to Schor's
>> algorithm), but in contrast to scriptless scripts we have a variety of
>> backup primitives at our disposal that fulfill the same functional
>> objective.
>>
>> If scriptless scripts are found possible under lattice-based cryptography
>> for example, that would be something I suppose. The functional concept of
>> scriptless scripts is indeed very awesome - we just need to add some
>> cryptographic conservatism before we build on it.
>>
>>
>> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>>
>
Benjamin Mord in reply to Benjamin Mord permalink original

Sorry, I do not wish to spam the list, but I need to correct a rather serious error in my last email. We must never call something "post-quantum", absent mathematical proof. (And good luck with that.) I apologise for my mistake in doing so myself.

I should not even refer to lattice based cryptography as a post-quantum algorithm, I should at best call it a Shor's algorithm-resistant scheme. At least, it is not (yet) known how Shor's algorithm could be used to break it. Not in public circles, anyhow.

A cursory glance at the history of cryptanalysis shows that primitives generally have finite life, which makes it odd that systems seldom use redundant primitives, and seldom provide for their rapid and safe swap. A system whose entire security rests on nothing but cryptography, ought to take particular care! The spectre of quantum computers may render the finite life of certain primitives more salient than others, but we must not suppose that, absent Shor's algorithm, there would be no need to plan for cryptographic failures. The question is not if, but when, Bitcoin and lightning will contend with broken primitives, whether due to classical or quantum cryptanalysis. Likely, both will come into play at various times, and one must plan accordingly.

On Tue, May 8, 2018, 9:09 AM Benjamin Mord <ben at mord.io> wrote:

Quoted text (51 lines)
>
> That would be awesome. Do you have a reference?
>
> As pertains to the whole of asymmetric cryptography, I believe there are
> not a variety of post quantum schemes, there is only one*: lattice-based
> cryptography. (Which scares me, because it is not all that different from
> the others.)
>
> (* Actually, in contexts where time can be used for asymmetry, as in
> TESLA, we can then use hash functions to create something like asymmetric
> signatures as well. But the functional context has to be compatible with
> delayed verification.)
>
> (But I do not mean to focus exclusively on Schor's algorithm, the history
> of even pre-quantum cryptanalysis shows that primitives tend to have finite
> lifespan. Redundancy of any sort of good, even when not focused
> specifically on quantum risks.)
>
> On Tue, May 8, 2018, 8:58 AM Greg Sanders <gsanders87 at gmail.com> wrote:
>
>> From what I understand talking to folks, the linear properties of these
>> signature tricks are maintained under a number of post-quantum schemes.
>>
>> On Tue, May 8, 2018 at 8:44 AM, Benjamin Mord <ben at mord.family> wrote:
>>
>>>
>>> If I'm not mistaken, the scriptless scripts concept (as currently
>>> formulated) falls to Schor's algorithm, and at present there is no
>>> alternative implementation of the concept to fall back on. Correct? Lest we
>>> build a house of cards, I'd strongly urge everyone to not depend on
>>> functional concepts whose underlying cryptographic primitives cannot be
>>> swapped in an emergency.
>>>
>>> Sure, we use ecdsa for example (which is also vulnerable to Schor's
>>> algorithm), but in contrast to scriptless scripts we have a variety of
>>> backup primitives at our disposal that fulfill the same functional
>>> objective.
>>>
>>> If scriptless scripts are found possible under lattice-based
>>> cryptography for example, that would be something I suppose. The functional
>>> concept of scriptless scripts is indeed very awesome - we just need to add
>>> some cryptographic conservatism before we build on it.
>>>
>>>
>>> _______________________________________________
>>> Lightning-dev mailing list
>>> Lightning-dev at lists.linuxfoundation.org
>>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>>
>>>
>>
Jim Posen in reply to Benjamin Mord permalink original

Benjamin,

I don't agree that quantum resistance should be a blocker to deployment of scriptless scripts on lightning because 1) it is a layer-2 solution and 2) it already critically depends on the security of DL.

There are arguments against making certain protocol changes to the base Bitcoin blockchain for the reason that they may not be quantum resistant. The most notable is Confidential Transactions. There reason is that the worst case attack is much worse: an attacker could print money freely and without detection. In Bitcoin today, a DL break would compromise funds in any addresses for which the pubkey has been revealed and it's not even clear what to do about the remaining funds on chain. Compromising the fundamental security of the blockchain is a valid cause for concern.

In the case of Lightning, the attack scenario on scriptless scripts is that a peer is going to use a quantum computer to steal all live payments routed through them from their senders before they get to the recipient. This would be bad, but not catastrophic, and once it is recognized that the attack is possible, insecure channels could be closed.

But furthermore, an attacker with a quantum computer could just steal the multisig funding output directly instead of attacking scriptless scripts. So additional protocol changes relying on the DL assumption don't bother me in the least.

On Tue, May 8, 2018, 6:32 AM Benjamin Mord <ben at mord.io> wrote:

Quoted text (80 lines)
>
> Sorry, I do not wish to spam the list, but I need to correct a rather
> serious error in my last email. We must never call something
> "post-quantum", absent mathematical proof. (And good luck with that.) I
> apologise for my mistake in doing so myself.
>
> I should not even refer to lattice based cryptography as a post-quantum
> algorithm, I should at best call it a Shor's algorithm-resistant scheme. At
> least, it is not (yet) known how Shor's algorithm could be used to break
> it. Not in public circles, anyhow.
>
> A cursory glance at the history of cryptanalysis shows that primitives
> generally have finite life, which makes it odd that systems seldom use
> redundant primitives, and seldom provide for their rapid and safe swap. A
> system whose entire security rests on nothing but cryptography, ought to
> take particular care! The spectre of quantum computers may render the
> finite life of certain primitives more salient than others, but we must not
> suppose that, absent Shor's algorithm, there would be no need to plan for
> cryptographic failures. The question is not if, but when, Bitcoin and
> lightning will contend with broken primitives, whether due to classical or
> quantum cryptanalysis. Likely, both will come into play at various times,
> and one must plan accordingly.
>
> On Tue, May 8, 2018, 9:09 AM Benjamin Mord <ben at mord.io> wrote:
>
>>
>> That would be awesome. Do you have a reference?
>>
>> As pertains to the whole of asymmetric cryptography, I believe there are
>> not a variety of post quantum schemes, there is only one*: lattice-based
>> cryptography. (Which scares me, because it is not all that different from
>> the others.)
>>
>> (* Actually, in contexts where time can be used for asymmetry, as in
>> TESLA, we can then use hash functions to create something like asymmetric
>> signatures as well. But the functional context has to be compatible with
>> delayed verification.)
>>
>> (But I do not mean to focus exclusively on Schor's algorithm, the history
>> of even pre-quantum cryptanalysis shows that primitives tend to have finite
>> lifespan. Redundancy of any sort of good, even when not focused
>> specifically on quantum risks.)
>>
>> On Tue, May 8, 2018, 8:58 AM Greg Sanders <gsanders87 at gmail.com> wrote:
>>
>>> From what I understand talking to folks, the linear properties of these
>>> signature tricks are maintained under a number of post-quantum schemes.
>>>
>>> On Tue, May 8, 2018 at 8:44 AM, Benjamin Mord <ben at mord.family> wrote:
>>>
>>>>
>>>> If I'm not mistaken, the scriptless scripts concept (as currently
>>>> formulated) falls to Schor's algorithm, and at present there is no
>>>> alternative implementation of the concept to fall back on. Correct? Lest we
>>>> build a house of cards, I'd strongly urge everyone to not depend on
>>>> functional concepts whose underlying cryptographic primitives cannot be
>>>> swapped in an emergency.
>>>>
>>>> Sure, we use ecdsa for example (which is also vulnerable to Schor's
>>>> algorithm), but in contrast to scriptless scripts we have a variety of
>>>> backup primitives at our disposal that fulfill the same functional
>>>> objective.
>>>>
>>>> If scriptless scripts are found possible under lattice-based
>>>> cryptography for example, that would be something I suppose. The functional
>>>> concept of scriptless scripts is indeed very awesome - we just need to add
>>>> some cryptographic conservatism before we build on it.
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>
Benjamin Mord in reply to Jim Posen permalink original

Good evening Jim,

Quoted text (3 lines)
> I don't agree that quantum resistance should be a blocker to deployment of
> scriptless scripts on lightning
>

I don't mean to speak narrowly about quantum cryptanalysis, but more generally about the need for backups to every primitive we use. DL is no exception, but for DL signatures, we do have lattices.

Quoted text (2 lines)
> because 1) it is a layer-2 solution
>

If this becomes global financial infrastructure, then layer 2 security will matter enough to merit some cryptographic conservatism. What if lightning succeeds fabulously? I think, it might.

Quoted text (2 lines)
> and 2) it already critically depends on the security of DL.
>

Does it? In specific form, sure - but in a pinch, could lattice-based algorithms not be swapped on relatively short notice, without changing the conceptual architecture? Perhaps I'm overlooking something, but I think probably, yes.

Quoted text (6 lines)
> There are arguments against making certain protocol changes to the base
> Bitcoin blockchain for the reason that they may not be quantum resistant.
> The most notable is Confidential Transactions. There reason is that the
> worst case attack is much worse: an attacker could print money freely and
> without detection.
>

Yes, that risk is entirely unacceptable, I agree - even at a mere $150 billion market cap, and much more so if this one day surpasses USD M3. Of course, if one knew the attack, it would be tempting to advocate for the weakness. I'm not making such an accusation here of course, I'm just saying that cryptographic conservatism helps demonstrate and maintain alignment of interests, and to demonstrate such alignment also to skeptical observers.

Quoted text (5 lines)
> In Bitcoin today, a DL break would compromise funds in any addresses for
> which the pubkey has been revealed and it's not even clear what to do about
> the remaining funds on chain. Compromising the fundamental security of the
> blockchain is a valid cause for concern.
>

Yes, bitcoin is wise to at least hash the pub key until use. Granted, lightning (necessarily?) risks public key exposure, but in a pinch there are other signature algorithms for lightning to move to.

Quoted text (6 lines)
> In the case of Lightning, the attack scenario on scriptless scripts is
> that a peer is going to use a quantum computer to steal all live payments
> routed through them from their senders before they get to the recipient.
> This would be bad, but not catastrophic, and once it is recognized that the
> attack is possible, insecure channels could be closed.
>

All channels would become insecure, the very premise of lightning would thus break, which is only a problem if the world came to depend on it. But then why try a thing, unless you plan to maybe succeed? Also, we don't know that a quantum computer is necessary. SHA-1 was secure, until it wasn't, no quantum computer was needed to break it.

Quoted text (3 lines)
> But furthermore, an attacker with a quantum computer could just steal the
> multisig funding output directly instead of attacking scriptless scripts.
>

Absolutely, and today there is no redundant signature of different algorithm, in the code. (That would be better.) But even so, how hard would it be to swap one signature algorithm for another? Then users "just" move their funds to multisig addresses under the new algorithm.

Quoted text (3 lines)
> So additional protocol changes relying on the DL assumption don't bother
> me in the least.
>

I don't follow the logic. If today we would have a frantic scramble in event of sudden DL weakness, as indeed seems probable, it does not then follow that we might as well design DL weakness to become a fundamentally unsurvivable problem. DL signatures bother me less because lattice cryptography can serve as backup. Scriptless scripts worry me because I just don't know what the backup is, when (not if) DL falls. Perhaps scriptless scripts can be done with lattices(?), in which case I am simply unaware - but some such backup should be identified, at least at a conceptual level, prior to use.

If this is just a toy, then never mind. If we don't expect the world to ever depend on this for anything important, then there is no need to fret over the finite lifespan of primitives. Or maybe we can just hope, that this time will be unlike all the others in the history of cryptography.

Otherwise, consider for example the history of DES, or SHA-1. Those are scenarios where we saw the problems coming far enough in advance to transition. Sure, it would be better if we had redundant primitives for every function in the actual code itself - just in case of either a sudden, or else a secret, break. In fact, we should aim to one day get there. But for now, let's at least have functionally equivalent backups for every function, even if only on paper. When exciting new functionality is invented but based on a mathematically unproven assumption, then let's wait to build on it until after at least one or two mathematically dissimilar assumptions have been found as alternative backup foundation. The global economy deserves such careful hands, I think, or else we do not deserve it.

Thanks, Benjamin Mord

ZmnSCPxj in reply to Benjamin Mord permalink original

Good morning Benjamin,

Your caution is laudable, I think.

Quoted text (1 line)
> Yes, bitcoin is wise to at least hash the pub key until use. Granted, lightning (necessarily?) risks public key exposure, but in a pinch there are other signature algorithms for lightning to move to.

Lightning cannot *quickly* move to a new signature algorithm. At the minimum you need to wait for the signature algorithm to get widely deployed in the base-layer blockchain, then LN implementations will need to scramble to implement the new signature algorithm. Then all LN users need to update, close existing channels, and reopen new ones.

Another issue is that the message transport is encrypted using a shared key derived from the node-identity public keys. If a break lets attackers derive private keys from public keys, then it is possible for any LN node to have its communications spoofed, meaning any mitigation may very well be obviated: channels need to be re-anchored cooperatively, but how do you know you are cooperating with the other node in the channel rather than the attacker, if the attacker can derive the private key from the other node public key?

The sudden influx of close followed by open transactions will probably massively load the blockchain layer, too.

In that case, perhaps a concrete proposal would be to prepare a new message protocol for reanchoring transactions:

1.  A new "signing algo" concept, which is effectively an enumeration that will be extended later, e.g. 0 => ECDSA on secp256k1, 1->255 => reserved.
2.  `open_channel` would need to provide a `signing_algo` that underlies the commitment structure at a lower level.
3.  A new `reopen_channel` to move a channel from one signing algorithm to another, plus a reply to accept the switch and provide new commitment transactions for both sides.  This is effectively a `shutdown` followed by the `closing_signed` negotiation followed by a new `open_channel`, but with the resulting transaction cutting through a close and a funding transaction (in order to reduce blockspace competition).
4.  A new `reopen_channel_rbf`, possibly including a proof that an existing reopen channel has replaced (e.g. sending the actual transaction that spends the funding outpoint and bids a higher feerate than the last re-open transaction), to RBF the re-open transaction that moves from one signing algorithm to another; better to lose the channel to miners as fees then to let a thief succeed (i.e. scorched earth). This is complicated by the fact that the re-open has to be signed cooperatively by two parties whereas a thief can be singular and thus faster in replacing transactions.  But at least better to make an effort than to just give up!
Quoted text (13 lines)
>
>
>> In the case of Lightning, the attack scenario on scriptless scripts is that a peer is going to use a quantum computer to steal all live payments routed through them from their senders before they get to the recipient. This would be bad, but not catastrophic, and once it is recognized that the attack is possible, insecure channels could be closed.
>
> All channels would become insecure, the very premise of lightning would thus break, which is only a problem if the world came to depend on it. But then why try a thing, unless you plan to maybe succeed? Also, we don't know that a quantum computer is necessary. SHA-1 was secure, until it wasn't, no quantum computer was needed to break it.
>
>> But furthermore, an attacker with a quantum computer could just steal the multisig funding output directly instead of attacking scriptless scripts.
>
> Absolutely, and today there is no redundant signature of different algorithm, in the code. (That would be better.) But even so, how hard would it be to swap one signature algorithm for another? Then users "just" move their funds to multisig addresses under the new algorithm.
>
>> So additional protocol changes relying on the DL assumption don't bother me in the least.
>
> I don't follow the logic. If today we would have a frantic scramble in event of sudden DL weakness, as indeed seems probable, it does not then follow that we might as well design DL weakness to become a fundamentally unsurvivable problem. DL signatures bother me less because lattice cryptography can serve as backup. Scriptless scripts worry me because I just don't know what the backup is, when (not if) DL falls. Perhaps scriptless scripts can be done with lattices(?), in which case I am simply unaware - but some such backup should be identified, at least at a conceptual level, prior to use.

At least on Lightning, Scriptless Script can only be used for payment forwarding. Thus the vulnerability is time-bounded. Further, while Scriptless Script enables new applications such as within-path decorrelation (privacy boost) and multi-path payments with proof-of-payment (functionality boost), we *can* fall back to the simple hashlocking we use now, which degrades functionality and privacy (but only to the level that we have today!). Hashlocking can have the exact hash function changed reasonably easily, modulo blockchain-layer infrastructure change (i.e. the base layer needs to implement the replacement before upper layers can use them), plus the need to update invoice formats to use a different hash function.

Quoted text (3 lines)
> If this is just a toy, then never mind. If we don't expect the world to ever depend on this for anything important, then there is no need to fret over the finite lifespan of primitives. Or maybe we can just hope, that this time will be unlike all the others in the history of cryptography.
>
> Otherwise, consider for example the history of DES, or SHA-1. Those are scenarios where we saw the problems coming far enough in advance to transition. Sure, it would be better if we had redundant primitives for every function in the actual code itself - just in case of either a sudden, or else a secret, break. In fact, we should aim to one day get there. But for now, let's at least have functionally equivalent backups for every function, even if only on paper. When exciting new functionality is invented but based on a mathematically unproven assumption, then let's wait to build on it until after at least one or two mathematically dissimilar assumptions have been found as alternative backup foundation. The global economy deserves such careful hands, I think, or else we do not deserve it.

Naively, it seems to me that there are already multiple ways to do Scriptless.

(I am not a mathematician and not a cryptographer; I am merely a dilettante, and probably massively misunderstand this)

1.  The classic one which takes advantage of Bellare-Neven signature linearity, where you provide an adaptor signature that can have magical mathematic operations with the actual signature to reveal the private key.
2.  Nonce reuse, where you provide a different message signed using the private key and a specific nonce, and commit that the actual transaction gets signed with the same private key and the same nonce used in the first message, which in combination with magical mathematic operations will reveal the private key.
3.  The Paillier cryptosystem thing that the ECDSA Scriptless Script uses, where you encrypt the private key in the Paillier cryptosystem, provide it, and you can have magical mathematic operations reveal the private key when you sign with it.

All of the above still depend on the Discrete Log Problem being Hard. I am uncertain if they can be adapted in a Lattice-based signing algorithm; the first one almost certainly cannot, I am unsure for the second and third.

Regards, ZmnSCPxj

Pedro Moreno Sanchez in reply to ZmnSCPxj permalink original

Hello,

I know it is kind of a late reply, but my co-authors and I have been working hard to get ready an extended version of the paper for this work. The paper is now available at https://eprint.iacr.org/2018/472

In this paper, we describe in detail the scriptless script (SS) ECDSA construction and formally prove its security and privacy guarantees. Additionally, we describe several other constructions of interest for the LN:

- The SS Schnorr, initially proposed by A. Poelstra. We formally describe the protocol and prove its security and privacy guarantees

- Interestingly, we show that it is possible to combine SS ECDSA and SS Schnorr without losing security or privacy. This allows interoperability between different implementations.

- A framework to combine script-based cryptographic locks using partially homomorphic one-way functions.

- Possible applications. For instance, SS ECDSA could be used today in Bitcoin to perform atomic swaps where the resulting transaction no longer reveals the cryptographic condition. Instead, it is embedded in a regular ECDSA signature. This provides several advantages such as reduced transaction size and better privacy/fungibility among others.

Please, let us know any comment/feedback that you might have.

Thanks, Pedro.

On 5/8/18 11:59 PM, ZmnSCPxj via Lightning-dev wrote:

Quoted text (161 lines)
> Good morning Benjamin,
>
> Your caution is laudable, I think.
>
>
>> Yes, bitcoin is wise to at least hash the pub key until use. Granted,
>> lightning (necessarily?) risks public key exposure, but in a pinch
>> there are other signature algorithms for lightning to move to.
>>
>
> Lightning cannot *quickly* move to a new signature algorithm.  At the
> minimum you need to wait for the signature algorithm to get widely
> deployed in the base-layer blockchain, then LN implementations will need
> to scramble to implement the new signature algorithm.  Then all LN users
> need to update, close existing channels, and reopen new ones.
>
> Another issue is that the message transport is encrypted using a shared
> key derived from the node-identity public keys.  If a break lets
> attackers derive private keys from public keys, then it is possible for
> any LN node to have its communications spoofed, meaning any mitigation
> may very well be obviated: channels need to be re-anchored
> cooperatively, but how do you know you are cooperating with the other
> node in the channel rather than the attacker, if the attacker can derive
> the private key from the other node public key?
>
> The sudden influx of close followed by open transactions will probably
> massively load the blockchain layer, too.
>
> In that case, perhaps a concrete proposal would be to prepare a new
> message protocol for reanchoring transactions:
>
> 1.  A new "signing algo" concept, which is effectively an enumeration
> that will be extended later, e.g. 0 => ECDSA on secp256k1, 1->255 =>
> reserved.
> 2.  `open_channel` would need to provide a `signing_algo` that underlies
> the commitment structure at a lower level.
> 3.  A new `reopen_channel` to move a channel from one signing algorithm
> to another, plus a reply to accept the switch and provide new commitment
> transactions for both sides.  This is effectively a `shutdown` followed
> by the `closing_signed` negotiation followed by a new `open_channel`,
> but with the resulting transaction cutting through a close and a funding
> transaction (in order to reduce blockspace competition).
> 4.  A new `reopen_channel_rbf`, possibly including a proof that an
> existing reopen channel has replaced (e.g. sending the actual
> transaction that spends the funding outpoint and bids a higher feerate
> than the last re-open transaction), to RBF the re-open transaction that
> moves from one signing algorithm to another; better to lose the channel
> to miners as fees then to let a thief succeed (i.e. scorched earth).
> This is complicated by the fact that the re-open has to be signed
> cooperatively by two parties whereas a thief can be singular and thus
> faster in replacing transactions.  But at least better to make an effort
> than to just give up!
>
>>
>>
>>
>>
>>     In the case of Lightning, the attack scenario on scriptless
>>     scripts is that a peer is going to use a quantum computer to steal
>>     all live payments routed through them from their senders before
>>     they get to the recipient. This would be bad, but not
>>     catastrophic, and once it is recognized that the attack is
>>     possible, insecure channels could be closed.
>>
>>
>> All channels would become insecure, the very premise of lightning
>> would thus break, which is only a problem if the world came to depend
>> on it. But then why try a thing, unless you plan to maybe succeed?
>> Also, we don't know that a quantum computer is necessary. SHA-1 was
>> secure, until it wasn't, no quantum computer was needed to break it.
>>
>>
>>     But furthermore, an attacker with a quantum computer could just
>>     steal the multisig funding output directly instead of attacking
>>     scriptless scripts.
>>
>>
>> Absolutely, and today there is no redundant signature of different
>> algorithm, in the code. (That would be better.) But even so, how hard
>> would it be to swap one signature algorithm for another? Then users
>> "just" move their funds to multisig addresses under the new algorithm.
>>
>>
>>     So additional protocol changes relying on the DL assumption don't
>>     bother me in the least.
>>
>>
>> I don't follow the logic. If today we would have a frantic scramble in
>> event of sudden DL weakness, as indeed seems probable, it does not
>> then follow that we might as well design DL weakness to become a
>> fundamentally unsurvivable problem. DL signatures bother me less
>> because lattice cryptography can serve as backup. Scriptless scripts
>> worry me because I just don't know what the backup is, when (not if)
>> DL falls. Perhaps scriptless scripts can be done with lattices(?), in
>> which case I am simply unaware - but some such backup should be
>> identified, at least at a conceptual level, prior to use.
>
> At least on Lightning, Scriptless Script can only be used for payment
> forwarding.  Thus the vulnerability is time-bounded.  Further, while
> Scriptless Script enables new applications such as within-path
> decorrelation (privacy boost) and multi-path payments with
> proof-of-payment (functionality boost), we *can* fall back to the simple
> hashlocking we use now, which degrades functionality and privacy (but
> only to the level that we have today!).  Hashlocking can have the exact
> hash function changed reasonably easily, modulo blockchain-layer
> infrastructure change (i.e. the base layer needs to implement the
> replacement before upper layers can use them), plus the need to update
> invoice formats to use a different hash function.
>
>> If this is just a toy, then never mind. If we don't expect the world
>> to ever depend on this for anything important, then there is no need
>> to fret over the finite lifespan of primitives. Or maybe we can just
>> hope, that this time will be unlike all the others in the history of
>> cryptography.
>>
>> Otherwise, consider for example the history of DES, or SHA-1. Those
>> are scenarios where we saw the problems coming far enough in advance
>> to transition. Sure, it would be better if we had redundant primitives
>> for every function in the actual code itself - just in case of either
>> a sudden, or else a secret, break. In fact, we should aim to one day
>> get there. But for now, let's at least have functionally equivalent
>> backups for every function, even if only on paper. When exciting new
>> functionality is invented but based on a mathematically unproven
>> assumption, then let's wait to build on it until after at least one or
>> two mathematically dissimilar assumptions have been found as
>> alternative backup foundation. The global economy deserves such
>> careful hands, I think, or else we do not deserve it.
>
> Naively, it seems to me that there are already multiple ways to do
> Scriptless.
>
> (I am not a mathematician and not a cryptographer; I am merely a
> dilettante, and probably massively misunderstand this)
>
> 1.  The classic one which takes advantage of Bellare-Neven signature
> linearity, where you provide an adaptor signature that can have magical
> mathematic operations with the actual signature to reveal the private key.
> 2.  Nonce reuse, where you provide a different message signed using the
> private key and a specific nonce, and commit that the actual transaction
> gets signed with the same private key and the same nonce used in the
> first message, which in combination with magical mathematic operations
> will reveal the private key.
> 3.  The Paillier cryptosystem thing that the ECDSA Scriptless Script
> uses, where you encrypt the private key in the Paillier cryptosystem,
> provide it, and you can have magical mathematic operations reveal the
> private key when you sign with it.
>
> All of the above still depend on the Discrete Log Problem being Hard.  I
> am uncertain if they can be adapted in a Lattice-based signing
> algorithm; the first one almost certainly cannot, I am unsure for the
> second and third.
>
> Regards,
> ZmnSCPxj
>
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>