Atomic swaps are decentralized and trustless trades between two users of different cryptocurrencies. They involve each party paying into a contract transaction, one contract for each blockchain. The contracts contain an output that is spendable by either party, but the rules required for redemption are different for each party involved.
One party (called counterparty 1 or the initiator) generates a secret key and sends the intended trade amount into a smart-contract. The second party (called counterparty2 or the participant) can only redeem the funds by knowing the secret key. If a pre-determined period of time (typically 48 hours) expires after the smart-contract transaction has been mined or staked and the funds have not been redeemed by the participant, the funds can be refunded back to the initiator's wallet.
On-Chain Atomic Swaps