Connecting sensible contracts to the world of privateness via cross-chain atomic swaps.

As a public blockchain specializing in technical innovation, Qtum has a fame for selling the event and utility of blockchain and the significance of privateness. Though the Qtum blockchain itself has anonymity on some stage, privateness and safety can at all times be strengthened. From its collaborative analysis with universities to the world’s first on-line privateness hackathon co-sponsored with Beam, Qtum stays as dedicated as ever to progress in privateness.

Lately, the emergence of the Mimblewimble protocol has given a brand new course to the privateness subject. As a consultant of the Mimblewimble protocol, Beam simplifies transaction measurement whereas guaranteeing privateness safety with excessive scalability.

Atomic swap has additionally been effectively acquired within the trade, enabling cross-chain transactions between two digital currencies. The profitable cooperation between Beam and Qtum additional symbolizes Qtum’s dedication to privateness and cross-chain know-how.

Atomic Swap permits atomic cross-chain transactions of cryptocurrencies on two separate blockchains with out counting on third-party belief endorsements. The time period “atomic” signifies that the transaction can both be a hit or a failure, with out involving the third state.

For instance: Let’s assume that Alice and Bob wish to trade a specific amount of cryptocurrencies A and B. Within the absence of a centralized trade, each events will first must agree on the trade price after which, with the assistance of atomic swap, ship A to Bob after which B to Alice.

Nonetheless, transactions on the blockchain are irreversible. Buying and selling in numerous currencies with out a central endorsement should contain operational priorities. If Alice sends A primary, then Alice is at a drawback, as a result of she can not guarantee Bob will ship a specific amount of B to her as agreed.

As a way to assure the success of decentralized peer-to-peer transactions, we’d like a mechanism to make sure that each events is not going to cheat. Up to now, Hashed Timelock Contracts (HTLC) is a generally used answer.

One principal answer to attain an atomic swap is thru Hashed Timelock Contracts (HTLC). The core concept is by locking a given transaction, the cryptocurrency in query can be unusable till sure circumstances are met.

Suppose Alice and Bob intend to trade tokens A and B. Alice first creates an encrypted digital password field, and tells Bob concerning the specs of the lock earlier than placing A into the field. To ensure that Bob to open the password field, he should present this key in addition to his signature. Bob will then create the same password field with the identical specs of the lock.

Since opening the password field requires one other occasion’s signature, solely Alice can open Bob’s field and solely Bob can open Alice’s field. As soon as Alice opens Bob’s field, the important thing can be displayed on the blockchain, which can enable Bob to hen use the important thing printed by Alice to open her field. If issues happen or if a celebration performs a withdrawal operation through the transaction, that means that the field isn’t opened throughout the agreed upon time, the digital currencies can be refunded to Alice and Bob respectively.

The above is the design idea of HTLC, however the precise implementation of the algorithm can be extra sophisticated and sensible points needs to be considered.

Beam is a cryptocurrency developed primarily based on the Mimblewimble protocol, which has robust privateness, substitutability, and scalability. Mimblewimble ensures the privateness of the transaction by hiding the id of the person and shielding the quantity of the transaction.

Mimblewimble requires each events to barter some parameters earlier than making a transaction. Subsequently, the technology of a transaction requires the web joint signature of each events. Remarkably, Beam gives the Safe Bulletin Board System (SBBS) mechanism to offer a simultaneous on-line buffer time for each events.

Beam has applied the atomic swap perform of Beam/Btc and Beam/Litecoin, merging the code into the grasp department. In mid-June, Qtum builders accomplished the atomic swap code of Beam/Qtum and submitted it to the Beam staff. The code has additionally merged into the grasp department of Beam mission. The atomic swap between Beam and Qtum is now accessible on the Beam MainNet.

Assuming there are two customers — one the place Alice owns Beam and the place Bob owns Qtum. Alice needs to trade Bob’s 80 Qtum for 200 Beam.

Alice first passes her public key to Bob. Bob generates a neighborhood Hash Preimage, calculates the Hash Picture, and makes use of Alice’s public key and Hash Picture to generate a transaction with a lock script. This transaction locks Bob’s 80 UTXO of Qtum, which might solely be spent if any of the next circumstances are met.

The agreed time of the atomic swap has expired (judged by the present block peak), and Bob claims possession of the UTXO by utilizing his personal personal key. This situation is principally used to allow Bob to take again the UTXO if the atomic swap fails for some cause.

Reveal the Hash Preimage and use Alice’s personal key for authentication. This situation is principally used below regular circumstances, the place Alice accepts the Qtum despatched by Bob revealing the personal hash preimage.

Bob sends the generated Qtum Lock Transaction to Alice, so Alice can confirm the transaction on the Qtum community.

Beam makes use of the Mimblewimble protocol, which discards scripts and hides attributes corresponding to the quantity of tokens. Because of this, lock transactions require the collaboration of two members. Since this text primarily focuses on atomic swap, we gained’t go an excessive amount of into element concerning the technology means of Mimblewimble transactions. For extra data, please confer with [Qtum Research Institute: New Privacy Protection Protocol MimbleWimble] (in Qtum’s WeChat Official Account).

Nonetheless, take into account the next situation: Alice interacts with Bob, together with the negotiation of the blinding issue, the signature of Bulletproof, and so on. to generate a Beam Lock Transaction on the Beam community, which locks a Beam UTXO that Alice is about to switch to Bob. Since there is no such thing as a script within the transaction to find out the department, Alice must generate a Beam Refund Transaction, which refunds the locked Beam UTXO again to Alice. This allows Alice to retrieve her personal Beam after the failure of the atomic swap.

When Qtum and Beam’s two separate lock transactions are accomplished, Alice and Bob must verify if the 2 transactions are appropriately locked. Alice additionally wants to find out if the lock time for the Qtum Lock Transaction is longer than that of Beam to stop Bob from retrieving Qtum via the timeout situation after getting Beam.

When the 2 events affirm the proper deployment of the lock transactions, they may enter the trade hyperlink of the atomic swap. First, Alice and Bob will conduct a Mimblewimble-based negotiation to generate a Beam Redeem Transaction, which transfers the locked Beam UTXO to Bob. In the course of the transaction, Bob will reveal his Hash Preimage generated by himself, which Alice learns from.

After Alice obtains the Hash Preimage generated by Bob on the Beam community, she initiates Qtum Redeem Transaction on the Qtum community, which triggers the second situation of the Qtum Lock Transaction script thus transferring Qtum to her account by revealing the Hash Preimage together with her signature.

After the atomic swap transactions get adequate confirmations on their respective networks, your entire atomic swap involves the top. When issues happen in any hyperlink, the atomic swap will fail and the lock transactions can assure that the tokens may be refunded to the unique account after the lock time.

For extra particulars, please confer with: Beam Atomic Swap

  1. Firstly, configure Qtum’s testnet surroundings, edit the .zshrc within the person’s house listing, and add surroundings variables. q1t-dae and q2t-dae are the Qtum node providers of Bob and Alice respectively, and q1t-cli and q2t-cli are the shopper instructions of Bob and Alice respectively, which can be utilized to work together with the blockchain.

Read the original article here