Smart contracts are central to the idea of creating decentralized communities where wealth and information can be exchanged under predefined terms without centralized intermediaries moderating the exchange.
One type of smart contract that is gaining lots of attention is the Hashed TimeLock Contract (or HTLC).
Hash locks are a type of encumbrance that restricts the spending of cryptocurrency funds until a specified piece of data is publicly revealed. A TimeLock is a type of smart contract that limits the spending of some cryptocurrency funds until a predefined block height or period.
This is a type of smart contract adopted in cryptocurrency channels to remove counterparty risk by enabling transactions to be time-bound. HTLC is often used in Atomic Swaps, which are direct transfers of cryptocurrencies between users without going through intermediaries like centralized exchanges.
The essential function of HTLC is to require the receiver of a payment to acknowledge having received the payment before a deadline.
The received payment is acknowledged by the user generating a cryptographic proof of payment. If the cryptographic proof is not generated, the user forfeits the ability to claim the payment, and the funds are returned to the payer.
Once a cryptographic proof is generated, it triggers the funds to unlock and become available to the recipient.
Hashed Time Lock Contracts Scenario
There are many scenarios in which Hash TimeLock contracts could be used, but the most popular being the exchange of two different cryptocurrencies in a cross chain transaction between anonymous participants.
- Sarah uses her private key to generate a hash and sends it to John on the Litecoin blockchain. Sarah also creates a nominal transaction, which generates a pre-image of the hash. This is done to validate and finalize the transaction.
- John then generates his hash from his private key and sends it to Sarah. John also creates a pre-image through a Litecoin nominal transaction with Sarah.
- Once Sarah receives John’s Litecoin transaction, Sarah uses her original key to sign it. John then signs off on the transaction on his end using his private key to unlock the funds from Sarah.
This process is best illustrated in a previous article on Atomic Swaps. Here, one can also see an illustration of Hash Timelock contracts between three participants:
(Source: Bitcoin Wiki)
Impact on Cryptocurrency Payments
As the previous example explains, HTLC provides many benefits to the
cryptocurrency payments process:
- Time Sensitivity: The time-sensitive nature of the transaction prevents the sender from having to wait forever to find out whether their payment went through. If the time runs out, the funds will just be sent back to the sender, so they don’t have to worry and can wait for the process to unfold.
- Validation of the blockchain: Transactions are validated because of the cryptographic proof of payment required by the receiver.
- Trustless system: As is the case with all smart contracts, trust is not needed as the rules are already coded into the contract itself. Hash TimeLock contracts take this one step further by implementing a time limit for recipients to acknowledge the payment.
- Trading across multiple cryptocurrencies: HTLC makes Cross-chain transactions easier and more secure than ever. Cross chain transactions are the next step in the evolution of cryptocurrency adoption. The easier it becomes to unite the hundreds of blockchains that currently exist in silos, the faster the technology as a whole can begin to scale and achieve mass adoption.
HTLC in Traditional Industries
Beyond making cryptocurrency transactions more secure and trustless, HTLC can also have use cases in more traditional industries such as real estate.
If a real estate company needed to contract a developer within a limited period, they could use hashed TimeLock contracts to send the contractor a down payment once their development plan had been approved.
This would drastically reduce the amount of time needed to complete the transaction by removing all intermediaries from the process.
Hashed Time Lock Contracts and Lightning Network
HTLC is already beginning to see adoption in the Lightning Network, which is a layer two scaling solution for the Bitcoin, Litecoin, and Monero blockchains. Lightning Network provides scalability by bundling smaller transactions “off chain,” and then recording them as one single transaction with many smaller components on chain.
The benefit that HTLC brings to the Lightning Network is that it allows payments to be routed safely through different peer-to-peer payment channels.
This means that users can pay other users without a direct channel opened between them. Together, HTLC and the Lightning Network are complementary solutions that allow the Bitcoin blockchain to not only scale but also achieve cross chain transactions in a trustless environment.
Hash TimeLock Contract challenges
Although HTLC provides many benefits, one of the biggest challenges that HTLC still faces is its unfamiliarity with the public.
A lack of understanding about the purpose and function of cryptocurrencies is still a major hindrance for the industry’s adoption. Even in 2019, a majority of the world’s population is still unfamiliar with what Bitcoin is, and in most developed countries, very few people know about it beyond what they’ve heard from mainstream media. This doesn’t even include the hundred’s of other cryptocurrencies and terms like “smart contract” or “consensus protocol.”
The key to HTLC achieving mainstream utility is in its ability to be simplified to the point where users and businesses can benefit from Hashed TimeLock Contracts without even knowing that they are using them.
This sort of disguised adoption is common across all aspects of technology. Very few people are aware of the underlying protocols that make a Visa debit card function, or even the TCP/IP protocols that are used to interconnect network devices on the Internet. Hash TimeLock contracts can become mainstream in a similarly ubiquitous way. However, it first needs to be adopted by mainstream developer communities.
Fortunately, system architects across major corporations are a lot quicker to acknowledge the benefits of decentralized networks and trustless protocols, which bodes well for HTLC adoption and the growth of the cryptocurrency and blockchain industry as a whole.