Two implementations of cross-chain token swap
There are two ways to implement decentralized token swap functionality across different blockchains:
- Each blockchain has its own distinct set of validator nodes which only have visibility over a single blockchain and can only interact with that blockchain. For nodes on BlockchainA to react to state changes which occurred on BlockchainB, they require validator nodes from BlockchainB to send specially constructed proofs (concerning the state of BlockchainB) in a common format which BlockchainA nodes can understand. Similarly, for token conversion in the opposite direction, nodes on BlockchainB rely on proofs provided by BlockchainA nodes.
- Validator nodes have full visibility over both BlockchainA and BlockchainB. These nodes can verify transactions on both chains independently without relying on proofs from any other nodes.
Although the first approach is currently the most popular one, it is also the most complex to implement because it relies on additional proof generation and verification steps; proofs have to be in a common format which any participating validator node (on any blockchain) can understand. These proofs make heavy use of cryptography and so they require validators on both chains to rely on the same underlying cryptography.
Capitalisk (https://capitalisk.com/) implements the second approach via its LDEX exchange (https://ldex.trading/). An LDEX validator node can participate in an unlimited number of blockchains (installed as modules) — Each Capitalisk module runs in a different process on a different CPU core so they don’t slow each other down and they are guaranteed to be running at the same time (which provides availability guarantees).