TLDR;
CKB can work as a gateway of cross-chain DEX to enable decentralized, trustless, and automated cross-chain swaps without requiring intermediaries.
The gateway operates based on three fundamental principles:
- Virtual Vault backed by HTLCs to ensure that swaps either complete fully or funds are safely refunded, eliminating counterparty risk;
- On-chain Swap Intention cells posted on CKB with swap terms defined. These cells act as open invitations for solvers;
- Solver-driven Execution, independent LP(called solver in this context) scan for intention cells, compete to offer the best execution, fulfill the swap, and submit proof to finalize the trade;
- Insurance fund serves as a backstop LP, ensuring swaps are always available even when solvers are scarce.
The entire process is permissionless, with no need to trust a central party. CKB acts as the coordination layer, verifying swap conditions through SPV proof from source and target chains.
Why it matters?
This system unlock significant benefits for different stakeholders:
- Users: Easily swap assets across chains without relying on centralized exchanges, funding pools, or custodial bridges. Funds are always protected;
- Solvers: Earn fees by executing swap efficiently. They were MEV in other system, but they act as Liquidity Providers here;
- CKB: Expand CKB’s role as a universal coordination layer for cross-chain DeFi.
Kindly note that this system also facilitate on-chain swaps without requiring a funding pools.
This system design uses a combination of cryptographic protocols and CKB’s unique cell model to facilitate cross-chain swaps. Key components of the architecture includes HTLCs for safety, SPV proof for cross-chain verification, on-chain intention cells for declaring swap orders, a mechanism for solvers selection/execution and an insurance fund as a backup.
Below is an overview of each component and how they interact to enable seamless cross-chain swaps on CKB:
Hash Time-Lock Contracts
In the system, when a user initiates a swap, their asset is locked under an HTLC condition. It works as a virtual vault, and only be released when the swap is fulfilled or the timelock expires. This ensures solvers to be rewarded when they act as expected or users to be refunded when the swap request expires or is canceled.
Intention Cells
When a user wants to perform a swap, they deposit funds into the virtual vault, and create intention cells on CKB(provided by the system) with swap terms declared. These cells contain the details of the swap, for example “Swap M amount of Asset A on Chain X for N amount of asset B on Chain Y”, ‘X CKB should be pledged’.
These intention cells serve as on-chain orders that are waiting to be fulfilled by someone. It’s designed as an ownerless cell so any third party can claim the order with a pledge and a hash of execution.
We can introduce bids competition in the future so solvers should provide the most competitive solution based on conditions as fulfillment time, cost efficiency
When an intention cell is claimed, it becomes temporarily locked and can only be updated by the designated solver, who is going to provide a proof of execution on the target chain. If the solver fails to fulfill the swap within the given timeframe, the intention cell will be reopened for other solvers.
Once the execution is completed on the target chain, the solver’s beneficiary information is recorded in the intention cell, triggering the release of funds from the virtual vault to the designated recipient.
Finally, the intention cell is resolved using a proof of virtual vault closure, at which point the solver’s pledged collateral(minus system fee) is returned.
SPV Proof Verification
To coordinate swaps across different chains, this system uses SPV proofs to validate cross-chain events in a trustless manner.
Whenever a critical action happens on a source chain or target chain, a proof of that transaction can be submitted to CKB to update the intention cell.
Insurance Fund
The insurance fund is a reserve pool that serves as a liquidity provider of last resort and a safety net for the system.
It steps in and fulfills a swap intention if no solver picks it up within a reasonable time especially when the solver marketplace is not so prosperous.
Additionally, it covers reimbursement in edge cases,
The source of the insurance fund is from:
- part of system’s income;
- pledge slashed from timeout orders
Economic Model
The economic model is designed to incentivize participation, and sustainably fund the system’s operation. Key aspects are solver incentives, collateral requirements, as well as fee structure that distribute rewards and funds the insurance mechanism:
- Solvers essentially act as arbitrageurs between 2 virtual liquidity pools on the source and target chains, profiting from price differences while facilitating cross-chain swaps.
- Collateral and Slashing - to align incentives, solvers must lock collateral in the claimed intention cell, set by the client and typically proportional to the trade volume. This collateral serves as a security bond - if a solver fails to complete the swap or acts maliciously, the system will slash the collateral, reimbursing the client first and directing the remainder to the insurance fund.
- System Fee, a small system fee is deduct from the collateral when an intention cell is resolved. This fee compensates system operators for maintaining the network and covers the cost of renting CKB required to create and store intentions.
This model is crafted so that all parties benefit: users get a valuable service (cross-chain liquidity without relying on centralized exchange, funding pools, custodial bridges), solvers arbitrage from on-chain trades and the system itself accrues fees to maintain long-term viability.
This gateway enables users to access cross-chain liquidity while enhancing LP/solver capital efficiency. More importantly, it is built on a fully decentralized architecture and has the potential to become a cornerstone of the DeFi in the future.