Research/Bitcoin Dev Archive / lightning-dev list
Witness asymmetric payment channels
7 messages, Aug 25 to Oct 8, 2020. Started by Lloyd Fournier.
Lloyd Fournier (5), ZmnSCPxj (2)
# Abstract
This is a proposal for a new channel symmetric channel construction that uses the key idea from a recent paper called "Generalized Bitcoin-Compatible Channels"[1] and tries to practically apply it to lightning. If you prefer, you can read the rendered markdown version here: https://github.com/LLFourn/witness-asymmetric-channel
The purpose of this post is to get feedback to see if it's worth doing a PoC implementation.
# Background
As presently specified the two parties in a lightning channel are assigned different commitment transactions. This _transaction asymmetry_ is logically necessary for the protocol to identify which party broadcasted a commitment transaction and potentially punish them if the other party provides proof it has been revoked (i.e. knows the revocation key).
Wouldn't it be nice if we could identify the broadcasting party without assigning them different transactions? Riard first considered this problem in [8] while trying to add a punishment mechanism to eltoo[9] style channel updates. They proposed that you could identify the broadcasting party using _witness asymmetry_ i.e. both parties broadcast the same transaction but have different witnesses. Unfortunately, the solution proposed is rather convoluted.
More recently in [1], Aumayr et al. introduced a much more elegant witness asymmetric solution using adaptor signatures. Instead of being assigned different transactions, the parties are assigned different adaptor signatures as witnesses for the _same_ transaction. The adaptor signatures force the party broadcasting a commitment transaction to reveal a "publishing secret" to the other party. The honest party can then use this publishing secret along with knowledge of the usual revocation secret to punish the malicious party for broadcasting an old commitment transaction.
Aumayr et al. combine this idea with a "punish-then-split" mechanism similar to the original eltoo proposal. Unfortunately, it therefore inherits the same issue with staggering time-locks. BOLT 3 [4] describes why it avoids this problem as a design choice:
Quoted text (5 lines)
> The reason for the separate transaction stage for HTLC outputs is so that > HTLCs can timeout or be fulfilled even though they are within the > to_self_delay delay. Otherwise, the required minimum timeout on HTLCs is > lengthened by this delay, causing longer timeouts for HTLCs traversing the > network.
There is further background discussion to this choice in [2] and Towns proposes a solution for eltoo in [3].
In short, the problem is that it creates a risk for the party that needs to fulfill an HTLC with the secret in time. The only known way of accounting for this risk is to increase the difference between the time-locks on each hop. There could be situations where this trade off makes sense but it seems undesirable for a general purpose payment channel network.
# Proposal
I propose a channel protocol which steals the main idea from Aumayr et al. while retaining the time-lock precedence of BOLT 3 transactions. That is, absolute time-locks are settled before relative time-locks to avoid having to account for relative time-locks when calculating absolute time-locks.
The guiding principle is to keep commitment transactions symmetric but to use the asymmetric knowledge of the parties to simulate the way lightning works right now. The main benefits of this seem to be:
- It is more elegant as there are half the number of possible transactions. I expect this will follow through to reduced implementation complexity and maybe make it easier to explain as well. - Every output can just be a 2-of-2 multi-sig (which could be a single key with MuSig or OP_CHECKMULTISIG with ECDSA etc). This makes the transactions a little smaller even when using 2-of-2 with ECDSA on balance, The space saving comes from avoiding explicit revocation keys in the commitment transaction outputs and using PTLCs rather than HTLCs. - The design works today and easily transitions into a post-taproot world although there is still a bit to explore there [5].
## Notation
I describe the protocol with respect to two parties Alice and Bob. 2-of-2(Xa,Xb) refers to a multi-signature output that supports adaptor signatures and requires the owners of Xa (Alice) and Xb (Bob) to authorize it (e.g. `OP_CHECKMULTISIG` with ECDSA [6], or MuSig with Schnorr etc [7]).
## The Fund transaction
The structure of channel funding does not change from the current BOLT spec. The Fund transaction spends from the funding party's (or funding _parties_) outputs to an output of 2-of-2(Fa,Fb) where Fa and Fb are public keys owned by Alice and Bob respectively. These keys are generated and exchanged once per channel.
## Commitment transactions
All commitment transactions spend from the 2-of-2 on the Fund transaction and each represents a "state" of the channel. A commitment transaction has two balance outputs and zero or more PTLC outputs.
Before creating a commitment transaction the parties must exchange two curve points each:
- A _publication_ point (denoted P) whose secret is revealed if that party broadcasts the commitment transaction. - A _revocation_ point (denoted R) whose secret is explicitly revealed to the other party when revoking this commitment transaction.
Let (Pa, Ra) and (Pb, Rb) be the publication and revocation points of Alice and Bob respectively. The scriptPubkey of all outputs on a commitment transaction is 2-of-2(Pa + Ra, Pb + Rb). To make it slightly harder to distinguish these outputs from other uses of 2-of-2 you can imagine that we pseudorandomly randomize each output so that they are not identical.
When signing a commitment transaction, the parties instead exchange adaptor signatures such that the party who publishes the commitment transaction must reveal their publication secret. This means that if a malicious party broadcasts a commitment transaction for which they have already revealed their revocation secret the other party will know both secrets and therefore both secret keys in 2-of-2(Pa + Ra, Pb + Rb). They can use this to unilaterally spend from all the outputs on the commitment transaction to punish the malicious party.
As a point of interest there is no problem with both parties broadcasting the same commitment transaction at the same time with their different signatures. In theory, both parties seeing the other's commitment transaction over the Bitcoin network could act as a kind of out of band optimization because it means they both learn each other's publication secrets and can therefore settle all the outputs without having to wait for relative time-locks (regardless of which signature makes it into the blockchain).
## Balance outputs
A balance output going to Alice has a scriptPubkey of 2-of-2(Pb, Ra) and the converse for Bob's balance output i.e. 2-of-2(Pa,Rb). Each balance output has a pre-signed relative time-locked claim transaction spending it to an address owned by the deserving party.
## PTLCs
PTLC outputs are added directly to commitment transactions in the form described above. Each PTLC has two pre-signed transactions spending from it: PTLC-success and PTLC-timeout. Broadcasting the PTLC-success transaction reveals the PTLC secret in the usual way using an adaptor signatures. The PTLC-timeout transaction has an absolute time-lock on it through the nlocktime transaction value.
For a PTLC output being offered by Alice to Bob both transactions have a single output with the following scriptPubkeys:
- PTLC-success: 2-of-2(Pa, Rb) - PTLC-timeout: 2-of-2(Pb, Ra)
Both transactions have a pre-signed "claim" transaction that spends the funds to an address owned by the desired party after a relative time-lock (i.e. it has a sequence number set). Alternatively, the PTLC-success/timeout can be constructed like HTLC-success/timeout transactions in lightning today where the destination party can spend unilaterally after the relative time-lock enforced with OP_CSV. I find this slightly unappealing because it means using an output that is not just a 2-of-2.
Only the destination party needs to have the signature (or adaptor signature) on the PTLC-success or PTLC-timeout transactions. So if it's a PTLC offered by Alice to Bob then Bob will have an adaptor signature on PTLC-success and Alice will have an ordinary signature on the PTLC-timeout transaction. There is no theoretical security issue with both parties having the signatures it just makes writing state machines easier if Alice can rule out a PTLC-success transaction being broadcast unless she broadcasted it herself.
# Scenarios
To demonstrate the logical implications of the key combinations used in the above 2-of-2s I'll somewhat tediously go through how each output is resolved. I'll use the label "BOB OWNS" to indicate that Bob knows both keys for the 2-of-2 and Alice has no pending time-locked transactions that spend from the output. Likewise I'll use "BOB MUST SPEND" to indicate that Bob knows both keys but there *is* a pending time-locked transaction that Alice may use in the future.
In these examples Alice is the one broadcasting the commitment transaction but it could just as easily be Bob (remember it is the same transaction), in which case the converse of each situation applies.
## Balance output
Here is what happens for balance outputs.
Alice broadcasts a non-revoked commitment transaction (reveals Pa): 1. Balance output for Alice: Alice waits for the relative time-lock and then broadcasts her claim transaction. 2. Balance output for Bob: BOB OWNS. The output is 2-of-2(Pa,Rb) and Alice has revealed Pa.
Alice broadcasts a revoked commitment transaction (reveals Pa and has already revealed Ra): 1. Balance output for Alice: BOB MUST SPEND. The output is 2-of-2(Ra,Pb) so Bob knows both keys but he needs to spend it before Alice's relative time-locked claim transaction. 2. Balance output for Bob: BOB OWNS. The output is 2-of-2(Pa,Rb) and Alice has revealed Pa.
## PTLC output
In each of the following scenarios Alice broadcasts the commitment transaction and therefore reveals Pa. I describe what happens when the PTLC-success transaction makes it in instead of the PTLC-timeout and vise versa.
Alice broadcasts a non-revoked commitment transaction which has a PTLC offered to Bob (reveals Pa): 1. PTLC-success confirmed: BOB OWNS. The output is 2-of-2(Pa,Rb) and Alice revealed Pa when she broadcasted the commitment transaction. 2. PTLC-timeout confirmed: Alice waits until the relative time lock expires and then broadcasts the claim transaction.
Alice broadcasts a non-revoked commitment transaction which has a PTLC offered to herself (reveals Pa): 1. PTLC-success confirmed: Alice waits for the relative time-lock to expire and then broadcasts the claim transaction. 2. PTLC-timeout confirmed: BOB OWNS. The output is 2-of-2(Pa,Rb) and Alice revealed Pa when she broadcasted the commitment transaction.
When Alice broadcasts a revoked commitment with a PTLC either Alice manages to also confirm the PTLC-success or PTLC-timeout transactions (depending on the direction of the PTLC) or Bob revokes the PTLC output in a transaction of his choosing. Bob can unilaterally spend the PTLC output because he knows all keys in 2-of-2(Pa + Ra, Pb + Rb). If he misses out, he gets another shot after the PTLC-success and PTLC-timeout transactions are confirmed. This is very similar to lightning today but here is what happens in the two scenarios for completeness:
Alice broadcasts a revoked commitment transaction which has a PTLC towards Bob (reveals Pa and has already revealed Ra): 1. PTLC-timeout confirmed: BOB MUST SPEND. The output is 2-of-2(Pb,Ra) and Alice revealed Ra when she revoked the commitment transaction but Alice has a pending claim transaction to spend the funds. 2. Revocation tx confirmed: Bob takes all the funds.
Alice broadcasts a revoked commitment transaction which has a PTLC towards herself (reveals Pa and has already revealed Ra): 1. PTLC-success confirmed: BOB MUST SPEND. The output is 2-of-2(Pb,Ra) and Alice revealed Ra when she revoked the commitment transaction but Alice has a pending claim transaction to spend the funds. 2. Revocation tx confirmed: Bob takes all the funds.
# Misc Remarks
- It looks straightforward to apply anchor outputs to this scheme - Each "claim" transaction can be `SIGHASH_SINGLE | SIGHASH_ANYONECANPAY` to allow combining it into a larger transaction.
[1]: https://eprint.iacr.org/2020/476.pdf [2]: https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2015/return-to-the-layered-commit-transactions#m-999a0438 [3]: https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2020/layered-commitments-with-eltoo#m-7551fa6d [4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md [5]: https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/lightning-in-a-taproot-future#m-6e527d69 [6]: https://joinmarket.me/blog/blog/schnorrless-scriptless-scripts/ [7]: https://joinmarket.me/blog/blog/flipping-the-scriptless-script-on-schnorr/_ [8]: https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/using-per-update-credential-to-enable-eltoo-penalty#m-7709f146 [9]: https://blockstream.com/eltoo.pdf
Please let me know if something is not clear or underdeveloped or you think I have missed something. Thanks to those who have offered their comments so far and thanks in advance for any ideas you have that could improve this scheme.
LL
Good morning Lloyd,
I think this is excellent work overall.
With that said...
Quoted text (3 lines)
> - It is more elegant as there are half the number of possible transactions. I > expect this will follow through to reduced implementation complexity and maybe > make it easier to explain as well.
I am not sure the complexity will be reduced all that much.
Currently:
* We provide a partial signature for the other side for their commitment transaction. * We keep our own commitment transaction and the partial signature we receive from the other side.
The node never has to retain the commitment transaction of the other side.
With this setup:
* We provide a partial signature for the other side for their asymmetric signature. * We keep a copy of the shared commitment transaction and the partial signature we received for our own asymmetric signature from the other side.
So storage complexity is still the same.
An issue is that with asymmetric transactions, it is fairly easy to use TCP to communicate changes to the commitment txes. We send a bunch of HTLC changes we want to apply to the other side commitment tx, then send a signature for those changes. Since what we send applies to *their* transaction only, we do not have to consider what they sent to us, we just have to consider what we sent to them. Conversely, when keeping track of what our commitment transaction is, we only have to consider what they sent to us, in order, and then when we receive a signature we know it is for the commitment transaction with all the updates the other side sent.
(This arguably just moves the complexity higher, however: we cannot forward an HTLC until both us and the other side have revoked the transactions that do not contain it i.e. the "irrevocably committed" state.)
When we have "the same" transaction on both sides, however, we need to synchronize between the two sides. Suppose both participants want to forward HTLCs to one another. Without any kind of locking, both participants could send network packets containing the HTLCs they want to add to each other, and it becomes ambiguous whether the signature they *should* send contains one, or both.
Basically, TCP only assures a global order for *one* direction of the communications, once we have two network nodes talking simultaneously, the order in which one writes and then reads is a lot more ambiguous.
This issue also exists for Decker-Russell-Osuntokun, incidentally.
One way to solve this would be to have a "token" that is passed alternately between the participants. At initial connection, they run a secure multiparty coinflip that indicates which one gets the token. Then, the one that holds the token can add more HTLCs, then tell the other "okay, now we sign" and they exchange signatures for a new version that involves only the HTLCs from the token-holder. Then the token-holder passes the token to the other side.
If the current token-holder does not have any HTLCs it wants to send, it can wait for some time (in case it receives a request to forward), then if there are still no HTLCs, it can pass the token to the other side by sending a token-passing message.
This solution requires a good amount of bandwidth in such token-passing messages, which can multiply with the number of channels a single node has. If token-passing is not done in short time frames (sub-second) then it potentially increases the latency of forwarding, thus this represents a latency vs bandwidth tradeoff.
There may be better solutions for this race-condition problem. For example, it seems to me that we can still have different histories for both sides of the channel, i.e. different transactions on both sides, the same as in current Poon-Dryja BOLT. After all, the witnesses are asymmetric anyway. But that completely negates the stated goal of removing the different transactions on both sides and the hoped-for reduction in complexity, so an exercise in futility.
Regards, ZmnSCPxj
Good morning LL, and other LNers...
Since we want to upgrade to Decker-Russell-Osuntokun in the future anyway, we still need to solve this "simultaneous HTLC" problem.
So here is another cut at this, without the token-passing:
* Perform a coin toss whenever simultaneous HTLC offers occur.
* Typically, a multiparty coin-toss involves two rounds: first commitments to random numbers are sent, then the actual random numbers are sent, and then after validating that they match commitments, their lowest bits are XORed and the resulting bit is heads/tails.
* However, we should recognize that HTLCs hashes are not under full control of anyone other than the payee, and if somebody is *offering* an HTLC, it is either the payer, or a forwarding node.
* Even *if* it is under control of the offerer of the HTLC, once an HTLC is instantiated, it consumes capacity on the channel (`max_accepted_htlcs`).
Thus, even if one counterparty keeps winning the coin toss, it will eventually run out of capacity to add a new HTLC.
* So we could just use the HTLC hashes to seed the random numbers of the coin toss.
For example, it could be salted with the node IDs of the channel parties, then the resulting hash of the hash is used in the deterministic coin toss.
So let us consider two messages:
* `add_htlc` containing 1 or more HTLCs the sender wants to add. * `ack_htlc` containing nothing.
Whenever a node wants to add one or more HTLCs, it sends `add_htlc`, then waits for *either* `add_htlc` *or* `ack_htlc`. If it receives an `ack_htlc`, then it is the only one with HTLCs to add, so they add the HTLCs and send partial signatures of the new state to each other.
If we receive an `add_htlc` without having sent an `add_htlc` of our own, we just send out an `ack_htlc` and proceed to partial signature sharing.
However, if both peers sent `add_htlc` to each other, they perform a coin toss ritual. They concatenate their node IDs (lexicographic order), then concatenate those with the set of HTLCs being added by each side. They hash the concatenation, and then take the lowest bit of that hash. If it is 0, then the node that owns the `/0` direction won and the HTLCs it added are what goes in the next update (and the loser has to buffer up its changes until after the update ritual completes). If it is 1, then the node that owns the `/1` direction won.
Regards, ZmnSCPxj
Hi Z,
Thanks as usual for your thoughtful comments
I agree with you that there is no improvement in complexity in the formal sense. I do believe it is an improvement in conceptual complexity. At least, I am able to keep all the moving parts in my head at the same time whereas I struggle sometimes with the current BOLT spec.
Unfortunately, while thinking about the above statement I realised there is worse storage complexity. In order to punish a revoked commitment transaction efficiently you need to extract the publication secret. But in order to do that you need to keep around the encrypted signature (a.k.a adaptor signature) **for that particular commitment transaction**. This means you have O(n) storage, unlike the present spec which has O(1) by deriving the previously revealed revocation secret from the present one (this can't be done with adaptor signatures). This doesn't seem to be addressed in the original work.
Yikes! This might be a fatal flaw to this proposal unless it can be addressed.
Quoted text (1 line)
> When we have "the same" transaction on both sides, however, we need to synchronize between the two sides.
Can you elaborate on this? I think you can carry on using the same BOLT 2 update protocol within this channel system. The txids being the same for both parties sometimes seems to be incidental. It may be advantageous to use an alternative protocol that forces a synchronization of the commitment transactions but I don't *think* it is a requirement. I guess you would need to sync in Decker-Russell-Osuntokun because it needs an objective ordering of commitment transactions. That is seemingly not the case here though
LL
On Tue, Aug 25, 2020 at 10:45 PM ZmnSCPxj <ZmnSCPxj at protonmail.com> wrote:
Quoted text (61 lines)
> > Good morning Lloyd, > > I think this is excellent work overall. > > With that said... > > > > - It is more elegant as there are half the number of possible transactions. I > > expect this will follow through to reduced implementation complexity and maybe > > make it easier to explain as well. > > I am not sure the complexity will be reduced all that much. > > Currently: > > * We provide a partial signature for the other side for their commitment transaction. > * We keep our own commitment transaction and the partial signature we receive from the other side. > > The node never has to retain the commitment transaction of the other side. > > With this setup: > > * We provide a partial signature for the other side for their asymmetric signature. > * We keep a copy of the shared commitment transaction and the partial signature we received for our own asymmetric signature from the other side. > > So storage complexity is still the same. > > An issue is that with asymmetric transactions, it is fairly easy to use TCP to communicate changes to the commitment txes. > We send a bunch of HTLC changes we want to apply to the other side commitment tx, then send a signature for those changes. > Since what we send applies to *their* transaction only, we do not have to consider what they sent to us, we just have to consider what we sent to them. > Conversely, when keeping track of what our commitment transaction is, we only have to consider what they sent to us, in order, and then when we receive a signature we know it is for the commitment transaction with all the updates the other side sent. > > (This arguably just moves the complexity higher, however: we cannot forward an HTLC until both us and the other side have revoked the transactions that do not contain it i.e. the "irrevocably committed" state.) > > When we have "the same" transaction on both sides, however, we need to synchronize between the two sides. > Suppose both participants want to forward HTLCs to one another. > Without any kind of locking, both participants could send network packets containing the HTLCs they want to add to each other, and it becomes ambiguous whether the signature they *should* send contains one, or both. > > Basically, TCP only assures a global order for *one* direction of the communications, once we have two network nodes talking simultaneously, the order in which one writes and then reads is a lot more ambiguous. > > This issue also exists for Decker-Russell-Osuntokun, incidentally. > > One way to solve this would be to have a "token" that is passed alternately between the participants. > At initial connection, they run a secure multiparty coinflip that indicates which one gets the token. > Then, the one that holds the token can add more HTLCs, then tell the other "okay, now we sign" and they exchange signatures for a new version that involves only the HTLCs from the token-holder. > Then the token-holder passes the token to the other side. > > If the current token-holder does not have any HTLCs it wants to send, it can wait for some time (in case it receives a request to forward), then if there are still no HTLCs, it can pass the token to the other side by sending a token-passing message. > > This solution requires a good amount of bandwidth in such token-passing messages, which can multiply with the number of channels a single node has. > If token-passing is not done in short time frames (sub-second) then it potentially increases the latency of forwarding, thus this represents a latency vs bandwidth tradeoff. > > There may be better solutions for this race-condition problem. > For example, it seems to me that we can still have different histories for both sides of the channel, i.e. different transactions on both sides, the same as in current Poon-Dryja BOLT. > After all, the witnesses are asymmetric anyway. > But that completely negates the stated goal of removing the different transactions on both sides and the hoped-for reduction in complexity, so an exercise in futility. > > > Regards, > ZmnSCPxj
Quoted text (13 lines)
> Unfortunately, while thinking about the above statement I realised > there is worse storage complexity. > In order to punish a revoked commitment transaction efficiently you > need to extract the publication secret. > But in order to do that you need to keep around the encrypted > signature (a.k.a adaptor signature) **for that particular commitment > transaction**. > This means you have O(n) storage, unlike the present spec which has > O(1) by deriving the previously revealed revocation secret from the > present one (this can't be done with adaptor signatures). > This doesn't seem to be addressed in the original work. > > Yikes! This might be a fatal flaw to this proposal unless it can be
addressed.
Quoted text (1 line)
>
Fortunately, I am wrong. At least in the case of non-aggregated 2-of-2 you can deterministically produce the encrypted signature by yourself for any commitment transaction as long as you use a deterministic nonce. But I think if using MuSig you would need to store each two party generated encrypted signature. Seeing as the likely way forward would be to use MuSig on an output which has a taproot which hides a discrete 2-of-2 this may not be a problem.
LL
Quoted text (10 lines)
> > > Fortunately, I am wrong. At least in the case of non-aggregated 2-of-2 you > can deterministically produce the encrypted signature by yourself for any > commitment transaction as long as you use a deterministic nonce. > But I think if using MuSig you would need to store each two party > generated encrypted signature. > Seeing as the likely way forward would be to use MuSig on an output which > has a taproot which hides a discrete 2-of-2 this may not be a problem. >
Upon further reflection I was missing something obvious when I came to this conclusion. You can't produce the adaptor signature for a commitment transaction deterministically without the encryption key (the other party's publication point). As long as we have to store the other party's per-commitment publication point we still need O(n) storage where n is the number of commitment transactions. Sorry for the confusion.
Fortunately I had a bit of a breakthrough which allows us to eliminate publication points altogether and enables O(1) storage when 2-of-2 multi-signatures are instantiated with or without key aggregation (i.e. MuSig or OP_CHECKMULTISIG).
### Eliminating Publication Points In favor of "revocable signatures" (for OP_CHECKMULTISIG)
I propose replacing the publication point with a static key that remains the same with each commitment transaction. The encryption key for each commitment transaction adaptor signature is (Ra + A) for Alice and (Rb + B) for Bob. Therefore, Alice broadcasting her commitment transaction would reveal the discrete log of Ra + A (and Bob Rb + B). Note that if Alice has not revealed her recvocation key (Ra) for this commitment transaction she is not in trouble since her static key A is blinded by Ra. If she has then Bob will learn her static secret key for A. The intuition here is that the revocation key acts as a blinding factor for the static key in the same way a nonce blinds your secret key in a schnorr signature (more on that later). If you haven't revealed your revocation key then you are free to use that signature. If you have revealed the revocation key then you have in effect "revoked" the signature.
Now we need to make sure that if a party learns the secret key of the other they can efficiently punish them so make the following changes to my original proposal:
Balance output for Alice is 2-of-2(A , Rb + B) Balance output for Bob is 2-of-2(Ra + A, B)
The implication of the above structure is that if you broadcast a commitment transaction the other party can take their balance immediately. If you broadcasted a revoked commitment transaction then they can take their output and yours immediately.
PTLC outputs and all subsequent transaction outputs then simplify to 2-of-2(A,B) on every output. Yay! Consider a PTLC paying to Alice. The PTLC-success output can be 2-of-2(A,B). If Alice broadcasted it and it has been revoked then Bob knows A and B so he can punish her. The converse is true for the PTLC-timeout. This elegant uniformity extends to other off-chain protocols hosted in these channels e.g. DLCs
Since A and B are static per channel and the secret keys for Ra and Rb can be incrementally derived from subsequent values (as in the present lightning spec) we have O(1) communication. In practice each 2-of-2(A,B) should be randomized so they don't all look the same.
### Revoking key aggregated schnorr signatures (for MuSig)
Even with the above improvement there is still O(n) storage if using key aggregation (MuSig) on the funding transaction output. Key aggregation may be desirable here since you may want to not use a taproot spend to broadcast a commitment transaction. Since the two party adaptor signature scheme needs randomness from both parties, you would have to store the other party's nonce and retrieve it to deterministically produce the adaptor signature so you can extract Ra + A (if Alice broadcasts) from the witness of the commitment transaction.
Fortunately, there is a natural way to revoke a key aggregated signature you helped produce without using adaptor signatures at all: just reveal the nonce you used for it to the other party. This prevents you from broadcasting it since the other party can now extract your secret key from it! Explicitly, two party signature generate two Schnorr signatures for the key A + B in the form:
sa = ra + rb' + H(Ra + Rb' || A + B || m)(a + b) sb = ra' + rb + H(Ra' + Rb || A + B || m)(a + b)
- (ra,rb) are the revocation secret keys, - (ra', rb') are typical deterministically produced[1] nonces with Ra' = ra' * G etc. - (a,b) are the static secret keys
Only Alice knows sa and only Bob knows sb but they are both signatures on the same commitment transaction. This is the witness asymmetry in the protocol.
When revoking the commitment transaction associated with sa Alice reveals ra to Bob and vice versa. If Alice uses sa after that, Bob can deterministically produce rb' and ra (because each revocation key can be derived from the last) and therefore can produce:
ra + rb' + H(Ra + Rb' || A + B || m)b
which when subtracted from sa and divided by H(Ra + Rb' || A + B || m) will yield b (Bob's static secret key).
The advantage of witness asymmetric channels using discrete keys over present lightning seems to boil down to a simpler transaction structure (in favour of using more complicated cryptography). However, for key aggregation there is a measurable improvement in communication complexity: It halves the amount of interactive signatures that need to be computed per payment. This is because each PTLC does not need to be duplicated across the asymmetric state of both parties.
Zeeman pointed out in [2] that the number of signing rounds (which this does not improve) may be prohibitive anyway for payment applications at least so it remains to be seen whether this efficiency can be utilised for payment PTLCs in LN. Thankfully, there are still advancements being made in Schnorr key aggregated signing so the right answer to this might change over time.[3]
[1] The caveats about not using deterministic nonces in MuSig can be avoided here since we necessarily have state in LN. [2] https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/lightning-in-a-taproot-future#m-6e527d69 [3] https://medium.com/blockstream/musig-dn-schnorr-multisignatures-with-verifiably-deterministic-nonces-27424b5df9d6
Cheers,
LL
For those interested I've recently integrated the above refinements and tried to coherently package the whole idea together here: https://github.com/LLFourn/witness-asymmetric-channel
The main difference is that the protocol now uses what I am calling "revocable signatures" as the main primitive. This allows for O(1) storage complexity in both key aggregated and "multisig" constructions.
LL
On Thu, Sep 10, 2020 at 1:56 PM Lloyd Fournier <lloyd.fourn at gmail.com> wrote:
Quoted text (79 lines)
> > >> >> >> Fortunately, I am wrong. At least in the case of non-aggregated 2-of-2 you can deterministically produce the encrypted signature by yourself for any commitment transaction as long as you use a deterministic nonce. >> But I think if using MuSig you would need to store each two party generated encrypted signature. >> Seeing as the likely way forward would be to use MuSig on an output which has a taproot which hides a discrete 2-of-2 this may not be a problem. > > > Upon further reflection I was missing something obvious when I came to this conclusion. You can't produce the adaptor signature for a commitment transaction deterministically without the encryption key (the other party's publication point). > As long as we have to store the other party's per-commitment publication point we still need O(n) storage where n is the number of commitment transactions. Sorry for the confusion. > > Fortunately I had a bit of a breakthrough which allows us to eliminate publication points altogether and enables O(1) storage when 2-of-2 multi-signatures are instantiated with or without key aggregation (i.e. MuSig or OP_CHECKMULTISIG). > > ### Eliminating Publication Points In favor of "revocable signatures" (for OP_CHECKMULTISIG) > > I propose replacing the publication point with a static key that remains the same with each commitment transaction. > The encryption key for each commitment transaction adaptor signature is (Ra + A) for Alice and (Rb + B) for Bob. > Therefore, Alice broadcasting her commitment transaction would reveal the discrete log of Ra + A (and Bob Rb + B). > Note that if Alice has not revealed her recvocation key (Ra) for this commitment transaction she is not in trouble since her static key A is blinded by Ra. If she has then Bob will learn her static secret key for A. > The intuition here is that the revocation key acts as a blinding factor for the static key in the same way a nonce blinds your secret key in a schnorr signature (more on that later). > If you haven't revealed your revocation key then you are free to use that signature. If you have revealed the revocation key then you have in effect "revoked" the signature. > > Now we need to make sure that if a party learns the secret key of the other they can efficiently punish them so make the following changes to my original proposal: > > Balance output for Alice is 2-of-2(A , Rb + B) > Balance output for Bob is 2-of-2(Ra + A, B) > > The implication of the above structure is that if you broadcast a commitment transaction the other party can take their balance immediately. > If you broadcasted a revoked commitment transaction then they can take their output and yours immediately. > > PTLC outputs and all subsequent transaction outputs then simplify to 2-of-2(A,B) on every output. Yay! > Consider a PTLC paying to Alice. The PTLC-success output can be 2-of-2(A,B). If Alice broadcasted it and it has been revoked then Bob knows A and B so he can punish her. > The converse is true for the PTLC-timeout. > This elegant uniformity extends to other off-chain protocols hosted in these channels e.g. DLCs > > Since A and B are static per channel and the secret keys for Ra and Rb can be incrementally derived from subsequent values (as in the present lightning spec) we have O(1) communication. > In practice each 2-of-2(A,B) should be randomized so they don't all look the same. > > ### Revoking key aggregated schnorr signatures (for MuSig) > > Even with the above improvement there is still O(n) storage if using key aggregation (MuSig) on the funding transaction output. > Key aggregation may be desirable here since you may want to not use a taproot spend to broadcast a commitment transaction. > Since the two party adaptor signature scheme needs randomness from both parties, you would have to store the other party's nonce and retrieve it to deterministically produce the adaptor signature so you can extract Ra + A (if Alice broadcasts) from the witness of the commitment transaction. > > Fortunately, there is a natural way to revoke a key aggregated signature you helped produce without using adaptor signatures at all: just reveal the nonce you used for it to the other party. > This prevents you from broadcasting it since the other party can now extract your secret key from it! > Explicitly, two party signature generate two Schnorr signatures for the key A + B in the form: > > sa = ra + rb' + H(Ra + Rb' || A + B || m)(a + b) > sb = ra' + rb + H(Ra' + Rb || A + B || m)(a + b) > > - (ra,rb) are the revocation secret keys, > - (ra', rb') are typical deterministically produced[1] nonces with Ra' = ra' * G etc. > - (a,b) are the static secret keys > > Only Alice knows sa and only Bob knows sb but they are both signatures on the same commitment transaction. > This is the witness asymmetry in the protocol. > > When revoking the commitment transaction associated with sa Alice reveals ra to Bob and vice versa. If Alice uses sa after that, Bob can deterministically produce rb' and ra (because each revocation key can be derived from the last) and therefore can produce: > > ra + rb' + H(Ra + Rb' || A + B || m)b > > which when subtracted from sa and divided by H(Ra + Rb' || A + B || m) will yield b (Bob's static secret key). > > The advantage of witness asymmetric channels using discrete keys over present lightning seems to boil down to a simpler transaction structure (in favour of using more complicated cryptography). > However, for key aggregation there is a measurable improvement in communication complexity: It halves the amount of interactive signatures that need to be computed per payment. > This is because each PTLC does not need to be duplicated across the asymmetric state of both parties. > > Zeeman pointed out in [2] that the number of signing rounds (which this does not improve) may be prohibitive anyway for payment applications at least so it remains to be seen whether this efficiency can be utilised for payment PTLCs in LN. > Thankfully, there are still advancements being made in Schnorr key aggregated signing so the right answer to this might change over time.[3] > > [1] The caveats about not using deterministic nonces in MuSig can be avoided here since we necessarily have state in LN. > [2] https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2019/lightning-in-a-taproot-future#m-6e527d69 > [3] https://medium.com/blockstream/musig-dn-schnorr-multisignatures-with-verifiably-deterministic-nonces-27424b5df9d6 > > Cheers, > > LL