Merge pull request #2 from nkohen/patch-1

Funding Fee specification
This commit is contained in:
Nadav Kohen
2020-01-08 09:13:44 -07:00
committed by GitHub

View File

@@ -33,12 +33,12 @@ Where
* Remote Change ScriptPubKey
Where
- `P2WSH(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 + Computed CET Fee + Computed ToLocal Closing Fee`
- `DLC Funding Output`'s script is
OP_2 <Local Funding Public Key> <Remote Funding Public Key> OP_2 OP_CHECKMULTISIG
- Each `Change ScriptPubKey`'s value is at most that of its respective `Sum(Funding Inputs) - Total Collateral - Computed Fees` with `Computed Fees` being equal for both parties
- Each `Change ScriptPubKey`'s value is at most that of its respective `Sum(Funding Inputs) - Total Collateral - Computed Fees - (Computed CET Fee + Computed ToLocal Closing Fee)/2` with `Computed Fees` being proportional to each party's total input weight and `Computed CET Fee` being the estimated fee for a [Contract Execution Transaction](#contract-execution-transaction) and `Computed ToLocal Closing Fee` being the estimated fee for a [Unilateral Closing Transaction](#ClosingUnilateral)
## Contract Execution Transaction
### <a name="CETKnownValues">Known Values</a>
@@ -68,9 +68,8 @@ Where
* ToRemoteOutput
Where
- `P2WSH(ToLocalOutput).value = Local Payout - Local Fee`
- `ToRemoteOutput.value = Remote Payout - Remote Fee`
- `Local Fee = Remote Fee`
- `P2WSH(ToLocalOutput).value = Local Payout + Computed ToLocal Closing Fee`
- `ToRemoteOutput.value = Remote Payout`
- `ToLocalOutput`'s script is:
OP_IF
@@ -99,6 +98,7 @@ Where
* Fee Rate: `FeeUnit`
Where
- Unlike CETs in a DLC, there is only one Refund Transaction that both parties share, similar to how there is only one [Funding Transaction](#funding-transaction)
- 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)
@@ -111,9 +111,9 @@ Where
* ToRemoteOutput
Where
- `ToLocalOutput`'s value is `Total Local Collateral - Local Fee`
- `ToRemoteOutput`'s value is `Total Remote Collateral - Remote Fee`
- `Local Fee / Total Local Collateral = Remote Fee / Total Remote Collateral`
- `ToLocalOutput`'s value is `Total Local Collateral + RefundFeeDelta/2`
- `ToRemoteOutput`'s value is `Total Remote Collateral + RefundFeeDelta/2`
- `RefundFeeDelta = Computed CET Fee + Computed ToLocal Closing Fee - Computed Refund Tx Fee` (note that the Refund Transaction is smaller than any CET)
- `ToLocalOutput`'s script is:
OP_0 <Hash160(Local Refund Public Key)>
@@ -126,10 +126,11 @@ Where
Which is `P2WPKH(Remote Refund Public Key)`
## Closing Transaction (Unilateral)
## <a name="ClosingUnilateral">Closing Transaction (Unilateral)</a>
### <a name="ClosingKnownValues">Known Values</a>
* Local Unilateral Public Key: `ECPublicKey`
* nLockTime: `UInt32`
* Local Payout: `CurrencyUnit`
* ToLocalOutput: `ScriptPubKey`
* Fee Rate: `FeeUnit`
@@ -145,7 +146,7 @@ Where
* P2WPKH(Local Unilateral Public Key)
Where
- `P2WPKH(Local Unilateral Public Key)`'s value is `P2WSH(ToLocalOutput).value - fee`
- `P2WPKH(Local Unilateral Public Key)`'s value is `Local Payout`
## Closing Transaction (Justice)
### <a name="ClosingKnownValues">Known Values</a>