The Nexus Effect: ZK Crosschain Swap Demo

See how Avail Nexus securely and reliably facilitates message passing for seamless asset swaps between two ZK chains in this ZK Nexus demo. Request early access to Avail Nexus now.

By Scott Milat 4 min read
The Nexus Effect: ZK Crosschain Swap Demo

Avail Nexus is a secure and scalable blockchain interoperability solution that will connect ZK, Optimistic and Sovereign Blockchains and enable seamless liquidity flow between multiple ecosystems. Avail Nexus does this by providing a set of interoperability apps that run on a versatile ZK execution runtime to simplify crosschain message passing between blockchains. With Avail Nexus, developers can build crosschain applications quickly and easily without maintaining deployments on different networks, or navigating disjointed interoperability solutions. Developers can request early access to Avail Nexus now.

The future will require multiple interoperability solutions working together seamlessly, supporting different transaction types based on the specific requirements of developers and users. To support the widest range of applications and use cases possible, Avail Nexus will bring multiple interoperability solutions together. Developers will then be able to easily select an interoperability model that fits their requirements via the Avail Nexus API.

The transaction types supported by Avail Nexus will include:

  • ZK Interop App for highly secure trust minimized transactions.
  • TEE Interop App for trust-minimized transactions that rely on secure hardware.
  • OP Interop App for rapid crosschain transactions that rely on economic security.

In the following demo, we walk through a transaction between two ZK chains where assets are swapped, using the ZK Interop App. This method uses cryptographic proofs, providing the highest level of security.

ZK Nexus Demo: Overview

Below, we show how a user could swap Token A for Token B across two different chains. However, because Avail Nexus takes a generalized approach to crosschain message passing, this could also be used for a wide array of use cases, including securely moving NFTs between different chains, or for casting multichain governance votes.

The following demo is part of the Avail Nexus Examples repo, which we will go through in more detail below. 

ZK Nexus Demo: Explained

  1. The user has funds on a source chain.
  2. A solver helps facilitate the trade and lock in a price for the user to counter any market volatility.
  3. The transaction settles and the user and solver both receive their respective assets.

A simple process flow of the demo is shown below, followed by the demo logs.

The user on the source chain creates a swap intent to swap Token A for Token B. The intent is picked up by the solver, who stakes some amount of Token A which could be slashed to penalize malicious behavior. This doesn’t need to be Token A, and could be any token that binds the Solver to the transaction with economic stake. 

In this POC, the user’s funds (Token A) do not get locked, however that would be necessary to protect against exploits in production.

On the liquidity chain, the Solver then swaps Token A for Token B, effectively locking in the price for the user. 

Token B on the liquidity chain at this point is effectively locked out of supply, and it will back the mint of Token B on the source chain.

Nexus is essentially listening to the Liquidity chain, so it picks up that Token B has been locked. After Nexus verifies the proof from the Liquidity chain, an aggregate proof is generated which verifies the Nexus state, then an inclusion proof to access the app state. While this POC doesn’t yet include the aggregate proof, this will be included in the Nexus testnet soon.

The source chain verifies the Nexus proof and then checks the app inclusion proof. Once the message has been successfully verified, the callback function is triggered and; 

✅ Token B is paid out to the User 

✅ Token A is paid out to the Solver 

Secure Early Access to Avail Nexus Now

If you’d like early access to Avail Nexus, just complete this form and one of the Avail team members will be in touch. 

For more reading on Avail Nexus, check out: