ZION x ETHLondon 2020

The genesis..

Andrea Di Nenno
clearmatics
6 min readMar 6, 2020

--

Photo by ETHLondon

Motivations

Privacy and interoperability are major problem spaces that dominate the ongoing efforts in blockchain today. With true privacy on transparent blockchains like Ethereum and ecosystem-wide interoperability yet to be realized, we set out to cross both bridges at once…

At ETHLondon, we decided to attempt to bring together two parallel research projects at Clearmatics to take a step towards achieving something not yet done before.

Enter ZION.

ZETH + ION = ZION

ZION was officially born at ETHLondon on February, 29 2020 on a late Saturday night, after the first, suffered, messy but effective end-to-end flow was carried out by the team.

We would be able to integrate the Clearmatics ZETH and ION protocols into the ZION Proof of Concept to show its potential as the first privacy-preserving, cross chain atomic swap protocol.

Cool, but what does that even mean? Let’s break it down:

  • Atomic Swap Protocol: is a protocol that enables two actors to carry out in peer to peer (no trusted third parties) a swap of cryptocurrencies. The atomicity implies that either both actors end up with the ownership of the other’s token (in the agreed value) or none of them does. The atomic swap is then trustless, that is the two parties don’t have to trust each other, because by design it makes it impossible for one of the two to defraud the other.
  • Cross chain: more intuitively this indicates that the actors engage in a protocol that is executed across two different blockchain systems (Ethereum chains for this PoC, but extendable as long as the blockchain has the desired features to support ION and ZETH, such as smart contract capability). It means that at the end of the protocol, Alice would be able to spend (or just Hodl) Bob’s token on chain B, and vice versa.
  • Privacy-preserving: as if it wasn’t already enough, the atomic swap is encapsulated into ZETH, that obfuscates through the magic of Zero Knowledge Proofs the actors public keys and the amounts traded!

Whoa, whoa, whoa..What is ZETH and what is ION?

Let’s now take a step back to understand first what these two base protocols achieve.

ION is Clearmatics’ interoperability solution. More precisely, it is a system and function-agnostic framework for building cross-interacting smart contracts between blockchains and/or systems. As you will see, the atomic swap protocol we designed wouldn’t be possible without ION, that allows to securely transfer valid state from one chain to another, coordinating the two counter parties and removing the need for trust.

ZETH is Clearmatics’ solution for privacy of transactions. It is an adaptation of Zerocash that can be deployed on top of Ethereum without making any change to the base layer. It gives the atomic swap protocol that privacy flavour, pretty vital for the enterprise environment we operate within.

Progress made & challenges faced

Back to ETHLondon, the biggest challenge we faced during the hackathon (I won’t even mention how brain-twisting it was from an engineer’s perspective to dive into the ZETH protocol), was related to the cross-chain feature of the atomic swap we wanted to design.

The goal was to have the protocol on a single smart contract, ZION, deployed twice on the two chains, that would coordinate the two actors in a linear execution as if it was carried out on a single chain.

Ambitiously, we didn’t settle with a naive Happy Path PoC, but designed a feature-rich protocol that covers both malicious behaviors or inactivities, avoiding having the actors’ coins locked or stolen by the counter party. This meant that we managed to create a protocol that remained robust under adversarial behavior — a big win!

High Level Protocol Overview

Below is a high level overview of the protocol, highlighting most importantly the rationale of it.

The following describes how two actors, Alice and Bob, on two chains, chainA and chainB, are able to trustlessly carry out an atomic swap of two tokens, tokenA and tokenB (both of value X for simplicity), so that at the end Alice will own X tokenB on chainB and Bob will own X tokenA on chainA.

The initial setup requires that the two actors, Alice and Bob, have a wallet they control on both chains, that both have created ZETH Notes (a private version of their token) on the respective chains, and that they had agreed on a certain trade. We consider that the ZION, ZETH and ION Smart Contracts are deployed on the two chains. Finally, let’s imagine that Alice is the initiator of the swap, while Bob is the responder.

  1. Alice calls the initiateSwap function within the ZION contract on chain A, providing the ZETH proof of a note creation for Bob with agreed value and recipient. Upon a succesful zero knowledge verification of the proof, the ZETH note is stored in a pending transaction pool of ZION A
  2. Block propagation (by Alice or Bob or a third party) and validation occurs via the ION contract from chain A to B, containing the verifiable data of Alice’s above transaction.
  3. Bob calls the respondToSwap function within the ZION contract on chain B providing the ZETH proof of a note creation and a proof of Alice’s transaction, as per the ION protocol on chain A. Upon successful verification, the ZETH note is stored in a pending transaction pool of ZION B.
  4. Block propagation (by Alice or Bob or a third party) and validation occurs via the ION contract from chain A to B, containing the verifiable data of Alice’s above transaction.
  5. Alice calls the confirmTrade function within the ZION contract on chain A providing proof of Bob’s response transaction, as per the ION protocol on chain B which releases Alice’s pending note to Bob.
  6. Block propagation occurs via the ION contract from chain A to B
  7. Alice calls the finalize function within the ZION contract on chain B, providing proof of Alice’s confirmation transaction as per the ION protocol on chain A, which releases Bob’s pending note to Alice.

As we can see, the ION proofs provide synchronization between chains allowing synchronous logic. This prevents common vulnerabilities in atomic swaps that allow one party to exploit the other in fully asynchronous execution.

You will find a complete description of it and more in our github project

Next steps

At ETHLondon we have shown the great potential of the ZION protocol, but the work required to make it a solid reality is vast and covers:

  • Find a more politically neutral name :(
  • Abstract away the complexity of the two protocols in a more usable form for the users, including a working demo that users can follow out of the box
  • Security analysis and attacks vector
  • Gas Optimizations, especially for the base protocols
  • Extend the use case to non-ethereum chains

.. and more.

In conclusion, the best is yet to come! Stay tuned to see how our baby ZION grows, and contributions to the project are highly appreciated.

Acknowledgements

Thank you to Antoine Rondelet and Raphael Toledo from the ZETH team! Their advice, contributions and help were paramount in getting this off the ground.

Thanks to the ETHGlobal team for the great event and comfortable hacking space!

Chris Chung, Blockchain Interoperability Engineer, Clearmatics

Andrea Di Nenno, Junior Blockchain Engineer, Clearmatics

Jaime Iglesias Botas, Junior Blockchain Engineer, Clearmatics

Tweet us @Clearmatics

Photo by Christophe MacIntosh
Photo by ETHLondon
Photo by ETHLondon

--

--