Hash lock, the full name of Hash TimeLock Contract (Hash TimeLock Contract), is a new technical implementation form proposed in the Lightning Network.
The hash lock mode refers to a mechanism in which the user guesses the original value of the hash value within a specified period of time to pay. To put it simply, on the basis of smart contracts, both parties lock assets first, and if both parties enter the original value of the correct hash value within a limited time, the transaction can be completed.
Under such a mechanism, the rapid confirmation of micropayments can be achieved, that is to say, the goal of rapid confirmation of the Lightning Network can be achieved.
Next, Dabai will use the asset exchange of the application scenario of hash lock as an example to popularize how hash lock is realized.
In order to facilitate the understanding of how the hash time lock is locked, here is an analogy of two locks, one is a hash lock and the other is a time lock.
American rapper Megan Thee Stallion collaborates with Cash App to release a Bitcoin science video: American rapper Megan Thee Stallion has released a video titled "Bitcoin for Hotties" in collaboration with Cash App, a mobile payment service developed by Square. The video explains what Bitcoin is, why it is valuable, and more from her perspective. Megan Thee Stallion has more than 24.1 million followers on Instagram and 6.4 million followers on Twitter. (Bitcoin News) [2021/8/8 1:41:10]
News | Report: Hot words such as blockchain have led to the highest year-on-year growth rate in children's books and popular science encyclopedias: Recently, JD Books and iResearch jointly released the "2019 China Book Market Report". The report pointed out that hot words such as AI, 5G, blockchain, robot, VR, smart home, and AR continue to ignite the boom in technology. While technology is changing the lives of the public, it has also attracted the attention of more and more parents. Interest and love for technology. Therefore, the sales volume of popular science encyclopedias in children's books has the highest year-on-year growth rate, accounting for nearly 40%. [2020/1/8]
1. Hash lock
Locked by the hash value, after locking, only the original value that generates the hash value can be used to unlock the lock. Suppose the number is 123, the value after the hash is a03a, and the lock is locked by a03a, regardless of the hash collision. Can be unlocked by 123.
News | Lianke Community and Beijing Traffic Broadcasting launched a popular science program on blockchain technology: From 15:15 to 16:00 on December 11, the blockchain technology community - Lianke Blockchain Technology Community will cooperate with Beijing Traffic Radio FM103. 9 Decoded blockchain technology for popular science from scratch, and Dragonfly FM and Beijing Broadcasting Network conducted global live broadcasts at the same time. The first guest guests are Qie Jianjun, founder of Lianke blockchain technology community, and Yu Yanan, head of Baidu blockchain products. [2019/12/11]
2. Time lock
The time lock requires entering the password of the hash lock within the specified time. If the time lock is 1 hour, the user is required to enter the password of the hash lock within 1 hour. If the password of the hash lock is entered after 1 hour, the time lock will still not be opened.
That is to say, the condition for opening these two locks at the same time is to enter the original value of the hash value within the specified time. The above example is to enter "123" within 1 hour, and both locks will be in the open state. .
Popular Science Times: The long-term development goals of blockchain and cloud computing coincide: According to the report of "Popular Science Times" today, the combination of blockchain and cloud computing technologies, from a macro point of view, on the one hand, the use of cloud computing has already The basic service facilities or make corresponding changes according to actual needs, realize the acceleration of the development and application process, and meet the needs of start-ups, academic institutions, open source institutions, alliances and financial institutions in the future blockchain ecosystem for blockchain applications. On the other hand, for cloud computing, "credibility, reliability, and controllability" are considered to be the "three mountains" that must be overcome in the development of cloud computing, and blockchain technology is characterized by decentralization, anonymity, and data Untamperable is the main feature, which coincides with the long-term development goal of cloud computing. [2018/5/4]
Now Dabai will use the hash time-lock mechanism to exchange his bitcoins for ether with Xiaohei. The specific operation steps are as follows:
(1) Mr. Dabai generates a random number S, and then sends the hash value H(S) of the random number to Xiaohei through the network. Suppose the random number is 123 and the hash value is a03a.
At the same time, Dabai performs time locking and hash locking, assuming that the time lock is 1 hour, and the hash value of the hash lock is a03a. After locking, the bitcoins to be converted are locked on chain A.
(2) After Xiaohei receives the hash value "a03a" from Dabai, Xiaohei deploys a smart contract on Ethereum according to the hash value, and deposits the same value of Ethereum in the contract. Xiaohei's smart contract requires Dabai to provide the password "123" within the specified time before he can withdraw the ether currency in the smart contract.
This process is equivalent to that Xiaohei has also installed two locks, and the hash lock is the same as Dabai's hash lock. The same password can be used to open it, and the time lock is half an hour.
(3) Dabai uses Xiaohei's smart contract and enters his own password "123" within half an hour to unlock Xiaohei's hash lock on chain B and take away the hash lock in Xiaohei's smart contract Ethereum (equivalent to Xiao Hei's Ethereum, because the smart contract was created by Xiao Hei, and the Ethereum in the contract was also transferred by Xiao Hei).
(4) Because Dabai entered the password when calling Xiaohei's smart contract, Xiaohei also knows that the password is "123". He only needs to use this password to open the hash lock on chain A within one hour, and Dabai The bitcoins will be transferred to Xiao Hei.
Through the above process, we can see that Dabai can realize the conversion of Bitcoin to Ethereum through hash time locking. Of course, this often requires Dabai to pay Xiaohei a little more Bitcoin as a handling fee, after all, there is no free labor in the world.
After listening to Dabai's explanation above, some friends will be confused? Isn't it enough to have a hash lock? After all, Dabai must enter the password of the hash lock to take away Xiaohei’s ether, and Xiaohei can only open the hash lock on chain A after Dabai has entered the password of the hash lock on chain B. It seems that hash locks can handle things, why add a time lock?
In the hash time locking mechanism, if the time exceeds the specified time, the tokens locked in the system will be withdrawn. Therefore, adding a time lock effectively promotes Dabai to unlock the hash lock on chain B within the time specified by Xiaohei, and Xiaohei will also unlock the hash lock on chain A within the time period specified by Dabai because of his own interests. Lock.
There is no need to understand each other between the entire process chain and the chain, which in turn promotes the speed of transactions. And if the transaction fails, hash locking will not charge additional fees.
However, the application scenarios of hash locking are relatively limited, and it supports relatively few functions.
Do you hope that the current trading platform will vigorously promote hash locking and move towards a decentralized DEX? Why?
Tags:
This year is the year that cryptocurrencies are finally starting to go mainstream.From Musk and Tesla investing and accepting Bitcoin payments, to the recent token (NFT) craze.
Headline ▌The average transaction fee of Ethereum has risen to a record highAccording to Coindesk, according to data from BitInfoCharts and Blockchair, the average cost of an Ethereum transaction is currently $64.
Bitcoin "supporter" and Tesla founder Elon Musk tweeted in the early morning, saying that Bitcoin consumes too much energy, uses too much non-renewable energy and causes adverse environmental impacts.
Hash lock, the full name of Hash TimeLock Contract (Hash TimeLock Contract).
This week's Technology Weekly contains technical news about Ethereum, Polkadot, EOS, Ripple.
You need to withdraw BTC Here are the reasons for withdrawing BTC and using self-custodial services Believe it or not, a BTC ETF is about to launch. Market analysts said: "BTC ETF is about to go online.
Madman writes every analysis article with a responsible, focused, and sincere attitude, with distinctive features, no artificiality.