HTLC
Learn about atomic swaps, the secure cross-chain transaction mechanism powered by Hashed Time Lock Contracts (HTLCs). Understand core methods, security features, and cross-chain coordination.
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
Universal Compatibility
Any chain that supports Sha256 hashing and Relative TimeLocks can be added to Garden.
Timelock Safety
Funds can always be recovered if the counterparty doesn’t participate within the specified timeframe.
Address Authorization
Only designated parties can claim funds, preventing unauthorized access.
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:
- Initiator locks funds on Chain A with sha256(preimage)
- Redeemer locks funds on Chain B with the same sha256(preimage)
- Initiator redeems on Chain B by revealing the preimage
- 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.