Atomic swaps enable secure cross-chain transactions using Hashed Time Lock Contracts (HTLCs). These contracts ensure that either both parties complete the swap or both get their funds back - no party can be cheated.

Universal Concepts

Regardless of the blockchain, all atomic swap implementations share these core methods:

Initiate

Start the cross-chain swap by depositing funds into the HTLC on the source chain.

Redeem

Complete the cross-chain swap by redeeming funds from the HTLC on the destination chain.

Refund

Get your funds refunded on the source chain, if swap does not happen within the settlement window.

Instant Refund

Cancel the swap and get an instant refund on the source chain during the settlement window.

Security Features

1

Universal Compatibility

Any chain that supports Sha256 hashing and Relative TimeLocks can be added to Garden.

2

Timelock Safety

Funds can always be recovered if the counterparty doesn’t participate within the specified timeframe.

3

Address Authorization

Only designated parties can claim funds, preventing unauthorized access.

4

Atomic Execution

The swap either completes fully on both chains or fails completely.

Cross-Chain Coordination

The preimage revealed when redeeming on one chain can be used to claim funds on the other chain. This creates the atomic property:

  1. Initiator locks funds on Chain A with sha256(preimage)
  2. Redeemer locks funds on Chain B with the same sha256(preimage)
  3. Initiator redeems on Chain B by revealing the preimage
  4. Redeemer uses the revealed preimage to claim funds on Chain A

Both implementations use the same cryptographic primitives and security model, but differ in their execution environments and technical approaches.