> ## Documentation Index
> Fetch the complete documentation index at: https://garden-e60e7dd0-chore-update-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# HTLCs

> Atomic swaps enable secure cross-chain swaps using Hashed Time Lock Contracts (HTLCs)

HTLCs 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:

<CardGroup cols={2}>
  <Card title="Initiate" icon="play">
    Start the cross-chain swap by depositing funds into the HTLC on the source chain.
  </Card>

  <Card title="Redeem" icon="check">
    Complete the cross-chain swap by redeeming funds from the HTLC on the destination chain.
  </Card>

  <Card title="Refund" icon="rotate-left">
    Get your funds refunded on the source chain, if swap does not happen within the settlement window.
  </Card>

  <Card title="Instant refund" icon="bolt">
    Cancel the swap and get an instant refund on the source chain during the settlement window.
  </Card>
</CardGroup>

## Security features

<Steps>
  <Step title="Universal compatibility">
    Any chain that supports SHA256 hashing and Relative Timelocks can be added to Garden.
  </Step>

  <Step title="Timelock safety">
    Funds can always be recovered if the counterparty doesn't participate within the specified timeframe.
  </Step>

  <Step title="Address authorization">
    Only designated parties can claim funds, preventing unauthorized access.
  </Step>

  <Step title="Atomic execution">
    The swap either completes fully on both chains or fails completely.
  </Step>
</Steps>

## 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

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