A cross-chain atomic swap provides the ability to swap coins between two different blockchains, such as BTG and BTC.
This means holders can trustlessly trade directly with each other. (Trustlessly means they don’t need to trust each other to make the trade.)
An example, using imaginary coins:
If Adam has 1 KiloCoin and Becky has 10 DeciCoin, and they agree that 1 KiloCoin and 10 DeciCoin are equal in value, and they want to trade, a cross-chain atomic swap would look like this:
Adam gives 1 KiloCoin to Becky on the KiloCoin chain, in a special “swap contract.”
Becky gives 10 DeciCoin to Adam on the DeciCoin chain, in a special “swap contract.”
The contracts don’t “release” the coins to Adam and Becky unless they see that both transfers on both blockchains are ready and irreversible; otherwise, they’ll both revert.
This makes the coin swap “atomic” - which just means all-or-none. An atomic swap will either be complete for both sides at once, or it won’t happen at all - it can’t execute “halfway.”
Without an atomic swap, either Adam or Becky would need to send their coins first… and whoever sends first is at risk of being cheated if the other party doesn’t send the promised coins.