@@ -65,3 +65,51 @@ Phases:
6565 | | | | | |
6666 '--------------------' '--------------' '---------------'
6767```
68+
69+ ### Standard Loop-In (on -> off-chain)
70+
71+ The reverse of a Loop-Out. The client sends funds to an on-chain HTLC which is
72+ a 2/2 MuSig2 address with a tapleaf which the server can use to sweep the funds
73+ in case the server has the preimage. Once the server detects that the HTLC
74+ transaction is confirmed, it pays the Lightning invoice provided by the client
75+ to "loop in" the funds to their node's channels and then sweeps the HTLC. The
76+ client cooperates with the server to cosign the sweep transaction to save on
77+ onchain fees.
78+
79+ ### Instant Loop-Out
80+
81+ A faster, more efficient Loop-Out that prioritizes a cooperative path, built on
82+ ** Reservations** (on-chain UTXOs controlled by a 2-of-2 MuSig2 key between the
83+ client and server).
84+
85+ 1 . ** Cooperative Path ("Sweepless Sweep"):** After the client pays the
86+ off-chain swap invoice, the client and server cooperatively sign a
87+ transaction that spends the reservation UTXO directly to the client's final
88+ destination address. This avoids publishing an HTLC, saving fees and chain
89+ space.
90+
91+ 2 . ** Fallback Path:** If the cooperative path fails, the system falls back to
92+ creating a standard on-chain HTLC from the reservation UTXO, which is then
93+ swept by the client. This ensures the swap remains non-custodial.
94+
95+ ### Static Address (for Loop-In)
96+
97+ Provides a permanent, reusable on-chain address for receiving funds that can
98+ then be swapped for an off-chain Lightning payment.
99+
100+ - ** Address Type:** The address is a P2TR (Taproot) output with two spending
101+ paths:
102+ 1 . ** Keyspend Path (Cooperative):** The internal key is a 2-of-2 MuSig2
103+ aggregate key held by the client and server. This path is used to
104+ cooperatively sign transactions for performing a Loop-In or withdrawing
105+ funds.
106+ 2 . ** Scriptspend Path (Timeout):** A tapleaf contains a script that allows
107+ the client to unilaterally sweep their funds after a CSV timeout. This
108+ is a safety mechanism ensuring the client never loses access to their
109+ deposits.
110+
111+ - ** Loop-In Flow:** When a user wants to loop in funds from this address, the
112+ client and server use the cooperative keyspend path to create and sign an
113+ HTLC transaction, which then follows a standard Loop-In flow. When the
114+ client gets the LN payment, they cooperate with the server to sweep the
115+ deposit directly to the server's wallet instead of publishing the HTLC tx.
0 commit comments