diff --git a/03.md b/03.md new file mode 100644 index 0000000..8dd75d2 --- /dev/null +++ b/03.md @@ -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 _addri = channel address to be established_: +- - Let _to_self_ = _cbytes(pki)_. +- - Let _Qi_, _gacci_, and _tacci_ = _keygen_ctxi_. +- - Let _agg_key_ = _xbytes(Qi)_. +- - 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`]