What Is That Talk About Cross-Chain Atomic Swaps Between Tron and Steem?

in atomic-swap •  5 years ago  (edited)

Steemit, Inc wrote in a post titled Update: Townhall & Witness Meeting:

After meeting with the team we all agreed that the best way to progress our missions and add value to one another’s stakeholders is to connect our two powerful blockchains through Cross-Chain Atomic Swaps!

This would be the first time in history that two blockchains of this size will be connected to one another so that tokens can flow freely, and voluntarily, between the chains without the need for trusted intermediaries like exchanges.

How does this differ from the dreaded token swap from STEEM to a token on the Tron blockchain that Justin Sun announced on the 14th of February?

The idea was to allow Steem users to swap their STEEM to TRX and back. Such a need might arise when using an app that uses both Steem and Tron.

The "atomic" in the term "cross-chain atomic swap" refers to the swap happening completely or not at all. It is an event that is a single indivisible thing from the user's perspective like an atom is indivisible.

The "cross-chain" in the term simply refers to a swap of tokens on different chains.

What is required for a (cross-chain) atomic swap to work is for both chains to support hash locks and time locks.

What are those?

A hash lock a type of smart contract that dictates that a token transfer (from an address on a chain to an address on the same chain) only happens when the person who initiates the transfer posts a secret to the chain. It's called a hash lock because the secret itself is not initially published but only a hash (a one-way encryption) of the secret (a number or a string). Calculating the hash of something is quick but calculating that something from the hash is practically impossible.

A time lock means that there is a time limit for the conditional transaction (the contract) within which it has to take place or it won't happen.

The following steps take place during the execution of an atomic swap where A and B want to exchange tokes on different chains:

A). A sends his coins to a contract address on chain X. The transaction includes the hash of a secret. The idea is that when the contract is fulfilled - which happens when the secret provided to the contract - the coins will be sent to an address completely controlled by B. B can verify that A actually has sent the right amount to the contract address because all the transactions are on a public blockchain. B will also learn the hash of the secret, which he needs for the next step.

B) B sends his coins to a contract address on chain Y and includes the same hash in the transaction. The coins will be sent to A but only if the secret is revealed to the contract on chain Y. But then B can also get his coins because both contracts are fulfilled upon provision of the same secret. That the same secret is needed is verifiable - before the deal goes down - by anyone because the contracts (=conditional transactions) posted to both chains include the same hash, indicating that they are executed upon being provided the same secret. Therefore, A can only get his coins by allowing B to get his coins.

The time locks are needed because it is possible for A to fail to publish the secret at all. Without a time limit, both could end up with their funds in a limbo forever. To give B enough time to claim his coins in case A reveals the secret at the last possible moment, the contract on chain Y will have to give B more time than A.

At present, Steem does not support nor is it intended to ever support user-defined smart contracts. The Steem blockchain does not have hash locks or time locks built in, which means that they would have to be added to the core blockchain code for Steem to be able to participate in cross-chain atomic swaps. Another possibility is to have them done on a side chain (processed by nodes different than Steem consensus ndoes). Steem Engine has user-defined smart contracts in its road map as well as decentralization (it currently has only one server acting upon the Steem-Engine transactions posted to Steem, the Scot bot). Tron has had user-defined smart contracts from the start. It was designed to be a DPoS-based competitor of Ethereum.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

My bitcoin.com wallet let me swap btc for bch and didn't mention any of that.
Instantly.
Iirc.

That wallet has Shapeshift integrated, that is, it has the ability to act as an interface of the Shapeshift exchange, which is a centralized exchange.

Another possibility to do an atomic swap instantaneously is to use the Lightning Network. In that alternative, everything stays off-chain until a channel is closed.

It did say shapeshift, though.
So, they handle the trade like block trades does?

Yep.

Hi @markkujantunen!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 4.399 which ranks you at #2564 across all Steem accounts.
Your rank has dropped 27 places in the last three days (old rank 2537).

In our last Algorithmic Curation Round, consisting of 90 contributions, your post is ranked at #20.

Evaluation of your UA score:
  • Some people are already following you, keep going!
  • The readers appreciate your great work!
  • Try to work on user engagement: the more people that interact with you via the comments, the higher your UA score!

Feel free to join our @steem-ua Discord server