DotSwap
Search
K

BRC20 AMM

About the AMM (Automated Market Maker) and how it works on DotSwap.
It is certainly difficult to build a "BRC20 native AMM DEX" as of now, since its at-best 10 minute block time would greatly hinder the performance and user experiences. Imagine having to wait 10 minutes for your previously submitted transaction to go through, only to be front-run because some other transaction paid more network fees, all the while paying for additional inscribing fees because you wish to sell only a portion of your BRC20 balance. This is the status quo of the current BRC20 markets/existing DEX.

DotSwap V2

With DotSwap's newest BRC20 swap protocol — DotSwap V2, which utilizes elegantly designed PSBTs and a secure asset pool, we are able to achieve:
BTC-native BRC20 AMM swap.
Swap BTC/BRC20 and BRC20/BRC20 trading pairs strictly on BTC and adhering to the BRC20 protocol.
Fully on-chain BRC20 swap transactions.
Every transactions are recorded on-chain, instead of recorded off-chain an or periodically on-chain with roll-ups.
Minimized front-running risks
The exchange prices of a trading pair is calculated at the time of the swap request using the amount of BTC and BRC20 assets in the asset pool. This help ensure that each swap transactions are constructed and broadcasted in the order of the swap requests, which then further minimizes the risk of transactions being front-run by mempool-watching bots.
Swap transactions goes through in the same block.
With pre-constructed PSBTs, the process of swapping BTC/BRC20 tokens to BRC20 tokens, which normally would require several steps and maybe multiple blocks, can be put in the same block using a transaction chain. This reduces the wait time of a transaction to only 1 block in an ideal situation.

PSBTs and Network Fees

There are three types of PSBTs that are used by DotSwap V2 and will be signed by the swapper and the asset pool when swapping.

Swapping from BRC20 to BTC

1 transaction network fees, same block:
  • TX1: Swappers send Transferable BRC20 to asset pool, asset pool sends BTC to swappers.

Swapping from BTC to BRC20

3 transaction network fees, same block:
  • TX1: Swappers send BTC to asset pool.
  • TX2: Asset pool inscribes the BRC20 Transfer inscriptions for itself to make them transferable.
  • TX3: Asset pool sends BRC20 Transfer inscriptions to swappers.

Swapping from BRC20 to BRC20

3 transaction network fees, same block:
  • TX1: Swappers send BRC20 to asset pool.
  • TX2: Asset pool inscribes the BRC20 Transfer inscriptions for itself to make them transferable.
  • TX3: Asset pool sends BRC20 Transfer inscriptions to swappers.