From 556212209e1dc4b5debc1c5b9f3e587b290aab3e Mon Sep 17 00:00:00 2001 From: Ichiro0219 Date: Tue, 28 Jan 2020 14:04:36 +0900 Subject: [PATCH 1/2] Add MutualClosingTransaction --- Transactions.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Transactions.md b/Transactions.md index 5d5beb3..b589ddc 100644 --- a/Transactions.md +++ b/Transactions.md @@ -169,3 +169,45 @@ Where Where - `P2WPKH(Local Penalty Public Key)`'s value is `P2WSH(Remote's ToLocalOutput).value - fee` + +## Mutual Closing Transaction +### Known Values + * Local Mutual Closing Public Key: `ECPublicKey` + * Local Payout: `CurrencyUnit` + * Remote Mutual Closing Public Key: `ECPublicKey` + * Remote Payout: `CurrencyUnit` + * nLockTime: `UInt32` + * DLC Funding Output: `ScriptPubKey` + * Fee Rate: `FeeUnit` + +Where + - After the contract maturity time, Mutual Closing Transaction is made for fee reduction + - Both `Mutual Closing Public Key`s are 33-byte compressed public keys + - `Local Payout = (Contract Execution Transaction Local Payout).value` + - `Remote Payout = (Contract Execution Transaction Remote Payout).value` + - `nLockTime` is in the past (rather than just using 0) + - for privacy purposes and also to prevent [fee snipping](https://github.com/zkSNACKs/WalletWasabi/issues/2500) + - `DLC Funding Output` is of the form [specified above](#FundingOutputs) +### Global + * nLockTime +### Inputs + * Input Spending(P2WSH(DLC Funding Output)) +### Outputs + * ToLocalOutput + * ToRemoteOutput + +Where + - `ToLocalOutput's value is Local Payout + MutualClosingFeeDelta/2` + - `ToRemoteOutput's value is Remote Payout + MutualClosingFeeDelta/2` + - `MutualClosingFeeDelta = Computed CET Fee + Computed ToLocal Closing Fee - Computed MutualClosing Tx Fee (note that the Mutual Closing Transaction is smaller than any CET)` + - `ToLocalOutput`'s script is: + + OP_0 + + Which is `P2WPKH(Local Mutual Closing Public Key)` + + - `ToRemoteOutput`'s script is: + + OP_0 + + Which is `P2WPKH(Remote Mutual Closing Public Key)` From 98adf1e60710e3490a61d089ee273be4578fea9b Mon Sep 17 00:00:00 2001 From: Ichiro0219 Date: Wed, 29 Jan 2020 09:06:17 +0900 Subject: [PATCH 2/2] mutual-closing-transaction-fixed --- Transactions.md | 84 ++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/Transactions.md b/Transactions.md index b589ddc..0118123 100644 --- a/Transactions.md +++ b/Transactions.md @@ -127,6 +127,48 @@ Where Which is `P2WPKH(Remote Refund Public Key)` +## Mutual Closing Transaction +### Known Values + * Local Mutual Closing Public Key: `ECPublicKey` + * Local Payout: `CurrencyUnit` + * Remote Mutual Closing Public Key: `ECPublicKey` + * Remote Payout: `CurrencyUnit` + * nLockTime: `UInt32` + * DLC Funding Output: `ScriptPubKey` + * Fee Rate: `FeeUnit` + +Where + - After the contract maturity time, Mutual Closing Transaction is created in cooperation for fee reduction and improvement in privacy + - Both `Mutual Closing Public Key`s are 33-byte compressed public keys + - `Local Payout = (Contract Execution Transaction Local Payout).value` + - `Remote Payout = (Contract Execution Transaction Remote Payout).value` + - `nLockTime` is in the past (rather than just using 0) + - for privacy purposes and also to prevent [fee snipping](https://github.com/zkSNACKs/WalletWasabi/issues/2500) + - `DLC Funding Output` is of the form [specified above](#FundingOutputs) +### Global + * nLockTime +### Inputs + * Input Spending(P2WSH(DLC Funding Output)) +### Outputs + * ToLocalOutput + * ToRemoteOutput + +Where + - `ToLocalOutput's value is Local Payout + MutualClosingFeeDelta/2` + - `ToRemoteOutput's value is Remote Payout + MutualClosingFeeDelta/2` + - `MutualClosingFeeDelta = Computed CET Fee + Computed ToLocal Closing Fee - Computed MutualClosing Tx Fee (note that the Mutual Closing Transaction is smaller than any CET)` + - `ToLocalOutput`'s script is: + + OP_0 + + Which is `P2WPKH(Local Mutual Closing Public Key)` + + - `ToRemoteOutput`'s script is: + + OP_0 + + Which is `P2WPKH(Remote Mutual Closing Public Key)` + ## Closing Transaction (Unilateral) ### Known Values * Local Unilateral Public Key: `ECPublicKey` @@ -169,45 +211,3 @@ Where Where - `P2WPKH(Local Penalty Public Key)`'s value is `P2WSH(Remote's ToLocalOutput).value - fee` - -## Mutual Closing Transaction -### Known Values - * Local Mutual Closing Public Key: `ECPublicKey` - * Local Payout: `CurrencyUnit` - * Remote Mutual Closing Public Key: `ECPublicKey` - * Remote Payout: `CurrencyUnit` - * nLockTime: `UInt32` - * DLC Funding Output: `ScriptPubKey` - * Fee Rate: `FeeUnit` - -Where - - After the contract maturity time, Mutual Closing Transaction is made for fee reduction - - Both `Mutual Closing Public Key`s are 33-byte compressed public keys - - `Local Payout = (Contract Execution Transaction Local Payout).value` - - `Remote Payout = (Contract Execution Transaction Remote Payout).value` - - `nLockTime` is in the past (rather than just using 0) - - for privacy purposes and also to prevent [fee snipping](https://github.com/zkSNACKs/WalletWasabi/issues/2500) - - `DLC Funding Output` is of the form [specified above](#FundingOutputs) -### Global - * nLockTime -### Inputs - * Input Spending(P2WSH(DLC Funding Output)) -### Outputs - * ToLocalOutput - * ToRemoteOutput - -Where - - `ToLocalOutput's value is Local Payout + MutualClosingFeeDelta/2` - - `ToRemoteOutput's value is Remote Payout + MutualClosingFeeDelta/2` - - `MutualClosingFeeDelta = Computed CET Fee + Computed ToLocal Closing Fee - Computed MutualClosing Tx Fee (note that the Mutual Closing Transaction is smaller than any CET)` - - `ToLocalOutput`'s script is: - - OP_0 - - Which is `P2WPKH(Local Mutual Closing Public Key)` - - - `ToRemoteOutput`'s script is: - - OP_0 - - Which is `P2WPKH(Remote Mutual Closing Public Key)`