Bitcoin is starting to mature as a technology; it’s not only housing trillions in value and creating an ever-expanding payment rail network. Bitcoin is also adding new features to improve the network and all projects attached to the network.
Some Bitcoin detractors claim that Bitcoin is old technology, its boomer coin, and it cannot compete with the “innovation” from other sectors. The thirst for innovation blinds people to reality, and the sad truth is, not all innovative ideas have a product-market fit. Sure some projects will race ahead in technological improvements, but as they compete, the best ideas will eventually roll into Bitcoin.
One of those improvements is the hashed time lock contract, a smart contract. HTLC’s enable new feature sets such as side-chains and more.
What is a hashed time lock contract?
A Hashed Timelock Contract (HTLC) is a transactional agreement used on the Bitcoin network to produce conditional payments. It is a payment wherein the receiver or the beneficiary must acknowledge the receipt of payment before a predetermined time or a preset deadline.
The receiver must acknowledge the payment in the form of cryptographic proof of payment, or else, they forfeit the ability to claim that payment.
If forfeited, the funds return to the payee?
What is a hash lock?
A hash lock is a form of a limitation or a restriction that involves capping a cash outflow such as a purchase until a specifically required parameter. A condition needs to be specified and met for funds to release; conditions like some critical data or a highly anticipated transaction is publicly revealed. These conditions are an integral part of the hashed timelock contracts system.
What is a timelock?
A timelock refers to a locking or a restricting mechanism that locks out a transaction or an account until a preset or a predetermined time is not reached. It means that a certain amount of bitcoins or cryptocurrencies will be locked out and will not be spent until a preset or predetermined time is reached.
How do hash lock and timelock combine?
A Hashed Timelock Contract (HTLC) uses several elements from existing Bitcoin transactions. For example, HTLC transactions use multiple signatures, which consist of a private-public key, to verify and validate transactions. But there are two elements that distinguish HTLC from standard Bitcoin transactions or ordinary smart contracts.
How a hashed timelock contract works
The HTLC agreement is named after the fact that it leverages both the hash lock and timelock mechanisms to help settle Bitcoin transactions.
A hash lock is a limiting or restricting mechanism in the form of a cryptographic key generated by the payer or the one who instigates the transaction.
The instigator of the transaction generates a key and hashes it. The hash is then stored until the final transaction is carried out and executed.
A timelock is a locking mechanism used in HTLC agreements. When transactions or contracts are generated using the HTLC system, a set of two timelocks are generated. It is to set two different time constraints on the impending smart contract.
- The first one is called the CheckLockTimeVerify (CLTV) timelock. It sets a base time and locks and releases the Bitcoin.
- The second timelock is called the CheckSequenceVerify (CSV).
It does not lock out the transaction but is instead implemented to keep a check on the number of locks generated. These checks, in turn, helps in determining the finalisation of the transaction.
Advantages of hashed timelock contract
So what are the features that time lock contracts bring to Bitcoin, and why are they important?
Using a hashed timelock contract system ensures time-bound transactions. It guarantees the timely execution of transactions and hence, the timely execution and receipt of payments.
Minimise counterparty risk
The primary advantage of HTLC payment settlements is the fact that it minimises counterparty risk. Its basic function is to minimise counterparty risk by eliminating the “what ifs” of a transaction. It is done by hash locks and timelocks, thereby ensuring that the settlement of a transaction is 100% ensured.
Use cases for HTLC
Now that HTLC’s are available, it allows anyone to plug into the Bitcoin network and create scrips that leverage Bitcoin. These platforms, like wallet providers, can use these HTLC’s to set up services like:
A hashed timelock contract (HTLC) reduces counterparty risk in decentralised smart contracts by effectively creating a time-based escrow.
This type of smart contract requires the receiver of payment to acknowledge it within a certain period or forfeit it.
The lightning network
Using the HTLC system to settle transactions brings the ability to engage in atomic swaps to the table. An atomic swap is a form of smart contract technology that enables the settlement of digital asset transactions without the use of central bodies, exchanges, or intermediaries. It ensures the faster settlement of transactions without any middlemen. The smart contract matches two assets with one another, and as both signs, the assets can trade within Bitcoin wallets.
Bitcoin is getting smarter.
Bitcoin may be slow to adopt technologies in relative terms compared to other projects, but Bitcoin is not a technology play; it is a monetary play. Its goal is to ensure that we have money that is incorruptible and predictable. As the value in the network increases, feature sets need to be considered at length.
Even so, it doesn’t mean Bitcoin isn’t getting more intelligent. With the launch of taproot and the improvement it brings to discrete log contracts, Bitcoin has given developers a range of new feature sets to play around with to improve their products.