ON-CHAIN VS. SIDECHAIN EXCHANGE
In retrospect to my last article on atomic swaps, I’ll be diving deeper, basically looking at what an off-chain (blockchain-blockchain) transaction better referred to as sidechains would look like in contrast to one done on the blockchain.
The activation of Segregated Witness (SegWit) a UTXO feature has paved way for many upgrades to the Bitcoin network. One remarkable one is Lightning Network; a feature that allows off the blockchain token exchange.
An off-chain transaction unlike cross-chain swaps, are exchanges carried out in between an on-chain swap. I wouldn't consider off-chain swaps as completely off chain since they are initiated and concluded on-chain. When a channel is opened (in the case of Lightning Network), it starts and ends on-chain. Transactions would be done back and forth (for Bi-directional payment channel) within the period it remains open. Before a channel is opened an on-chain transaction is made on both sides, committing a certain amount to the channel. These are few differences between them.
This is a phenomenon in computer science were two opposite events occur simultaneously in such a way that they are considered as one single event. Two guys shaking hands may be considered atomic since the two possible scenarios are that; they both are shaking or they aren't. One cannot be shaking the other while the counterparty isn’t returning the handshake.
Cross-chain swaps could be done atomically. That is both parties receive funds simultaneously. This is not the case with the Lightning Network and other off-chain solutions as transactions are made based on commitments.
For both the on and off chain swaps there are basically no fees as there are no middlemen. However both sides still have to pay transaction fees for the on-chain swaps at the commitment phase. Off chain swaps performed within an open channel would require almost zero fees except at the opening and closing of channel.
Lightning which of cause is an off-chain feature would permit almost instantaneous transaction since this it doesn’t require concession. The transfers are done only between the counterparties involved. On-chain exchanges on the other hand would require more time for transactions to be confirmed on both blockchains. The channel would have to be open for a considerable period of time to allow both chains confirm transactions.
As for scalability, off chain transactions wins. Theoretically, the bitcoin network (currently the must stretched decentralised network) can only handle about 7 transactions per second. This wouldn’t scale if we foresee a global bitcoinisation. The potential of an off-chain solution like Lightning could improve the networks capacity tremendously.
Off-chain swaps would be best for high frequency micropayments. A single large volume swap would be preferred on-chain since you all the same still require concession and fees to open and close channels. So you always do need the participating blockchains for an on-chain exchange while an off chain swaps would only be broadcast to the network after the channel has been closed. This channel could of cause contain infinite number of swaps as long as the counterparties remain cooperative. If a transaction doesn’t get to the recipient due to technicalities or just because one party gets uncooperative , the counterparty would have to await the expiration of the open channel to claim his funds. For this reason off-chain transactions are recommended only for small amounts settlements.
A big shortcoming people would get to experience with this decentralised exchanges is finding a double coincidence of wants (Barter Rebirth). So out of the hundreds of tokens available, one would need to search for an individual to do a swap. Probably a central meetup dedicated to token swaps which would be take the form of a social media platform with be necessary.