banner
CKB 中文

CKB 中文

CKB 是理想的比特币 Layer 2

UTXOSwap Whitepaper: Defining a New Paradigm for Bitcoin Finance Transactions

UTXOSwap Overview#

UTXOSwap is a decentralized exchange (DEX) protocol based on the BTC ecosystem. It aims to provide users with a better trading experience and better execution prices through intent-based trading. Currently, UTXOSwap supports trading of assets in the RGB++ and CKB ecosystems, and will expand to support other BTC ecosystem assets such as Runes in the future.

The common types of DEXs are order book and automated market maker (AMM). Order book DEXs are limited by the high cost of on-chain transactions and have not achieved the same success as centralized exchanges. AMMs, on the other hand, have gained wider recognition due to their simple and direct trading concept. However, as on-chain transaction volume and liquidity increase, the limitations of AMMs become apparent, such as inefficiency, gas fee competition, and MEV exploitation. As a result, intent-based trading models have emerged, combining the advantages of order book and AMM to maximize the experience and benefits for users and liquidity providers. UTXOSwap adopts an intent-based model as its core, leveraging the advantages of UTXO programming to design a new type of DEX.

Thanks to the characteristics of UTXOs, UTXOSwap has many innovations and advantages. In terms of trading mode, UTXOSwap can achieve off-chain matching and on-chain validation, allowing access to liquidity providers beyond AMMs during the matching phase. In terms of performance, the parallel nature of UTXOs allows for significantly improved transaction efficiency. In terms of gas fees, no gas fees are incurred for unsuccessful intents, and gas fees for successful intents are low enough to be negligible. If a trading pair becomes too popular, a local fee mode can be used to isolate its impact on other trading pairs.

UTXOSwap is a crucial infrastructure in the BTC ecosystem, addressing the issues of poor liquidity and high transaction costs. It reduces the cost of asset issuance and trading while providing more opportunities for innovation. UTXOSwap aims to explore the unique features of Bitcoin Finance based on the UTXO model and become the liquidity infrastructure of the Bitcoin ecosystem, promoting its prosperity.

1

Technical Implementation#

On UTXOSwap, when users engage in swap transactions, there are three main steps:

  1. Intent Expression: Users express their trading intent by signing a message that includes the asset type, amount, and other parameters.
  2. Aggregation and Matching: The aggregator collects all user intents, searches for on-chain and off-chain liquidity resources, and matches intents.
  3. Transaction Submission: The aggregator assembles all eligible transactions and submits them to the chain.

The aggregator can utilize various liquidity sources, including:

  • Directly matched user intents
  • AMM cells (various AMM liquidity pools built on the CKB chain)
  • Liquidity provided by third-party market makers

Intent Cell#

The intent cell is used to record the user's trading intent and ensure that it meets specific conditions when consumed. For AMM operations, intents can be categorized into three types: Swap, AddLiquidity, and RemoveLiquidity.

When using UTXOSwap, users need to initiate a CKB transaction and record their trading intent in the intent cell. For example, when a user sets a slippage tolerance and selects a specific liquidity pool for trading, these parameters will be written into the intent cell. When the intent cell is unlocked, the script verifies whether the assets returned to the user in the outputs meet the slippage requirements and checks if the specified liquidity pool cell is included.

2

The intent cell supports various types of transactions. In addition to standard swap transactions, it will also support limit orders and twap (time-weighted average price) transactions. This allows UTXOSwap to meet complex trading needs and enhance strategy flexibility. By precisely setting the parameters in the intent cell, users can control the conditions and timing of transaction execution to optimize efficiency and results.

Bitcoin also has a unique feature of supporting Partially Signed Bitcoin Transactions (PSBT), which allows multiple parties to participate in building the same transaction through partial signatures. In CKB, the corresponding PSBT extension is Open Transaction. After integrating Open Transaction into UTXOSwap, users can directly build transaction intents through off-chain signatures, while others can fulfill these intents by adding inputs and outputs. This provides a better trading experience.

AMM Cell#

The AMM cell is responsible for all validation logic related to AMMs, including validation of intent transactions, management of assets in liquidity pools, and generation and destruction of liquidity tokens.

During the execution of transactions, the AMM cell verifies each intent transaction to ensure that user demands are met. It also checks whether the changes in the liquidity pool strictly follow the predefined AMM curve to ensure the security of the entire pool.

Product Advantages#

Intent-based Hybrid Trading Model#

In traditional AMM trading models, each transaction involves only two roles: users and liquidity pools. Users can only accept the current quotes from the liquidity pool. From the user's perspective, although this model improves convenience, it sacrifices the possibility of obtaining better execution prices, and users can only make trade-offs between the two. From the market maker's perspective, passive market-making in liquidity pools incurs impermanent loss and loses pricing power, while active trading introduces uncertainties such as slippage and MEV.

To address these issues, the intent-based trading model has emerged. In this model, users are no longer passive recipients of prices but actively express their trading intents, such as "swap 10 A Tokens for at least 20 B Tokens." The supply side of liquidity has also changed, where AMM liquidity pools are just one option for liquidity supply. If profitable, market makers can directly match trades based on user intents. Even without market maker matching, if the prices in the AMM liquidity pool align with the user's intent range, the transaction can be successfully completed, turning the process into a limit order mode.

UTXOSwap leverages the on-chain validation feature of the UTXO programming model to achieve off-chain matching and on-chain execution, effectively implementing the intent-based hybrid trading model mentioned above. In the future, we will further expand the user's ability to express intents, such as implementing logic similar to Dutch auctions, where prices decrease within a certain range over time, and market makers compete based on their costs, with AMMs providing guaranteed execution.

Support for Custom Curves and Fee Rates#

In UTXOSwap's AMM model, creators of trading pairs can customize the pricing curves based on the characteristics of the assets. For example, curve-type curves can be used for stablecoin trading pairs. In addition, the trading pool offers optional fee rates, allowing different liquidity providers to freely choose and maximize their earnings.

Ultra-Low Gas Fees, Payment with Any Token#

The gas fee cost for a single UTXOSwap transaction is approximately 1/10000 CKB, which, based on the current CKB price, is less than 0.000002 (two-millionths) USD, almost negligible. Additionally, thanks to the off-chain feasibility verification of user intents in UTXOSwap, if a transaction cannot be executed, it will not be included on-chain, and users do not need to pay any fees.

On the other hand, due to the design of UTXOSwap, users do not need to be aware of the gas fees or the CKB required for state space usage. Users can pay these costs with any token, and UTXOSwap will automatically convert the tokens and assist with gas fee payment or new cell creation.

Compatible with Multi-Chain Wallets, Seamless L1/L2 Operations#

UTXOSwap users do not need to download and use a dedicated CKB wallet. Instead, they can directly use familiar BTC wallets to perform L1/L2 leaps, L2 transactions, transfers, and other operations. In terms of user experience, a BTC address corresponds to a fixed CKB address, and the control of the CKB address belongs solely to the BTC address. This correspondence is at the chain level, so in other CKB applications compatible with multi-chain wallets, the same BTC address will correspond to the same CKB address.

In addition to BTC, UTXOSwap's technical implementation can also support popular wallets of other mainnet chains such as ETH, Solana, and Tron. If there are corresponding asset collaboration scenarios in the future, such as cross-chain between CKB and Solana, we will also provide support for the corresponding wallets.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.