Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions Transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand All @@ -97,6 +96,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)
Expand All @@ -109,9 +109,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)>
Expand All @@ -124,10 +124,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`

Expand All @@ -143,7 +144,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>
Expand Down