Bridges vs. Atomic Swaps
In the last few days, we were asked whether it wouldn’t be easier to just use atomic swaps instead of building a much complex dogecoin-ethereum bridge.
Bridges and atomic swaps are two interoperability technologies. Both of them allow two independent blockchains to work together. But they do that in different ways and the objective they pursue is different.
Bridges allow users to move their coins from blockchain A to themselves on blockchain B. Users can use the coins on blockchain B and then move them back to blockchain A.
People may want to use a bridge because they trust coins (e.g. bitcoins) created on blockchain A but want to use features (e.g. smart contracts, privacy, reduced fees) of blockchain B.
Sidechain and 2-way-peg are bridge synonymous. The concept was popularized by Blockstream 4 years ago when they published the Sidechains white paper. RSK is a very popular bitcoin sidechain that enables users to use “bitcoins” on smart contracts.
There are different ways of implementing bridges: Centralized, Federated, Collateralized, Sidechains and Drivechains. They vary on the level of centralization and who would have to collude to break the bridge.
Atomic swaps enable the exchange of coins between two users in a decentralized way. Coins could be on the same blockchain (e.g. two ethereum ERC-20 tokens) or different blockchains (e.g. Bitcoin and Litecoin).
They are an alternative for centralized exchanges (e.g. Binance). The main benefit of using atomic swaps is users don’t have to trust any third party (just google mt gox).
Atomic swaps are much simpler to implement compared to bridges. They use a technique called Hashed Timelock Contracts that is also used by the Lightning Network. They don’t require any of the participant blockchains to implement turing complete smart contracts neither to be aware of the other blockchain.
Both bridges and atomic swaps will be part of the future of cryptocurrencies. Most projects are in their infancy, so I expect a lot of development on the interoperability space in the near future.