Currently, the QTUM-BEAM atom exchange code is incorporated into the BEAM main branch, and the BEAM main network officially supports QTUM-BEAM atom exchange. Unlike previous experiments testing the network, the Qtum development team will switch between the Qtum and BEAM versions of the main network, showing the details of the QTUM-Beam atomic exchange. Next, let’s welcome Bob and Alice, famous virtual characters of blockchain, to bring a complete QTUM BEAM atomic exchange process.



QTUM-BEAM main net atom exchange

Exchange details



1. Firstly, configure the Mainnet environment of Qtum, edit the. ZSHRC in the home directory of the user, and add environment variables. Q1-dae and Q2-DAE are the Qtum node services of Bob and Alice respectively, and Q1-cli and Q2-cli are the Qtum client commands of Bob and Alice respectively. You can interact with the blockchain using client-side commands.





2. Run the./beam-wallet info command to check the beam balance of the two accounts, and run the qtum-cli getbalance command to check the QTUM balance of the two accounts. As you can see, Bob has 0 Beams and 20 QTUM. Alice has 40 Beams and zero QTUM.






3. Alice and Bob exchange atoms. Alice wants to exchange 20 beams for 10 QTUM of Bob. First Bob needs to turn on atomic swap listening mode by running it in the user directory

./beam-wallet swap_listen –swap_coin=qtum -n us-nodes.mainnet.beam.mw:8100 –amount=20 –swap_amount=1000000000 –swap_feerate=865000 — qtum_node_ADDR =127.0.0.1:13300 –qtum_user=Bob –qtum_pass=123 –log_level=info

Atomic exchange listening. The nodes first synchronize the block data, and when the synchronization is complete, if a node initiates a swAP_init transaction to its own address, the atom swap transaction begins. Trade each step in the order described above.





4. Alice runs at the same time

./beam-wallet swap_init -n us-nodes.mainnet.beam.mw:8100 –amount=20 –fee=300 -r 2128f6021b3847a8612b4d3597a82e598d8f51aa8a2eb4e765ec6da40b92403e137 –swap_coin=qtum –swap_amount=1000000000 –swap_feerate=865000 –swap_beam_side –qtum_node_addr=127.0.0.1:13400 –qtum_user=Alice –qtum_pass=123 –log_level=info

Command to initiate an atomic transaction by specifying the address of the BEAM receiver. Alice node will also start to synchronize block data at first, and when it is finished, it will exchange atoms with Bob in the order of the above transaction process.





5. Both parties wait for BEAM and QTUM’s two blockchain networks to confirm their respective transactions multiple times (QTUM defaults to 10) before the atomic exchange process is complete.


The client interface of Bob is as follows:




Alice’s client interface is shown as follows:





6. By looking at Alice’s account, you can see that she has received 10 QTUM from Bob and sent 20 Beams to Bob.





7. By checking Bob’s account, you can see that he has received 20 Beams from Alice and sent 10 QTUM to Alice.





8. On the browser of Qtum official website, you can see the transaction records of Qtum atomic exchange.


Query the details of the UTXO owned by Alice by running the q2-cli listunspent command, and obtain the TRANSACTION ID of a UTXO with an amount of 10

7c8c7068678b678d6e7d7375fc4e8244e30b9c67fce4106240471736a306bbc8

A query in the Qtum blockchain browser shows that the transaction generated by atomic exchange has indeed been written to the blockchain.


Qtum browser :(click to read the original text to query)

https://qtum.info/tx/7c8c7068678b678d6e7d7375fc4e8244e30b9c67fce4106240471736a306bbc8





conclusion

Cross-chain atomic switching technology provides users with incompatible network assets with a decentralized, simple and fast way to exchange, providing a trust-free service that eliminates transaction coordination costs. In the future, Qtum quantum chain will also continue to explore in the blockchain privacy technology and cross-chain field, connect more blockchain networks through the power of technology, and help the blockchain industry to achieve long-term and sustainable development.