Atomic Swap
KRC-20 integrates an Atomic Swap protocol to enable peer-to-peer exchange between Layer-1 KAS and KRC-20 tokens. The protocol does not rely on centralized matching, custody, or bridge trust assumptions. Instead, both parties complete the exchange on-chain with atomic semantics — the transfer either settles for both sides simultaneously or fails for both — thereby providing fully decentralized settlement and delivery at the protocol layer.
Atomic Swap is built on PSKT (Partially Signed Kaspa Transaction) technology. The core mechanism operates as follows: the seller creates a KRC-20 token sell order. The order is bound by the protocol to a seller-controlled P2SH address and its corresponding UTXO. The seller then partially signs the pricing and key order parameters, ensuring the order carries verifiable funding constraints and an unforgeable ownership relationship. The buyer submits the corresponding KAS buy transaction on Layer-1 by completing the seller-constructed transaction data, finalizing the signatures, and broadcasting the transaction. This atomic process synchronizes KAS payment with KRC-20 token delivery, ensuring that settlement and transfer occur simultaneously.

Through the combined use of PSKT and P2SH script constraints, an order cannot be independently replayed without the seller’s UTXO, the buyer cannot extract tokens without satisfying the seller’s signature conditions, and the seller cannot withhold token delivery after receiving KAS. As a result, Atomic Swap enables real-time, trustless, and secure exchange and serves as a foundational module for asset trading and cross-layer liquidity within the KRC-20 ecosystem.
Last updated