- Why Are Hash Time Locked Contracts (HTLCs) Important?
- The Pitfalls of Physical Commodities and Bank-held Fiat Money
- Time-bound Conditional Payments and the Internet of Money
- How Do Hash Time Locked Contracts (HTLCs) Work?
- What are Hash Time Locked Contracts (HTLCs)?
Share This Hash Time Locked Contracts (HTLC) Infographic On Your Site
In the past, it was difficult for people to both own and program money. Traditional forms of money could enable one or the other, but not both simultaneously.
For example, commodities like gold are tangible forms of money. People could own and custody them on their own.
But is it possible to program physical assets like gold?
To an extent, yes. There are vaulting and storage providers who offer web portals for users to programmably move “their” gold. But this programmability requires third party custody of gold bullion. So the users are not really in control of their gold.
Likewise, initiatives like PSD2 grant people programmable access to money held in banks. But given their control over customer money, the banks are really the ones who have the final say. Banks can confiscate their customers’ money and restrict programmable access as they see fit.
Systems that operate with these forms of money always require third party custody and arbitration. As a result, inefficient manual processing becomes unavoidable, and we miss out on the benefits and cost-savings of automation.
Without money that is both ownable and programmable, we can’t scale beyond these trust-based systems. If the economy can’t grow beyond these limitations, it is doomed for continued stagnation.
Fortunately, Bitcoin breaks past these barriers with a money that anyone can simultaneously own and program.
The Internet provides the grounds for permissionless information sharing and innovation. Borne from this wellspring was Bitcoin.
Bitcoin democratized access to the ownership and programmability of money. The result has been rapid innovation in the realm of peer-to-peer (P2P) finance.
Through irreversible transactions, Bitcoin minimizes the need for third party mediation. This not only reduces the costs for most payments, but also enables greater degrees of automation.
Through this renaissance, we’ve witnessed the development of fundamental building blocks for a P2P digital economy. These cryptographic primitives catalyze new ways to transact that were previously unimagined possible.
For example, people believed that a trusted third party was necessary to facilitate a swap of assets between two parties:
But through programmable escrows called Hash Time Locked Contracts (HTLCs), Atomic Swaps have demonstrated a new utility of money.
Atomic swaps enable people to transact with anonymous counterparties, without requiring third party custody and arbitration. The transacting parties save on fees while also minimizing counterparty, settlement, and custodial risks.
Because they’re able to both own and program their own money. It is this paradigm shift away from traditional forms of money and financial systems that enables an Internet of Money.
Just like typical Bitcoin transactions, HTLCs are accessible for anyone to use freely. However, HTLCs are a different class of payment because these transactions depend on specific parameters.
HTLCs are time-bound conditional payments. In this way, they are similar to escrows but don’t need to be operated by third parties.
When owned and operated by their users, HTLCs enable P2P value transfer. They remove the need for third party arbitration and the cost of mediation.
Today, people are leveraging HTLCs to build P2P alternatives that supercede the limitations of existing forms of money and financial systems. Such applications include:
- Cross-chain Atomic Swaps: cryptocurrency swaps with minimal risk and fees
- Zero Knowledge Contingent Payments (ZKCPs): data swaps via Bitcoin transactions
- Lightning Network: transaction throughput scaling solution
And we’re only scratching the surface.
First, we need to understand how a typical Bitcoin transaction works.
Party A sends funds to an address that only party B is able to spend. This is possible because of Bitcoin’s unique security model.
Party B can verify his rightful ownership over these funds to the Bitcoin network by providing his digital signature. Party Z and others who can’t prove this ownership can’t claim the funds allocated to party B.
In essence, the intended recipient must verify through something like a “login and password” in order to claim the funds.
Now that we understand the typical Bitcoin transaction, how do Hash Time Locked Contracts (HTLCs) differ?
They offer a new transaction type that requires more verification, implemented via hashlocks and timelocks. Through these locks, HTLCs implement time-bound conditional payments. HTLCs can only be implemented on blockchains that support these locks:
- A Hashlock functions like “two-factor authentication” (2FA). It requires the intended recipient to provide the correct secret phrase to claim the funds.
- A Timelock adds a “timeout” expiration date to a payment. It requires the intended recipient to claim the funds prior to the expiry. Otherwise, the transaction defaults to enabling the original sender of funds to claim a refund.
In both scenarios, party A’s transaction requires that party B provide a proper digital signature. Additionally, party B must provide the correct secret passphrase in order to claim the encumbered bitcoins.
The only way for party B to know this secret phrase is for party A to share it with them. Party A can share this cryptographic proof via any communication mechanism, like Telegram.
However, in the case of an atomic swap, party A may prefer to programmably share the secret on-chain. This way, party A can optimize for atomicity and security.
In both scenarios, party A’s transaction requires that party B provide a proper digital signature. Additionally, party B must claim the bitcoins within 6 blocks (about 1 hour).
What happens if these conditions are not met within the 6 block expiration time? The original sender of funds - party A - gains the ability to claim a refund.
Hash Time Locked Contracts are time-bound conditional payments. They are simply a type of transaction (login + password) that leverages hashlocks (2FA) and timelocks (timeout) to gain the benefits of:
- Extra verification via secret phrase
- Ability to refund after expiration
Unlike typical Bitcoin transactions, an HTLC is interactive. An HTLC requires that the intended recipient of a payment either:
- Verify via secret phrase prior to expiration, or
- Forfeit the ability to claim the payment, returning it to the payer.
This shared secret cryptographic proof can also be used to trigger other transactions. In effect, you can chain one HTLC’s actions to others, like we do in atomic swaps. This makes for powerful conditional payments in Bitcoin and across different blockchains that support hashlocks and timelocks.
To maximize the potential of HTLCs, it is critical to standardize their implementation to ensure compatibility between different applications and blockchains. To learn more about HTLC standards, feel free to explore:
- The BIP199 HTLC specification for Bitcoin (and our pending optimization)
- Our proposed HTLC standard ERC1630 for Ethereum
HTLCs are a fundamental building block to the Internet of Money. With time-bound conditional payments, we can build alternatives like Atomic Swaps that supercede the limitations of traditional financial systems.
We can finally own and program money. As a result, we can build the P2P future. A future that isn’t weighed down by trusted third parties. A future of Liquality.