On September 19th, 2017, Decred and Litecoin completed the first ever cross-chain atomic swap. This day marks a significant step for the evolution of cryptocurrency — allowing users to conduct truly trustless, cross-chain transactions without the necessity of third-party exchanges.

This article will explain what you need to know about this exciting and revolutionary technology and Lamden’s role in it.

Problems of Trust

To fully understand the necessity of atomic swaps, one must first realize the problem at hand. With every exchange of goods or valuables, a certain level of trust must be assumed — especially if the said transaction does not occur in person. There is simply no guarantee that person A will send the money after receiving goods from person B and vice versa.

The current solution to this problem is to find a trusted third party, or escrow, to mediate the transaction. However, this can add a substantial additional cost to the transaction and still does not guarantee the escrow to be a trusted source.

Problems of Decentralization

Although the perceived aim of cryptocurrency was to create a decentralized system of finance, the majority of crypto-based exchanges are still mainly centralized. Network and computing power necessary to drive transactions is centralized in regional servers, while the actual act of trading crypto-funds remains exclusively at the hands of major centralized exchanges. Dealing with exchanges creates various additional problems such as the inherent risk of getting hacked (Mt. Gox serving as the lead example), the breach of user confidentiality with mandatory KYC, as well as delays and other technical difficulties.

Therefore, in order to retain a trustless and decentralized system, it is required to implement system of cross-chain payments, or atomic swaps, to exist so that blockchain applications can freely interact with one another.

Atomic Swap: Basics of Digital Transfers

Instead of two transfers taking place, i.e. the exchange of goods followed by the exchange of money, a single, dependent transfer swaps both values at once. This is done by making both sides of the trade dependent on each other. That means that exchange of money is dependent on the exchange of goods. A programming logic is created to insure that it is impossible for only one side of the trade to go through: either both sides of the trade are completed or neither.

Lamden’s Atomic Swap Solution

The main technological feat of the Lamden Project is its cryptographic ledger and routing system known as ‘Clove.’ Clove is primarily the infrastructure that links private chains together over a common protocol, similar to a telephone network. It does so by implementing Lightning Network inspired payment channels to provide a secure and decentralized method of exchanging funds across blockchains. Transactions initiate from private chains then utilize the Ledger as a public service for managing secured and guaranteed remittance of funds from chain to chain.

The Ledger serves as a public service that distributes the work of smart contract deployment and identity verification for chain to chain transfers between participants connected to the main network. Private chains are also free to implement their own methods by which to transfer funds, but the public Ledger is verifiable by consensus of participants on the wider network, thus providing a stronger sense of trust to cross chain transactions.

How does it work?

Imagine a scenario in which Alice wants to trade her ‘alpha’ coin for Bob’s ‘beta’ coin:

1. Alice would first initiate a swap by sending a message to the Ledger. The Ledger then takes the swap requirements and compiles them into the Solidity bytecode to be deployed on each chain.

2. The bytecode is then signed with each chain’s public key and sent to both parties. Alice deploys her contract. Bob keeps a copy to verify later.

3. Bob then does the exact same thing.

4. Assuming that this is an agreeable swap, both chains deploy the contract, and check to see if the other party has done the same by searching for the bytecode on the latest block.

It is important to note that If the originator chain fails to deploy their contract while the recipient chain follows through, the contract on the recipient chain will self-destruct and remit funds back to their account.

Finally, to make sure the payments are completed in a timely fashion, each chain can ‘ping’ their contracts, invoking a time-lock method. If the contract is too many blocks behind the agreed upon time-lock, the contract is destroyed due to non-compliance.

5. Therefore, the best case scenario for both parties is to resolve the payment channel on the opposing chain, and resolve the contract on their own chain as soon as possible. By adding a time incentive element to the transaction, the network benefits from quick chain-to-chain transfers.

Conclusion

Lamden envisions the future of cryptocurrency to be a trustless, decentralized and efficient financial system in which its users are in full control of their own transactions. Through the use of Clove’s revolutionary atomic swap protocol, they intend to make that future a reality.