HTLC
The basics
A hash time-locked contract (HTLC) locks coins under two conditions.
- The recipient can claim the coins by revealing a secret whose SHA-256 hash matches the lock.
- The owner can reclaim the coins if no one claims them before a specified block height.
Ottereus has HTLCs built in as separate transaction types called lock, claim and refund. HTLCs provide the foundation for atomic swaps.
Limits
A lock can last for at most 30 days of blocks. The secret is exactly 32 bytes long, avoiding a known bug in which two chains interpret secrets of different lengths differently. A small minimum amount ensures that each claim can pay its own gas.