From 7db055f1abb9371a4607efd06f0047d28283a1e6 Mon Sep 17 00:00:00 2001 From: Nadav Kohen Date: Fri, 13 Dec 2019 17:58:19 -0600 Subject: [PATCH] Respond to Review on Transactions.md --- Transactions.md | 81 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 18 deletions(-) diff --git a/Transactions.md b/Transactions.md index cb2715e..6a72641 100644 --- a/Transactions.md +++ b/Transactions.md @@ -12,26 +12,26 @@ * Total Local Collateral: `CurrencyUnit` * Total Remote Collateral: `CurrencyUnit` * Fee Rate: `FeeUnit` - * Output Type: `OutputType` Where - Local something something Remote - The sum of each `Funding Inputs`' value is at least that of its `Total Collateral` - `Funding Public Key`s are both 33-byte compressed public keys - - `nLockTime` is in the past - - `Output Type` is one of `Raw`, `P2SH`, `P2WSH`, or `P2SH-P2WSH` + - `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) + - Both `Change ScriptPubKey`s must be either `P2WSH/P2WPKH`, or `P2SH-P2WSH/P2SH-P2WPKH` ### Global * nLockTime ### Inputs * Local Funding Inputs * Remote Funding Inputs ### Outputs - * Output Type(DLC Funding Output) + * P2WSH(DLC Funding Output) * Local Change ScriptPubKey * Remote Change ScriptPubKey Where - - `Output Type(DLC Funding Output)`'s value is `Total Local Collateral + Total Remote Collateral` + - `P2WSH(DLC Funding Output)`'s value is `Total Local Collateral + Total Remote Collateral` - `DLC Funding Output`'s script is OP_2 OP_2 OP_CHECKMULTISIG @@ -49,25 +49,24 @@ Where * Timeout: `UInt32` * DLC Funding Output: `ScriptPubKey` * Fee Rate: `FeeUnit` - * Output Type: `OutputType` Where - `Oracle Signature Point` is the 33-byte public key associated with this CET's outcome - Both `CET Public Key`s are 33-byte compressed public keys - `Local Paytout + Remote Payout = (DLC Funding Output).value` - - `nLockTime` is in the past + - `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) - - `Output Type` is one of `Raw`, `P2SH`, `P2WSH`, or `P2SH-P2WSH` ### Global * nLockTime ### Inputs - * Input Spending(OutputType(DLC Funding Output)) + * Input Spending(P2WSH(DLC Funding Output)) ### Outputs - * OutputType(ToLocalOutput) - * OutputType(ToRemoteOutput) + * P2WSH(ToLocalOutput) + * ToRemoteOutput Where - - `ToLocalOutput.value = Local Payout - Local Fee` + - `P2WSH(ToLocalOutput).value = Local Payout - Local Fee` - `ToRemoteOutput.value = Remote Payout - Remote Fee` - `Local Fee = Remote Fee` - `ToLocalOutput`'s script is: @@ -81,7 +80,9 @@ Where - `ToRemoteOutput`'s script is: - OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG + OP_0 + + Which is `P2WPKH(Remote CET Public Key)` ## Refund Transaction ### Known Values @@ -92,17 +93,15 @@ Where * Timeout: `UInt32` * DLC Funding Output: `ScriptPubKey` * Fee Rate: `FeeUnit` - * Output Type: `OutputType` Where - Both `Refund Public Key`s are 33-byte compressed public keys - `Total Local Collateral + Total Remote Collateral = (DLC Funding Output).value` - `DLC Funding Output` is of the form [specified above](#FundingOutputs) - - `Output Type` is one of `Raw`, `P2SH`, `P2WSH`, or `P2SH-P2WSH` ### Global * nLockTime is `Timeout` ### Inputs - * Input Spending(OutputType(DLC Funding Output)) + * Input Spending(P2WSH(DLC Funding Output)) ### Outputs * ToLocalOutput * ToRemoteOutput @@ -113,8 +112,54 @@ Where - `Local Fee / Total Local Collateral = Remote Fee / Total Remote Collateral` - `ToLocalOutput`'s script is: - OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG + OP_0 + + Which is `P2WPKH(Local Refund Public Key)` - `ToRemoteOutput`'s script is: - OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG + OP_0 + + Which is `P2WPKH(Remote Refund Public Key)` + +## Closing Transaction (Unilateral) +### Known Values + * Local Unilateral Public Key: `ECPublicKey` + * nLockTime: `UInt32` + * ToLocalOutput: `ScriptPubKey` + * Fee Rate: `FeeUnit` + +Where + - `ToLocalOutput` is of the form [specified above](#CETOutputs) + - `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) +### Global + * nLockTime +### Inputs + * Input Spending(P2WSH(ToLocalOutput)) +### Outputs + * P2WPKH(Local Unilateral Public Key) + +Where + - `P2WPKH(Local Unilateral Public Key)`'s value is `P2WSH(ToLocalOutput).value - fee` + +## Closing Transaction (Justice) +### Known Values + * Local Justice Public Key: `ECPublicKey` + * nLockTime: `UInt32` + * Remote's ToLocalOutput: `ScriptPubKey` + * Fee Rate: `FeeUnit` + +Where + - `Remote's ToLocalOutput` is of the form [specified above](#CETOutputs) + - `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) +### Global + * nLockTime +### Inputs + * Input Spending(P2WSH(Remote's ToLocalOutput)) +### Outputs + * P2WPKH(Local Justice Public Key) + +Where + - `P2WPKH(Local Justice Public Key)`'s value is `P2WSH(Remote's ToLocalOutput).value - fee`