Explained: Hashed Timelock Contracts in Blockchain Applications
Source : Gadgets 360
Cryptocurrencies, the unconventional newbie in the world of finance, is laced with hidden or lesser-known features that when put to use, could safeguard funds against losses. One such feature is called the Hashed Timelock Contract (HTLC). An HTLC is a time-bound smart contract, that allows transfers of crypto funds only after the receiving party punches a secret, pre-decided cryptographic passphrase. Deploying an HTLC while finalising a crypto transfer could ensure that no third party can access the funds – keeping the transaction secure.
In order to complete an HTLC transaction, the receiving party must ensure that they log the passphrase within a pre-decided timeframe. If either of these criteria are not met with, the transaction is not processed.
How are HTLCs Deployed?
HTLCs have two primary components – Hashlock and Timelock.
A hashlock, as per a report by Investopedia, is a cryptographically regenerated version of a public key. The party that decided to send the funds gets to generate hashlocks, which eventually act as private keys. Once generated, hashlocks are uploaded in the form of pre-images that later reveal themselves at the time of the financial transaction.
On the other hand, a timelock is used to add the time element to HTLCs. Each HTLC contract has two timelocks to frame the exact period within which the receiving party need to punch in the cryptographed passphrase to facilitate the transaction.
Where do HTLCs Work?
Bitcoin and Ethereum are among several other blockchains that allow HTLC transactions. These kinds of smart contracts make the overall blockchain industry more interoperable by allowing cross-chain transactions without having to involve a centralised exchange, said a report by Faster Capital.
It is however notable, that HTLCs are subject to some vulnerabilities, out of which bribery attacks sit on top of the heap. In bribery attacks, the attacker can extend a higher transaction fee as a favour to blockchain miners to make them access an HTLC transaction unethically.
Another kind of vulnerability that can affect the successful completion of an HTLC contract is the Malleability attack. Here, the attacker can manage to change the transaction ID of the HTLC causing the transaction to fail all together.