Trading cryptocurrencies on decentralized exchanges are unarguably exciting, coin holders here are able to exchange their tokens with the influence of a third party. This concept is relatively a developing concept in cryptocurrency as many decentralized exchanges still exhibits some centralization. Cryptocurrency trading on centralized exchanges requires the tokens be transferred to a common wallet and distributed accordingly to each personal account, tokens here are hence being held in a hot wallet which a prone to hacks and other security and economic issues such as price manipulation and wash trades. Trader are also required to pass the KYC (know your customer) test before they can transact unlimitedly on the exchange.
A truly decentralized exchange solves these problems, decentralized exchanges are built on the concept of Atomic swap.
Atomic swaps are a smart-contract technology that enable the exchange of one cryptocurrency for another without using intermediaries, such as 3rd party exchanges, occurring as smart-contract events within the respective blockchains involving only the exchanging parties in a cryptographically secure manner. With the atomic swap technology, the exchanging parties exchanges their token while these tokens are still locked in their cold wallets. This ensures a safer and more reputable cryptocurrency trading.
Atomic swap goes live on PascalCoin blockchain!
Developed by Herman Schoenfeld, the atomic swap technology on the PascalCoin blockchain will enable PascalCoin to be listed on decentralized exchanges, the atomic swap feature works using the Hash-locked-time-contract smart contract. With the Time contract protocol already implemented on the PascalCoin blockchain in form on in-protocol PASA exchange, introducing the hash locked account feature completes the atomic swap smart contract. This feature uses a time lock differential to ensure secure exchange of tokens on the PascalCoin blockchain and also cross-chain cryptocurrency exchange.
How the Atomic swap works on PascalCoin blockchain
For a surface view, the atomic swap work flow is simply thus: for an exchange of specified tokens, the seller locks a certain amount of tokens in his/her wallet using a random secret number, this number must be revealed to the buyer for this swap to occur, however, to reveal this number to the buyer, the buyer also stakes an agreed amount of their own token, this token is also locked and is automatically accessible to the seller once they reveal the code to unlock the funds in their wallet. The time lock is set to a specified time after the transaction is invalid.
To swap 50PASC and 5Eth between Tom and Harry
• Tom deposits 50PASC into his PascalCoin wallet and sets a secret code which must be supplied by a buyer before the 50PASC in Tom’s wallet will be accessible.
• To purchase the staked 50PASC, Harry supplies his public key to Tom, this enables Tom to setup a private sale to Harry. He also sets a time frame after which the deal becomes invalid if Harry fails to satisfy his part of the deal, (Tom might set a 5days time frame)
At this point, Harry can take Tom’s 50PASC for free only if he could supply the secret number set by Tom.
• Tom sets a price (5eth) which will be paid by Harry before he reveals the secret number.
• Harry deposits 5eth into his etherum wallet, Tom supplies his etherum public key to Harry, Harry creates an etherum transaction which allocates 5eth to Tom, however, this can be spent by Tom once he publishes the secret number. Harry sets a time frame for this transaction after which it becomes invalid if Tom fails to publish the secret code.
If Tom sets 5days for his transaction, Harry may pick a 1-4 days time frame for Tom to supply the secret number, this is known as Time lock differential, this serves a very important security purpose
The Time lock differential gives Harry enough time to cancel transaction if he notices an abnormality on Tom’s side, probably if Tom fails to reveal his secret.
• Tom detects the transaction set up by Harry on etherum blockchain, he then reveals his secret number to take charge of Harry’s 5eth.
• Harry detects Tom’s transaction on PascalCoin blockchain and extracts secret number from Tom and publishes a Purchase Account operation on the PascalCoin chain for and includes the secret number inside the Payload, thus taking possession of the 50 PASC. This completes the atomic swap.
Decentralized exchanges platforms have over the years shown some irregularities and hence a questionable reputation:
On July 2018, decentralized exchange Bancor was reportedly hacked and suffered a loss of $13.5M USD in assets before freezing funds.In a Tweet, Charlie Lee, the creator of Litecoin spoke out and claimed an exchange cannot be decentralized if it can lose or freeze customer funds.
The atomic swap technology perfects the concept of decentralized exchange and creates the most secured cryptocurrency trading system.
Due to the low cost vs the significant benefits of this change, this proposal is recommended for V5 implementation which is also underway!
Excited? Yes, unarguably!
For more enquiries on the PascalCoin’s atomic swap smart contract, [Join the discord server
Resources for further readings...