mirror of
https://github.com/bits-wallet/specs.git
synced 2025-12-17 05:34:21 +01:00
Create 03.md
This commit is contained in:
65
03.md
Normal file
65
03.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
BDS-03 Base Channel Formation
|
||||||
|
======
|
||||||
|
`draft` `mandatory` `author:brqgoo`
|
||||||
|
|
||||||
|
This BDS defines the channel formation protocol for crediting channel addresses.
|
||||||
|
|
||||||
|
## Channel Establishment
|
||||||
|
|
||||||
|
+-------+ +-------+
|
||||||
|
| |--(1)--- request_base_form ----->| |
|
||||||
|
| |<-(2)-- accept_base_form ----- | |
|
||||||
|
| CLI | | LSP |
|
||||||
|
| |--(3)--- refund_state_sig ----->| |
|
||||||
|
| |<-(4)-- credit_base ----- | |
|
||||||
|
+-------+ +-------+
|
||||||
|
|
||||||
|
### The `request_base_form` Message
|
||||||
|
|
||||||
|
This message contains information about the channel address outpoint info for which the user wants to be credited by the LSP.
|
||||||
|
|
||||||
|
- For _addr<sub>i</sub> = channel address to be established_:
|
||||||
|
- - Let _to_self_ = _cbytes(pk<sub>i</sub>)_.
|
||||||
|
- - Let _Q<sub>i</sub>_, _gacc<sub>i</sub>_, and _tacc<sub>i</sub>_ = _keygen_ctx<sub>i</sub>_.
|
||||||
|
- - Let _agg_key_ = _xbytes(Q<sub>i</sub>)_.
|
||||||
|
- - Let _secnonce_, _pubnonce_ = _NonceGen(to_self, agg_key)_.
|
||||||
|
- - Let `child_key_cli` = _bytes(32, to_self)_.
|
||||||
|
- - Let `public_nonce_cli` = _bytes(32, pubnonce)_.
|
||||||
|
|
||||||
|
`request_base_form` payload:
|
||||||
|
* [`32*byte`:`channel_addr_prevout`]
|
||||||
|
* [`u64`:`channel_addr_vout`]
|
||||||
|
* [`32*byte`:`child_key_cli`]
|
||||||
|
* [`32*byte`:`public_nonce_cli`]
|
||||||
|
|
||||||
|
### The `accept_base_form` Message
|
||||||
|
|
||||||
|
|
||||||
|
- - Let _to_self_ : 32-byte x-only well defined LSP key.
|
||||||
|
- - Let _to_remote_ : `child_key_cli` from `request_base_form` message.
|
||||||
|
- - Let _keygen_ctx_ = _KeyAgg([to_self, to_remote])_.
|
||||||
|
- - Let _Q_, _gacc_, and _tacc_ = _keygen_ctx_.
|
||||||
|
- - Let _agg_key_ = _xbytes(Q)_.
|
||||||
|
- - Let _secnonce_, _pubnonce_ = _NonceGen(to_self, agg_key)_.
|
||||||
|
- - Let `public_nonce_lsp` = _bytes(32, pubnonce)_.
|
||||||
|
|
||||||
|
`accept_base_form` payload:
|
||||||
|
* [`32*byte`:`channel_addr_prevout`]
|
||||||
|
* [`u64`:`channel_addr_vout`]
|
||||||
|
* [`32*byte`:`public_nonce_lsp`]
|
||||||
|
|
||||||
|
### The `refund_state_sig` Message
|
||||||
|
|
||||||
|
|
||||||
|
`refund_state_sig` payload:
|
||||||
|
* [`32*byte`:`channel_addr_prevout`]
|
||||||
|
* [`u64`:`channel_addr_vout`]
|
||||||
|
* [`32*byte`:`half_sig_cli`]
|
||||||
|
|
||||||
|
### The `credit_base` Message
|
||||||
|
|
||||||
|
|
||||||
|
`credit_base` payload:
|
||||||
|
* [`32*byte`:`channel_addr_prevout`]
|
||||||
|
* [`u64`:`channel_addr_vout`]
|
||||||
|
* [`32*byte`:`half_sig_lsp`]
|
||||||
Reference in New Issue
Block a user