Grin Cryptocurrency Announces First Atomic Swap Using MimbleWimble Protocol
The First Grin Atomic Swap Completed Successfully
Grin is a new crypto coin, which is still in the process of development. It implements the Mimble Wimble protocol, named after the tongue-tying spell in Harry Potter. Grin has some unique properties such as:
Privacy By Default
On Grin, there are no addresses like it is typical with other crypto coins. The amounts are hidden using Pedersen Commitments. Grin will also implement the Dandelion protocol where there is transaction aggregation to improve privacy. Other properties include better scaling and proven cryptography that relies only on the Elliptic Curve cryptography that is a well-researched are in mathematics.
About the Atomic Swap
In each atomic swap, two parties are involved, let us name the parties Mary and Tom. Mary has some Grin that she wishes to exchange for Ether. Tom wants to buy them. First, they need to determine the amount they want to trade. They decide they will swap 500 Grin for 2 ETH. What Mary and Tom need to do is:
Lock up Mary’s Grin in a 2-of-2 multi-sig output, where Mary and Tom both have the key. Simultaneously, they will build this out as they build a refund transaction to Mary with a long lock time. They both conducted the sale simultaneously, or Tom might hold Mary’s coin hostage. Let us settle on a lock time of 12 hours.
Lock up Tom’s Ether using a smart contract. The smart deal will pay out to Mary as soon as she provides a secret key; Tom generated the key. This smart contract also features a refund option. However, it comes with a longer lock time than the output for Grin. Let us place it at 24 hours.
Mary and Tom will need to work together to let Tom transfer the Grin to an output he owns. The output is set up in a manner that when Tom claims them, he will reveal x to Mary; thereby allowing her to submit it to the smart contract.
Implementing these steps in the right manner will allow Mary and Tom to exchange coin without an exchange. Either they both claim the other coins, or no one can do it. That is why it is known as an atomic swap.
A Closer Look at Things
The Grin Side
An output in Grin is the Pedersen Commitment (a*G=b*H). G and H are elliptic curve point generators. In the Commitment, a is the secret key which has possession of amount b. To spend the output, the sender will need to prove that they understand the secret. Since the amounts are hidden, they must also show the whole transaction balance output by creating a signature for excess value, which is the sum of output minus the inputs.
The Ethereum Side
Tom will need to deploy a smart contract on the Ethereum Rosten testnet, which pays 2 ETH to Mary if she can prove that she knows q. If not, she will refund Tom if sufficient time has passed. To achieve this, he will send q, a secret key, to Mary and deploy a Solidity code.