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 from 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 (Miner Extractable Value) issues. 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 the intent-based model as its core, utilizing 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 verification, 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 normal transactions are low enough to be negligible. If a trading pair becomes too popular, a local fee model can be used to isolate its impact on other trading pairs.

UTXOSwap is a crucial infrastructure in the BTC ecosystem, addressing the issues of low 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 the prosperity of the Bitcoin ecosystem.

1

Technical Implementation#

On UTXOSwap, when users perform swap transactions, the process mainly involves the following three 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 blockchain.

The aggregator can utilize various sources of liquidity, including:

  • Directly matched user intents
  • AMM cells (various AMM liquidity pools built on the CKB blockchain)
  • 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 users set a slippage tolerance and select 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 the complex trading needs of users 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 the validation logic related to AMMs, including validating transaction intents, managing assets in liquidity pools, and generating and destroying liquidity tokens.

During the execution of transactions, the AMM cell verifies each transaction intent 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: the user and the liquidity pool. Users can only accept the current price offered by the liquidity pool. From the user's perspective, although this model improves convenience, it sacrifices the possibility of obtaining better execution prices. Users can only choose between the two options. 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 also changes, as AMM liquidity pools become just one option for liquidity provision. If profitable, market makers can directly execute trades based on user intents. Even without market maker matching, if the price of the AMM liquidity pool falls within the user's desired range, the transaction can still be completed smoothly, turning the process into a limit order mode.

UTXOSwap leverages the on-chain verification feature of the UTXO programming model to achieve off-chain matching and on-chain execution, effectively implementing the intent-based hybrid trading model described above. In the future, we will further expand the ability for users to express their intents. For example, we will implement logic similar to Dutch auctions, where prices decrease within a certain range over time, and market makers compete with each other based on their costs. Finally, the AMM can ensure the completion of transactions.

Support for Custom Curves and Fee Rates#

In the AMM model of UTXOSwap, 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 transaction pool offers optional fee rates, allowing different liquidity providers to choose and maximize their returns.

Ultra-Low Gas Fees and 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) of a US dollar, almost negligible. Additionally, thanks to the off-chain calculation feature of UTXOs, the feasibility of user transaction intents can be verified off-chain. If a transaction cannot be executed, it will not be recorded on the blockchain, and users do not need to pay any fees.

On the other hand, thanks to the design of UTXOSwap, users do not need to be aware of the gas fees or the CKB required for state space occupation. Users can pay these costs with any token, and UTXOSwap will automatically convert the tokens and assist users in paying gas fees or creating new cells.

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 their 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 from other mainnet chains such as ETH, Solana, and Tron. If there are corresponding asset collaboration scenarios in the future, such as cross-chain transactions 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.