You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Messaging.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ All data fields are unsigned big-endian unless otherwise specified.
12
12
*[Connection Handling and Multiplexing](#connection-handling-and-multiplexing)
13
13
*[Message Format](#message-format)
14
14
*[Fundamental Types](#fundamental-types)
15
-
*[Authors](#authors)
15
+
*[Authors](#authors)
16
16
17
17
## Connection Handling and Multiplexing
18
18
@@ -45,8 +45,8 @@ The following convenience types are also defined:
45
45
*`sha256`: a 32-byte SHA2-256 hash
46
46
*`signature`: a 64-byte bitcoin Elliptic Curve signature
47
47
*`point`: a 33-byte Elliptic Curve point (compressed encoding as per [SEC 1 standard](http://www.secg.org/sec1-v2.pdf#subsubsection.2.3.3))
48
-
*`spk`: A bitcoin script public key encoded as ASM prefixed with a CompactSize
49
-
*`short_contract_id`: an 8 byte value identifying a contract (see [BOLT #7](07-routing-gossip.md#definition-of-short-channel-id))
48
+
*`spk`: A bitcoin script public key encoded as ASM prefixed with a Bitcoin CompactSize unsigned integer
49
+
*`short_contract_id`: an 8 byte value identifying a contract funding transaction on-chain (see [BOLT #7](07-routing-gossip.md#definition-of-short-channel-id))
50
50
*`bigsize`: a variable-length, unsigned integer similar to Bitcoin's CompactSize encoding, but big-endian. Described in [BigSize](01-messaging.md#appendix-a-bigsize-test-vectors).
Copy file name to clipboardExpand all lines: Protocol.md
+25-23Lines changed: 25 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,21 +14,22 @@
14
14
15
15
## Definition of `contract_id`
16
16
17
-
Most messages use a `contract_id` to identify the contract. It's
18
-
derived from the funding transaction by combining the `funding_txid`
19
-
and the `funding_output_index`, using big-endian exclusive-OR
20
-
(i.e. `funding_output_index` alters the last 2 bytes).
21
-
22
17
Prior to a contract being accepted, a `temporary_contract_id` is used,
23
18
which is the SHA256 hash of the offer message.
24
19
20
+
Most messages use a `contract_id` to identify the contract. It's
21
+
derived from the funding transaction and the offer by combining the `funding_txid`
22
+
and the `funding_output_index` and the `temporary_contract_id`, using big-endian
23
+
exclusive-OR (i.e. `funding_output_index` alters the last 2 bytes of
24
+
`funding_txid XOR temporary_contract_id`).
25
+
25
26
## Contract Negotiation
26
27
27
28
Contract Negotiation consists of the initiator (aka offerer) sending an `offer_dlc` message,
28
29
followed by the responding node (aka accepter) sending `accept_dlc`. With the
29
30
contract parameters locked in, both parties are able to create the funding
30
31
transaction and subsequently all contract execution transactions (CETs) and the refund transaction, as described in the [transaction specification](Transactions.md). As such, the accepter includes its signatures of the CETs and refund transaction in the `accept_dlc` message.
31
-
The initiator now able to generate signatures for all CETs and the refund transaction, as well as the funding transaction, and send it over using the `sign_dlc` message.
32
+
The initiator is now able to generate signatures for all CETs and the refund transaction, as well as the funding transaction, and send them over using the `sign_dlc` message.
32
33
33
34
Once the accepter receives the `sign_dlc` message, it
34
35
must broadcast the funding transaction to the Bitcoin network.
@@ -59,7 +60,7 @@ funding transaction).
59
60
### The `offer_dlc` Message
60
61
61
62
This message contains information about a node and indicates its
62
-
desire to open a new contract. This is the first step toward creating
63
+
desire to enter into a new contract. This is the first step toward creating
63
64
the funding transaction and CETs.
64
65
65
66
1. type: ??? (`offer_dlc`)
@@ -74,9 +75,9 @@ the funding transaction and CETs.
No bits of `contract_flags` are currently defined, this field should be ignored.
82
83
@@ -99,11 +100,11 @@ the sender and `funding_inputs` contains outputs, outpoints, and expected weight
99
100
of the sender's funding inputs. `change_spk` specifies the script pubkey that funding
100
101
change should be sent to.
101
102
102
-
`feerate_per_vb` indicates the fee rate in satoshi per virtual byte that both
103
+
`feerate_per_kw` indicates the fee rate in satoshi per 1000-weight that both
103
104
sides will use to compute fees in the funding transaction, as described in the
104
105
[transaction specification](Transactions.md).
105
106
106
-
`contract_maturity_cltv` is the CLTV timelock to be put on CETs. `contract_timeout_cltv` is the CLTV timelock to be put on the refund transaction.
107
+
`contract_maturity_bound` is the nLockTime to be put on CETs. `contract_timeout` is the nLockTime to be put on the refund transaction.
107
108
108
109
#### Requirements
109
110
@@ -112,15 +113,15 @@ The sending node MUST:
112
113
- set undefined bits in `contract_flags` to 0.
113
114
- ensure the `chain_hash` value identifies the chain it wishes to open the contract within.
114
115
- set `funding_pubkey` to a valid secp256k1 pubkey in compressed format.
115
-
- set `total_collateral_satoshis` greater than or equal to 1000.
116
-
- set `contract_maturity_cltv` and `contract_timeout_cltv` to either both be UNIX timestamps, or both be block heights as distinguished in [BIP 65](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki).
117
-
- set `contract_maturity_cltv` to be less than `contract_timeout_cltv`.
116
+
- set `total_collateral_satoshis`to a value greater than or equal to 1000.
117
+
- set `contract_maturity_bound` and `contract_timeout` to either both be UNIX timestamps, or both be block heights as distinguished in [BIP 65](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki).
118
+
- set `contract_maturity_bound` to be less than `contract_timeout`.
118
119
119
120
The sending node SHOULD:
120
121
121
-
- set `feerate_per_vb` to at least the rate it estimates would cause the transaction to be immediately included in a block.
122
-
- set `contract_maturity_cltv` to the earliest expected oracle signature time.
123
-
- set `contract_timeout_cltv` sufficiently long after `contract_maturity_cltv` to allow for late oracle signatures and other delays to closing the contract.
122
+
- set `feerate_per_kw` to at least the rate it estimates would cause the transaction to be immediately included in a block.
123
+
- set `contract_maturity_bound` to the earliest expected oracle signature time.
124
+
- set `contract_timeout` sufficiently long after `contract_maturity_bound` to allow for late oracle signatures and other delays to closing the contract.
124
125
125
126
The receiving node MUST:
126
127
@@ -138,9 +139,9 @@ The receiving node MUST reject the contract if:
138
139
- the `chain_hash` value is set to a hash of a chain that is unknown to the receiver.
139
140
- the `contract_info` refers to events unknown to the receiver.
140
141
- the `oracle_info` refers to an oracle unknown to the receiver.
141
-
- it considers `feerate_per_vb` too small for timely processing or unreasonably large.
142
+
- it considers `feerate_per_kw` too small for timely processing or unreasonably large.
142
143
-`funding_pubkey` is not a valid secp256k1 pubkey in compressed format.
143
-
- the funder's amount for the funding transaction is not sufficient for full [fee payment](Transactions.md#fee-payment).
144
+
- the funder's amount for the funding transaction is not sufficient for their full [fee payment](Transactions.md#fee-payment).
144
145
145
146
### The `accept_dlc` Message
146
147
@@ -170,6 +171,7 @@ The sender MUST:
170
171
- set `total_collateral_satoshis` sufficiently large so that the sum of both parties' total collaterals is at least as large as the largest payout in the `offer_dlc`'s `contract_info`.
171
172
- set `cet_signatures` to valid adaptor signatures, using its `funding_pubkey` for each CET, as defined in the [transaction specification](Transactions.md#contract-execution-transaction) and using signature public keys computed using the `offer_dlc`'s `contract_info` and `oracle_info` as adaptor points.
172
173
- include an adaptor signature in `cet_signatures` for every event specified in the `offer_dlc`'s `contract_info`.
174
+
- set `refund_signature` to the valid signature, using its `funding_pubkey` for the refund transaction, as defined in the [transaction specification](Transactions.md#refund-transaction).
173
175
174
176
The receiver:
175
177
@@ -182,11 +184,11 @@ Other fields have the same requirements as their counterparts in `offer_dlc`.
182
184
183
185
### The `sign_dlc` Message
184
186
185
-
This message gives all of the initiator's the signatures, which allows the receiver
187
+
This message gives all of the initiator's signatures, which allows the receiver
186
188
to broadcast the funding transaction with both parties being fully committed to
187
189
all closing transactions.
188
190
189
-
This message introduces the `contract_id` to identify the contract. It's derived from the funding transaction by combining the `funding_txid` and the `funding_output_index`, using big-endian exclusive-OR (i.e. `funding_output_index` alters the last 2 bytes).
191
+
This message introduces the [`contract_id`](#definition-of-contract_id) to identify the contract.
190
192
191
193
1. type: ??? (`sign_dlc`)
192
194
2. data:
@@ -199,7 +201,7 @@ This message introduces the `contract_id` to identify the contract. It's derived
199
201
200
202
The sender MUST:
201
203
202
-
- set `channel_id` by exclusive-OR of the `funding_txid` and the `funding_output_index` from the `offer_dlc` and `accept_dlc` messages.
204
+
- set `contract_id` by exclusive-OR of the `funding_txid` and the `funding_output_index` from the `offer_dlc` and `accept_dlc` messages.
203
205
- set `cet_signatures` to valid adaptor signatures, using its `funding_pubkey` for each CET, as defined in the [transaction specification](Transactions.md#contract-execution-transaction) and using signature public keys computed using the `offer_dlc`'s `contract_info` and `oracle_info` as adaptor points.
204
206
- include an adaptor signature in `cet_signatures` for every event specified in the `offer_dlc`'s `contract_info`.
205
207
- set `refund_signature` to the valid signature, using its `funding_pubkey` for the refund transaction, as defined in the [transaction specification](Transactions.md#refund-transaction).
0 commit comments