V Atomic Swap Contract

Decentralized exchanges will replace centralized exchanges. To further decentralize cryptocurrency trading, a cross-chain solution is needed to make it possible to exchange coins between different blockchains without any intermediate tokens or third parties.

Introduction

V Atomic Swap is a contract to use to enable a cross-chain swap. By V Atomic Swap contract, developers can build a cross-chain DEX on V SYSTEMS Mainnet, to offer V tokens to swap with tokens on Ethereum and other blockchains. V Atomic Swap contract is totally decentralized solution, requires no trusted party to hold custody of the coins, so it is totally secure.

V Atomic Swap features

No Code Deployment

Users issuing tokens on VSYS do not need to write a single line of code, and do not need to have their token contract audited by a third party before launch.

Binary Outcome Swap

V Atomic Swap allows users to exchange one asset for another atomically, such that the entire process either succeeds or fails. It is that simple.

ZERO RISK Swap

Due to the binary outcome of each swap, this allows for no risk for either party losing out by only one of the two transfers completing.

Implementation

The V Atomic Swap contract can store a single type of Token, to swap between different Tokens, two separate contracts are necessary. Users are required to deposit Tokens into the contract before they are able to lock it. The lock function itself is fairly simple, the input should be the hash of some secret together with the determined recipient and an expiration timestamp. To unlock the lock, the recipient simply needs to call the SolvePuzzle function with the transaction id of the lock together with the secret. The contract will check that the hash of the secret matches the puzzle in the lock. If it matches, the contract will transfer ownership of the locked coins or tokens to the recipient. Note however, that while the funds change ownership, they stay within the contract, so the wallet’s balance won’t change until the recipient withdraws the funds from the contract.

Method of swapping tokens in a secure manner that requires no trusted party to hold custody of the coins.

Example

If Alice wishes to swap 100 Token A for 100 of Bob’s Token B in the ratio 1:1, Alice will first create a secret Secret A and hash it, generating Hash(Secret A). Since hashes are infeasible to reverse, no one should be able to get Secret A from Hash(Secret A). Alice then creates an Atomic Swap contract Contract A which releases 100 Token A to Bob as long as Bob can broadcast Secret A before timestamp 1000. The contract also shows Hash(Secret A) publicly. Bob copies Hash(Secret A) into his own Atomic Swap contract Contract B that releases 100 Token B to Alice as long as she can broadcast Secret A before timestamp 500. Alice then broadcasts Secret A to obtain these 100 Token B, revealing Secret A to the entire blockchain. Bob now knows Secret A and has at least 500 seconds to broadcast it to obtain the 100 Token A. Of course, the entire blockchain knows Secret A, however, the contract specifies Bob as the recipient, as such, he is the only one who can obtain the stored Token A.

V Atomic Swap Image

What Makes V Atomic Swap Contract Special

V Atomic Swap is a method of swapping tokens in a secure manner that requires no trusted party to hold custody of the coins. It is a simple way to remove the importance of transaction ordering or time, to use a pre-commit scheme to mitigate the risk. We believe the enabling of the creation of cross-chain deals between different cryptocurrencies in a non-custodial way will help bring DeFi, especially DEX innovation to a new level.

Developer Resources CTA Image

Developers Resources

Join Us to the Blockchain Era
This Website Uses Cookies

Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only upon approval. Read More

Learn

Products

DeFi

Developers

Enterprise and Institutional

VSYS Community

Join Us

News

Footer VSYS Logo Colored
Privacy Policy | Terms of Use © 2022 V Systems All Rights Reserved.
Footer Artwork