what is a hashed timelock contract htlc 
a hashed timelock contract htlc is a type of smart contract used in blockchain applications it reduces counterparty risk by creating a time based escrow that requires a cryptographic passphrase for unlocking in practical terms this means that the person receiving the funds in a transaction has to perform two actions to access the funds enter the correct passphrase and claim payment within a specific timeframe if they enter an incorrect passphrase or do not claim the funds within the timeframe they lose access to the payment 1understanding hashed timelock contracts htlcs a hashed timelock contract htlc uses several elements from existing cryptocurrency transactions for example htlc transactions use multiple signatures consisting of a private and public key to verify and validate transactions however two elements distinguish htlc from standard cryptocurrency transactions with smart contracts the hashlock and the time contract the first element is the hashlock a hashlock is a hashed or cryptographically scrambled version of a public key generated by the person that initiated the transaction the associated private key is then used to unlock the original hash 2in htlc the initiating party generates a key and hashes it the hash is stored in a pre image which is revealed during the final transaction htlcs are programmed to expire after a certain period passes or a specific number of blocks are generated creating a known termination date and time 1to conduct a transaction using htlc both parties need to open channels with each other this is generally done using a wallet an exchange or both the second important element of htlc is a timelock two different timelocks are used to set time constraints on contracts generated using htlc the first one is checklocktimeverify cltv it uses a time base to lock and release cryptocurrency this means that time constraints are hardcoded and coins are released only at a specific time and date or a specific height of block size 3atomic swaps cross chain trading between cryptocurrencies are often achieved using htlcs 4 additionally bitcoin s lightning network ln also employs htlcs 1the second one is checksequenceverify csv it is not dependent on time instead it uses the number of blocks generated as a tracking measure to determine when to finalize a transaction 3the process in a hashed timelock contractsuppose alice wants to exchange her bitcoin for litecoin from bob a typical htlc transaction between them takes place as follows 