Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QIP-22: Qtum-Beam Atomic Swap #22

Open
Kingsley-Sun opened this issue Jul 2, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@Kingsley-Sun
Copy link

commented Jul 2, 2019

Abstract

The atomic swap allows atomic cross-chain transactions of cryptocurrencies on two separate blockchains without relying on third-party trust endorsements. Atomic means that either the transaction successes or fails, there is no third state.

This QIP would enable the atomic swap between Qtum and Beam.

Motivation

As a public chain led by technological innovation, Qtum has always promoted the development and application of blockchain technology. Although the blockchain itself has a certain degree of anonymity, a higher degree of privacy protection is still an urgent problem to be solved. Qtum attaches great importance to privacy technology and has never stopped the exploration of privacy.

The emergence of the Mimble-Wimble has given a new direction to the privacy field. As a representative of the Mimble-Wimble protocol, Beam has strong privacy, substitutability, and scalability. Mimble-Wimble ensures the privacy of the transaction by hiding the identity of the user and the amount of the transaction.

The successful practice on atomic swap between Beam and Qtum symbolizes Qtum's further step in privacy and cross-chain.

Specification

HTLC

The main solution to achieve the atomic swap is Hashed Timelock Contracts (HTLC). The core idea is to lock a transaction and use the transaction only if certain conditions are met.

Suppose Alice and Bob are exchanging digital tokens A and B. Alice first creates an encrypted digital lockbox, and tells Bob what the lockbox looks like. Then Alice puts the token A into the box. Opening the lockbox requires the secret key and Bob's signature. Bob will create a similar lockbox. Unlocking Bob's lockbox requires the same key and Alice's signature.

Since opening the lockbox requires another person's signature, only Alice can open Bob's box, and only Bob can open Alice's box. When Alice opens Bob's lockbox, the secret key is displayed on the blockchain. Bob can use the key revealed by Alice to open the lockbox created by Alice and get token A. If there is any problem during the transaction, leading that the lockbox is not opened within the agreed time, according to the design of HTLC, the digital tokens will be returned to Alice and Bob respectively.

Implementations

Participant

There are two participants

  • Alice who owns the Beam and wants to trade it for the Qtum.
  • Bob who owns the Qtum and wants to trade it for the Beam.

Major phases

Prerequisites
  • The being-exchanged UTXOs on Qtum network are locked for a specific time period. This is called Qtum Lock Transaction.
  • The being-exchanged UTXOs on Beam network are locked for a specific time period. This is called Beam Lock Transaction.
  • Before the Beam Lock Transaction taking place, Alice needs to construct a Beam Refund Transaction so that she can get the Beam back if the atomic swap fails.
  • Two Participants monitor both blockchain networks to ensure the source UTXOs are indeed locked.
  • In addition, Alice should ensure that the lock time of UTXOs on Qtum is longer than that of UTXOs on the Beam.
Exchange
  • Participants collaborate to create a transaction that transfers the locked Beam to Bob in exchange for the secret key. This is called Beam Redeem Transaction.
  • Bob reveals the secret key in the Beam Redeem transaction and finally broadcasts the transaction to the network.
  • Once the transaction is visible, Alice learns the secret key.
  • Alice creates a transaction to claim the ownership of Qtum UTXOs, and broadcasts it to the Qtum network. This is called Qtum Redeem Transaction.
Rollback

In case the swap fails(for whatever reason)

  • Locked UTXOs on both networks should remain intact until their lock timeout expires.
  • After the timeout expiration participants broadcast transactions that transfer the locked UTXOs back to them.

Reference

Atomic Cross-Chain Swaps on Qtum

Atomic swap on Beam

Atomic Swaps — The “Holy Grail” of Altcoins

@shannon1916 shannon1916 changed the title QIP-21: QTUM-BEAM Atomic Swap QIP-21: Qtum-Beam Atomic Swap Jul 2, 2019

@lickey777 lickey777 changed the title QIP-21: Qtum-Beam Atomic Swap QIP-22: Qtum-Beam Atomic Swap Jul 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.