Hash timer contract

From Decimal Wiki
Jump to navigation Jump to search

Hash timer contract (also known as Hashed timelock contract, or HTLC) is a type of smart contract in cryptocurrencies to eliminate the counterparty and the risk associated with it. This allows for time-bound transactions.

In practical terms, this means that the recipients of the transaction must certify the payment by creating a cryptographic confirmation within a certain period of time. Otherwise, the transaction will not take place.

HTLC uses several elements from existing cryptocurrency transactions, but there are two of them that distinguish HTLC from standard cryptocurrency transactions.

The first is a "hash lock". This is an encrypted version of the cryptographic key created by the initiator of the transaction. It is used to unlock the original hash. In HTLC, the initiating party generates a key and hashes it. The hash is stored in a preview image, which is subsequently revealed during the last transaction.

The second important element of HTLC is "temporary blocking". To set time limits for contracts created using HTLC, two different locks are applied:

  • CheckLockTimeVerify (CLTV). Uses a temporary base for blocking and unblocking cryptocurrencies. This means that the time limits are rigidly programmed by the parties to the transaction and coins are issued only at certain times and dates or from a certain height of the block size.
  • CheckSequenceVerify (CSV). This lock is not time-dependent, but instead uses the number of blocks generated as a measure to keep track of when to complete a transaction. Using HTLC eliminates the need for trust, because the contract creates a specific set of rules that prevent partial execution of an atomic swap.

See also