When I was at Perpetual Protocol, the team had proposed an incredibly interesting and exciting idea with regards to gateway contracts sitting on various networks accepting USDC and upon USDC being received would mint an equivalent amount of virtual USD inside Perpetual Protocol itself, a truly multichain experience allowing users to deposit collateral into Perpetual Protocol, regardless of the chain. There were multiple issues with this however, you would have to take into liquidations across multiple chains, cross-chain messaging at the time was currently not as developed as today with the latency leading to a terrible UX. The idea was not pursued any further, however, it had always stuck with me and even some platforms have implemented solutions similar to it, with widgets that allow you to bridge from multiple chains to the chain the DEX sits on such as XY/Lifi. The idea might be possible and done even better by not necessarily a cross-chain messaging solution, but by utilizing co-processors to not only take data from multiple chains to prove that collateral had been accepted on some gateway chain.
What is a ZK-Coprocessor?
Multiple definitions for co-processors are pretty technical and need to be unpacked quite a bit, but Mo from Brevis put it quite simply as "empowering smart contracts with the capabilities of Dune Analytics." Essentially allowing you to leverage the history of blockchain data, such as states, transactions and events and even run some sort of computation using that data so that it can be utilized on-chain. The ZK part is largely to providing cryptographic guarantees that the computation is equivalent to that performed on-chain. There are quite a few protocols that are currently building in this space with some of the notable players being Lagrange, Brevis, Axiom and Herodotus.
Solving the Perp Exchange Case
With regards to my initial example, it could easily verify locked assets on any chain that the co-processor supports and once it has been verified mint an according amount of virtual USD. However, I believe the possibilities do not have to stop there. It could also allow different types of collateral to be used on any chain. As an example, if Avalanche was a gateway chain, AVAX could also be used as a type of collateral within Perpetual Protocol as long as it was being locked on the Avalanche chain itself. The discount factor could be calculated by using trading data from Trader Joe to take into account volatility, liquidity and other factors in order to compute a relevant discount for AVAX as collateral. This could be replicated to the base asset of each gateway chain or even tokens that have large amounts of liquidity predominantly on a particular chain, increasing the potential amount of traders, and allowing for differing structured products to be built utilizing the exchange.
Other Potential DeFi Use Cases
There already have been frequent discussions for what type of use cases ZK Co-processors could enable within DeFi, I won't be listing all of them but will attempt to highlight a few of the more interesting use cases that I think will ultimately be adopted by projects. The first use case that is lightly touched on in the exchange case was the idea around complex cross-margin systems that projects such as Aevo currently employ where positions across their different derivative products (options and perpetuals) can "cancel" each other out, enabling more free margin. However, these systems currently are all run off-chain as the level of computation needed to perform these types of actions would not be feasible on-chain. With a co-processor, all the information necessary to compute the margin could be calculated, verified and posted back on-chain. This would allow for exchanges to free up collateral to make either additional trades or allow for more complex trading strategies on a single venue now done in a trustless way. Another interesting idea more on the liquidity provision side is creating an incentive around rewarding LPs who still actively provide levels of liquidity even during market volatility. They would be compensated with either extra farming rewards, an extra % of fees etc. This could be done easily by utilizing a co-processor to take in all positions, see which have been the most loyal even during market downturns and then reward them. There are still some incredibly interesting things that I won't discuss here but include creating dynamic fee AMMs where you could take into account past volatility or dynamic pricing functions for things that are done on-chain.
Conclusion
The use cases for zk co-processors are currently still being explored. Still, it is exciting to see what could potentially be done utilizing them and even more so exciting that it could be a solution to an idea that I had at the back of my mind for a while now. As these are mainly my thoughts I have only started to explore the applications for co-processors in DeFi, only scratching the surface for the broader use cases zk co-processors have in crypto.