HashLock
Web3 / smart contracts
A HashLock is a cryptographic condition embedded in smart contracts that locks funds until the recipient proves knowledge of a specific secret value whose hash matches a predetermined value stored in the contract. The spending condition operates by requiring the spender to provide the preimage (the original secret data), which the contract then hashes and compares against the stored hash. HashLocks are fundamental to atomic swaps, payment channels, and conditional transactions, enabling trustless exchanges between parties without requiring direct interaction. Example: In Lightning Network payment channels and cross-chain atomic swaps, HashLocks combined with TimeLocks create HTLC (Hash Time-Locked Contracts) that allow Alice to send Bitcoin and Bob to send Ethereum with guaranteed settlement without intermediaries. Why it matters for smart contracts: HashLocks enable conditional fund release based on verifiable proof of knowledge, creating trustless escrow mechanisms and enabling atomic operations across chain boundaries without custodians.
Explore the full Web3 Glossary — 2,000+ expert-curated definitions. Need guidance? Talk to our consultants.