Introducing CKBSwap — Building on CKB for the Long Term

Hello, CKB community!

We are FoundationLab, a team of three developers who share a strong belief in CKB and a commitment to building within its ecosystem.

Today, we’d like to introduce CKBSwap, the project we’re working on.

Our goal is straightforward: build a useful, accessible swap and liquidity application that helps turn CKB’s technical potential into something people can use.

What is CKBSwap?

CKBSwap is an exchange and liquidity application built around CKB’s native asset model. It is currently on testnet.

It supports native CKB/xUDT and xUDT/xUDT liquidity pools using constant-product pricing. Users can swap assets, provide liquidity, and withdraw their share of the underlying assets. Liquidity providers receive standard xUDT LP tokens, while a 0.3% trading fee stays in the pool.

The interface follows a clear flow: select your assets, enter an amount, review the quote and slippage, preview the transaction, and sign through your connected wallet. Private keys remain with the wallet, and CKBSwap charges no additional frontend fee.

We see testnet as the beginning of a continuous process of testing, learning, and improvement. Community feedback will help us make each step clearer and more reliable.

Why we chose CKB

The more we learn about CKB, the more we appreciate the thought behind its architecture.

The Cell Model extends UTXO into a flexible foundation for programmable assets and state. Its treatment of ownership and validation gives developers room to rethink how applications can be built around assets that users control.

The RISC-V-based CKB-VM is equally compelling. Building on an open, general-purpose instruction set leaves room for different cryptographic schemes and verification logic to evolve. To us, that is a thoughtful engineering choice with a long horizon.

What stands out is how these decisions fit together. The Cell Model, CKB-VM, and layered architecture reflect a coherent vision for security, flexibility, and lasting utility. We find that combination elegant—and worth committing our time to.

Three people, committed to building

FoundationLab is a small team. All three of us want to contribute through practical work: improving the product, fixing problems, listening to users, and sharing progress the community can evaluate.

Our conviction in CKB comes with a responsibility to build. Strong infrastructure becomes more valuable when developers turn its capabilities into applications people choose to use. We want to play our part in that process.

CKBSwap is our starting point. We intend to keep learning, keep shipping, and grow alongside the CKB community.

We invite you to explore the testnet, share your feedback, and help us improve.

FoundationLab — three builders, starting with CKBSwap, committed to CKB for the long term.

Explore the project: ckbswap.site

7 Likes

太棒了!去年我尝试过一个有些简陋的 bonding curve cell 的demo,现在看到有团队在实现类似的想法、但是是作为真正的消费级产品来做,真的太让人激动了 :+1: 如果能提供更多关于 CKBSwap 的协议原理会对理解你们在做的产品有更大的帮助。比如,我个人会比较感兴趣的问题是,CKBSwap 是用什么原理在 utxo 架构上去做这种 pool 的?是否会有 hot cell 热更新的问题(比如许多人在同一个 pool 中去做swap,这里的并发是怎么处理的)?

2 Likes

Thanks for the encouragement! We’d love to see your bonding-curve cell demo as well. You’re right—a clearer explanation of the protocol would make this introduction much more useful.

CKBSwap currently uses a constant-product AMM, following the familiar Uniswap V2 pricing model, implemented as a state machine over CKB Cells.

How the pool works

Each pool has a state cell recording its asset identifiers, reserves, total LP supply, and a nonce. For a CKB/xUDT pool, the CKB reserve is held directly in the state cell’s capacity, alongside its fixed storage allocation. Each xUDT reserve is held in a separate reserve cell tied to that pool.

A swap consumes the current pool state and reserve cells and creates their successors with updated balances. The on-chain script validates the transition, including the swap calculation, the fee-adjusted constant-product invariant, the user’s asset balance changes, and the specified slippage limits.

The 0.3% trading fee remains in the pool. Liquidity additions and withdrawals follow the same consume-and-recreate pattern, with corresponding LP minting or burning.

The hot cell issue

Yes, contention exists in the current design. If multiple users build swaps against the same pool state, their transactions compete for the same inputs. Once one transaction consumes those cells, the others need to be rebuilt against the updated state, with refreshed quotes and signing as needed.

We’re considering several improvements:

  1. Per-pool queuing to coordinate transaction construction and reduce conflicting submissions.

  2. Chained transactions to build on the outputs of pending transactions, reducing the need to wait for each swap to confirm before submitting the next.

  3. Batch settlement, potentially through an intent-based design, to process multiple user orders within a single pool state transition.

These are directions we’re evaluating, not features already implemented. Queuing and chaining would help coordinate sequential updates, while batch settlement would require changes to the protocol and authorization model.

The contracts and protocol documentation are public here. We’re still on testnet, and feedback on these tradeoffs is very welcome.

Thanks for raising exactly the kind of technical discussion we hoped to have!

1 Like

I think batcher is good. I seen the same model and dex on cardano. minswap.org

2 Likes

great to know that. I think for the production launch, the hot cell issue is a must-fix problem. otherwise people won’t take it seriously. the cardano batcher solution seems practical. thanks @longdevbf

I think DeFi might not be the killer app for CKB, but it definitely is something we need to have, as some sort of ecosystem primitive pieces.

the current UX/UI looks clean, keep the great work!

4 Likes