What it means
The hashlock is based on a secret and its calculated hash, and the recipient proves knowledge of the secret by revealing a preimage that produces the agreed hash. This is not a process of decrypting the hash or supplying a password that is automatically the same as a private signing key.
Signatures can also be required, so knowing the preimage alone does not necessarily authorise every person to spend the funds, and the script can identify who may use the claim path and who may use the refund path. The timelock creates a defined fallback, since a payment need not remain locked forever if the intended recipient never claims it, and the refund condition and the type of timeout must be understood before funds are committed.
Timeouts can be expressed through relevant blockchain mechanisms, but a block-based condition does not necessarily correspond to a precise wall-clock instant because block timing varies. Operational planning should leave room for confirmation and settlement delays.
BIP 199 describes an HTLC script in which a designated party can spend funds by revealing a hash preimage and another party can spend after a timeout in a refund situation. It is a technical proposal, not evidence that every network or wallet has adopted the same feature, so the actual implementation determines available operations.
Revealing the secret can connect multiple conditional payments, because in an atomic-swap design information disclosed while claiming one payment can permit the counterparty to claim another, which makes the relationship between the contracts and their deadlines central to the design. An atomic arrangement aims to avoid one party receiving value while the other cannot complete the corresponding leg, but it does not remove every risk, since incorrect amounts, wrong destinations, incompatible scripts or poor deadline choices can still create loss or failed execution.
Lightning-style payment routes can also use hash-and-time conditions, and several linked channels can support a payment without treating every participant as an unconditional lender, although the route's protocol and implementation add requirements beyond a simple two-party script example. Deadline ordering matters when more than one contract is involved, because one leg may need an earlier claim window so the other party has time to act after learning the secret, and equal deadlines are not automatically the safest design.
Network fees and monitoring remain relevant, since a claim or refund may require a transaction to be submitted and confirmed. An available legal or script path is not the same as an operation already completed on the ledger.
In practice
Real-world examples.
Example
Two parties arrange a conditional exchange with a shared hash condition. When the intended recipient reveals the secret to claim one leg, the other party can use that information under the second contract's own conditions.
Example
A recipient does not complete a claim within the agreed window. The sender checks the refund path and submits the required transaction after the timeout rather than assume funds return automatically without action.
Example
A payment coordinator reviews timeouts on linked contracts. The coordinator allows time for the second claim after the secret is revealed, instead of assigning identical deadlines without considering confirmations.
Formula
Calculation
A simplified claim condition is H(secret supplied) = agreed hash, together with the required authorisation and script conditions. The refund condition follows the contract's timeout rule and refund authorisation.
In a hypothetical exchange, one leg expires at a later block height than the other to leave time for the corresponding claim. Those heights are illustrative design parameters, not a universal schedule or a guarantee of exact clock-time settlement.Case study
Seen in the real world.
Fictional case study: Harbor Digital described an HTLC as a payment that would reverse automatically at an exact minute if a recipient did nothing. The draft also called the secret an encrypted private key. The technical reviewer separated the preimage condition from signing authority and identified the actual timeout mechanism. The team documented who had to submit a refund and how confirmation delays could affect timing.
Harbor revised the process before committing funds. Its explanation no longer confused a possible refund path with a refund already completed, or a hash preimage with a universal wallet credential. Harbor also set the two deadlines in a hypothetical exchange with a clear gap, so the second party would still have time to claim after the secret appeared on the first leg, and it built a monitoring checklist for submitting a refund once the timeout passed. This fictional case is illustrative and does not describe any real network, wallet or counterparty.
Watch out
Common mistakes.
- Treating the hashlock as reversible encryption or a private key. The preimage and signing permissions are distinct.
- Assuming expiry automatically completes a refund. The implementation can require an authorised transaction and confirmation.
- Ignoring deadline coordination. Linked payments need a workable sequence and time for settlement.
Questions
People also ask.
What is the preimage?
The secret input whose hash matches the agreed value.
Does an HTLC eliminate every payment risk?
No. It addresses defined conditional-settlement risks, while implementation, fees, timing and asset risks remain.
What should be verified before use?
The script, participants, amounts, claim and refund paths, timeout convention and operational responsibilities.
From the founder's library

Take it further with the book.
Build your financial confidence beyond this definition. Shihan's full-length guide, Accounting Fundamentals, takes the same plain-English approach and turns it into a complete, practical playbook for non-finance managers, business owners and students - with chapter-end quiz answers and presentation slides included.
25% off with code MMHQ25, applied at checkout. Priced in USD - checkout may show the equivalent in your local currency.
View the book and save 25%