Technical Implementation
Security Model
- Pre-Signed Transactions: Minimizes user intervention while maintaining security.
- Time-Lock Mechanism: Ensures funds can always be claimed by the rightful owner.
- Atomic Execution: Prevents partial swaps and asymmetric risks.
HTLC Deployment Process
Step 1: Swap Initialization
- User requests a price quote from the Liquidity Node
- Upon acceptance, Liquidity Node generates
SECRET_XandHASH(SECRET_X) - User receives pre-signed claim transaction for future redemption
Step 2: Contract Deployment
-
Liquidity Node HTLC:
- Deploys on
ChainOut - Contains
HASH(SECRET_X),AmountOut,LOCKTIME_1 - Monitored for confirmation
- Deploys on
-
User HTLC:
- Created on
ChainIn - Matches
HASH(SECRET_X) - Sets
LOCKTIME_2whereL2 < L1 - Broadcast by Liquidity Node
- Created on
Locktime Considerations
Why L1 >> L2?
Setting LOCKTIME_1 (L1) > LOCKTIME_2 (L2) ensures that the swap process remains atomic and secure. The reasoning behind this is as follows:
- Ensures Claimability: Since the Liquidity Node must reveal
SECRET_XonChainInfirst, the user is guaranteed to be able to claim funds onChainOut. - Prevents Asymmetric Execution: If
L1andL2were reversed, the Liquidity Node could claimTOKEN_OUTwithout fulfilling their obligation onChainIn. - Atomicity Guarantee: The structure ensures that either the swap is fully executed, or both parties retrieve their original assets after expiration.
Claim Process and Settlement
Liquidity Node Claims
- Waits for
USER_HTLC_CHAIN_INconfirmation - Reveals
SECRET_Xto claimTOKEN_IN - Transaction automatically executes if hash matches
User Claims
SECRET_Xbecomes public onChainIn- Liquidity Node broadcasts pre-signed claim
- User can manually claim if needed using revealed
SECRET_X
Fail-Safe Design
- If Liquidity Node fails to claim before
L2, user reclaims funds - Pre-signed transactions minimize manual intervention
- Automatic fallback ensures fund safety
Transaction Flow Summary
-
Initialization
- User requests swap
- Price quote provided
- Secret generation and commitment
-
Contract Deployment
- Liquidity Node deploys HTLC on
ChainOut - User creates matching HTLC on
ChainIn - Both contracts use same
HASH(SECRET_X)
- Liquidity Node deploys HTLC on
-
Claim Process
- Liquidity Node reveals secret on
ChainIn - User claims funds on
ChainOut - Automatic reversion if unclaimed
- Liquidity Node reveals secret on
