|
A Hash Time Lock Contract (HTLC) is a cryptographic method used to enable trustless asset transactions across different blockchains. For example, a transaction between my BTC and your ETH can be achieved using a hash lock to ensure the atomicity of the trade.
The principle behind it is roughly as follows: User A generates a random number 's' and calculates the hash value of this random number, 'h = hash(s),' which is then sent to User B. A and B lock their respective assets in a smart contract. A publicly reveals 's' to claim the assets locked by B, and B also acquires 's' to claim the assets locked by A. If a predefined time limit is exceeded, and A fails to reveal 's,' the assets locked in the smart contract will automatically be refunded to both parties. |
|