Author

Topic: Understanding Atomic Swaps (Read 210 times)

copper member
Activity: 85
Merit: 122
July 16, 2018, 12:41:08 PM
#4
If Lightning network is going to be a requirement to activate it. Does it mean that It's going to be impossible to trade ETH to BTC as ETH has no LN?
Not only lightning network is not required at all for atomic swaps, but lightning channels cannot even be used for atomic swaps AFAIK.

Quote
Atomic swaps have to be developed in each currency in order to be able to use it to exchange?
Both blockchains should support hashed timelock contracts (HTLCs), that is, allow the transaction to be spent if either the time has run out or the preimage of a specific hash is provided, that will allow to release the transaction on the other blockchain. In Bitcoin-based blockchains, they should support BIP-199, in Ethereum it can be emulated by smart contracts.
newbie
Activity: 8
Merit: 24
July 16, 2018, 09:21:37 AM
#3
The concept of an atomic swap is not a part of the lightning network.

It's just a structure of transactions utilizing hashed timelock contracts (HTLCs) in order to achieve a trustless exchange of different currencies on different chains. Until now multiple atomic swaps were made on bitcoin.
ATM I'm writing a thesis about atomic swaps and how to recognize them. There are a few different scripts for HTLCs, but they all do the same thing: they lock value for a specific time, except the counterparty can provide the preimage of the given hash.

One implementation of an HTLC looks like this:
Code:
63 if
82 size
01 data1
20
88 equalverify
a8 sha256
20 data32

88 equalverify
76 dup
a9 hash160
14 data20

67 else
04 data4

b1 checklocktimeverify
75 drop
76 dup
a9 hash160
14 data20

68 endif
88 equalverify
ac checksig

In order to have an atomic swap you just need an implementation which achieves the same thing. In ethereum you could also write a smart contract which does the same. As far as both parties can watch the blockchain and what is happening there, it is possible to make an atomic swap.
legendary
Activity: 3948
Merit: 3191
Leave no FUD unchallenged
May 26, 2018, 09:49:28 AM
#2
My current understanding is that Atomic swaps will allow exchange between multiple crypto currencies in a trustless way without the need of a third party.

If Lightning network is going to be a requirement to activate it. Does it mean that It's going to be impossible to trade ETH to BTC as ETH has no LN? Atomic swaps have to be developed in each currency in order to be able to use it to exchange?

Indeed.  ETH could have it's own type of Atomic Swap mechanism, but it likely wouldn't be compatible with the Lightning implementation.  Some coins can already do Atomic Swaps without Lightning.  I recall Burst and Qora did it what seems like ages ago now, then Litecoin and Decred did it earlier this year.  So there are definitely workarounds that don't involve Lightning, but I get the sense that Lightning's method will be comparatively easier and more convenient.  

To confuse matters, apparently there's a distinction to be made between "on-chain atomic swaps" and "off-chain atomic swaps".  On-chain atomic swaps have to have the same hash algorithm for both coins.  Off-chain atomic swaps won't have that limitation.

There's probably still time for some standardisation to occur, since it's all still very much in its infancy.  With the immense network effects that Bitcoin commands, that will probably have the biggest influence on how most coins try to implement it.  It's fair to assume most coins would want to be compatible with BTC if they can.
legendary
Activity: 1568
Merit: 1031
May 26, 2018, 06:45:41 AM
#1
My current understanding is that Atomic swaps will allow exchange between multiple crypto currencies in a trustless way without the need of a third party.

If Lightning network is going to be a requirement to activate it. Does it mean that It's going to be impossible to trade ETH to BTC as ETH has no LN? Atomic swaps have to be developed in each currency in order to be able to use it to exchange?
Jump to: