Cross-chain Atomic Swaps on AE


I’d like to suggest the further discussion on the implementation of Cross-chain Atomic Swaps on aeternity through the use of Hashed Time Lock Contracts.

Atomic swaps allow the trading of cryptocurrencies between different blockchains like for example trading Ethereum for Aeternity without any intermediary.

The hash-locked contract would be run both blockchains, an initiator will create a contract and lock an amount X of AE in it. The same will be done with ETH on the Ethereum blockchain, with the contracts being valid for a specified time period. These ensure that the swap is completely trustless.

They pretty much allow your average user to run truly decentralized exchanges, not needing to rely on any 3rd party exchanges at all. Users can deal and transfer coins from different blockchains between each other directly.

At the moment there are quite a few decentralised exchanges but to my knowledge there is no exchange which does cross-chain exchanges without the use of derivative tokens which are given to you by a trusted gateway, which defeats the trustlessness of the system.

In my opinion, Aeternity having cross-chain atomic swaps is crucial in distancing the ecosystem from
the reliance on centralised exchanges, and further improving privacy, security and transparency in the process.

  • Francesco @ Simply-VC


First and foremost such contract is needed to interoperate Aeternity sub currencies (if it’s still planned to implement such function)


Yes, hashed time lock contracts are a great tool but I am afraid out of the box infrastructure for those will land some time post main net.
This had been in our discussions for various reasons and could end up being fundamental for sharding (for having atomic swaps between different shards). This is yet TBD. Thanks for bringing this up :slight_smile:


Thanks for the reply. Looking forward to the upcoming mainnet release and future developments.

Sharding would be great for on-chain scalability. Its combination with channels would be a perfect combination!


Is there some way to avoid bugs, or to check if we have bugs?


Hi @xiahui135,
I am not sure if I understand your question, but Sophia is typesafe and this will save you a lot of bugs, indeed. The only thing that will save you from logical errors is proper testing.

Please test your code :smiley: