Bytom Grant Project — Hashed TimeLock Contract(HTLC) has been completed
Meheret, our community developer from Ethiopia, has successfully completed the Hashed Timelocked Contract (HTLC) Swap project on Bytom.
This project supports the atomic swap of assets among Bitcoin blockchain, Bytom main chain, and the Bytom side chain.
This Project Swap has been received a Bytom Grant of 10,000 US dollars.
Open source code: https://github.com/movnetwork/swap
Application entry: http://swap-web.herokuapp.com/dashboard/bitcoin?tab=claim
What is Hashed TimeLock Contract (HTLC)?
Hashed TimeLock Contract, which refers to a mechanism by which users guess the original value of the hash value and pay for it within a specified time period, which can realize the exchange of assets between the two parties in a decentralized manner. It was first proposed in the Lightning Network. Under this mechanism, the rapid confirmation of micropayments can be realized.
To understand hash time locks, you need to understand hash locks and time locks separately:
Time lock: The time lock requires the password of the hash lock to be entered within the specified time. If the time of 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, it will be expired.
Hash lock: Lock through the hash value. After the lock is locked, only the original value that generated the hash value is used to unlock. Assuming the number abc, the hash value of abc is ba7816, and the lock is locked by ba7816, regardless of hash collision In this case, it can only be unlocked by abc.
How does HTLC works？
Suppose Alice wants to exchange BTC for Bob’s BTM. What should they do?
1. Alice first generates a random number, and sends the hash H(s) to Bob. Assuming that the random number is “abc” and the hash value is “ba781”, Alice uses the hash value to lock up the BTC to be locked, and a 1-hour time lock is set at the same time.
2. Bob receives “ba781” and sets a contract lock up BTM of the same value on the Bytom blockchain with the same hash value, and sets a time lock of 0.5 hours at the same time. Alice can use the random “abc” to unlock Bob’s BTM within 0.5 hours. Because Alice uses the random number “abc” to unlock, then it trigger the contract, so this random number “abc” exposed to Bob
3. Bob uses this random number “abc” to unlock Alice’s BTC on the BTC Blockchain, and the transaction is completed
Advantages of HTLC
HTLC uses scripts or contracts, so there is no need for a trusted third party to complete the transaction between both parties.
Because the time lock feature being implemented. Both parties do not need to wait too long, and they will automatically return to the account if time expired. This can prevent one party from deliberately delaying the transaction process and improve transaction efficiency.
Both parties do not need to know each other’s identity or trust to complete the asset exchange.
What is the Swap project
The Swap project is a HTLC project developed by Meheret, a community developer from Ethiopia, this HTLC project can realize the atomic exchange of assets among Bitcoin Blockchain, Bytom main chain and the Vapor-Bytom side chain. Meheret has also developed Web front end and Swap-API.
Let’s check the tutorial below
There are three buttons on the top of the middle, representing Bitcoin, Bytom mainchain and Vapor -Bytom side chain.
Enter the mnemonic phrase and password under the Wallet page to obtain the public key and address information.
On the HTLC page, construct a hash time lock by entering the hash value, unlocking the public key and sending the public key
On the Fund page, enter the generated HTLC address, deposit funds for the corresponding hash time lock contract, and send it to the chain
Then you can send the transaction to the counterparty, and the counterparty can unlock the assets through the Claim page and complete the asset swap.
Bytom Grant wants more applicants
The Swap project received a Bytom Grant of 10,000 US dollars. Bytom Grant was established by Bytom as an incentive plan to motivate the community and ecology, setting up a project reward of up to 100,000 US dollars.
Bytom Grant award scope includes:
• Software and tools
• Academic Research
• Education and documentation
Any outstanding community developers and users who are interested in becoming Bytom’s ecology and growing with Bytom can apply.
Application link: https://github.com/Bytom/Bytom-Grant