# Cross-Chain Atomic Swaps

## What Are Cross-Chain Atomic Swaps? <a href="#what-is-an-atomic-swap" id="what-is-an-atomic-swap"></a>

Cross-chain atomic swaps facilitate direct transfers of tokens between different blockchains, operationalizing only when both involved parties deposit a stipulated amount of tokens into the exchange contract. This allows users to exchange tokens without dependency on middlemen, thereby mitigating counterparty risks.

The concept of “Atomicity” refers to the principle where transactions are either executed in their entirety or not executed at all. Following this principle, atomic swaps either successfully conduct the swap when all conditions are met, or refund the deposited tokens to the respective owner.

Most atomic swap-enabled wallets and blockchains use smart contracts. Smart contracts are programs within blockchains that execute when certain conditions are met.

## How Do Atomic Swaps Work? <a href="#how-to-do-an-atomic-swap" id="how-to-do-an-atomic-swap"></a>

Atomic swaps employ a Hashed Time-Locked Contract (HTLC), serving as a cryptographic safeguard or a “virtual safe,” ensuring the security of user funds and triggering only when the contract receives the accurate amount of tokens.

To unlock the tokens, each party involved must confirm the receipt within a designated timeframe.

Most cryptocurrency projects develop their products on a single blockchain, and this limits the project to operating within that ecosystem. This means if there is a project on Ethereum, users need to buy the token on Ethereum blockchain in order to use the product/service.

If a project wants access to other blockchain ecosystems, then they will need to deploy token contracts and smart contracts on those blockchains.

Atomic swaps allow users to transfer native tokens across different blockchains, without middlemen.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.safeswap.io/technical/cross-chain-atomic-swaps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
