QIP-22: Qtum-Beam Atomic Swap #22
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.
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.
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.
There are two participants
In case the swap fails(for whatever reason)