After initial breakthroughs during DeFi summer, that included the popularization of constant function AMMs like Uniswap or overcollateralized on-chain lending protocols like Aave, innovation and progress in DeFi has … slowed.
Part of this slowdown stems from the peculiarities of on-chain finance: transaction latency from block times, slippage in trades stemming from MEV, and low liquidity environments that are ripe for exploits, all of which require the development of new financial theory.
But not all products require a re-invention of the wheel. For many builders porting over existing financial models and theories on-chain is very low-hanging fruit, especially when combined with some crypto secret sauce. But the difficulties in smart contract development, notably gas-limits, and the quirks (to put it gently) of smart contract languages like Solidity make this quite the undertaking.
Wouldn’t it be nice if your resident quant could take their strategies living in python notebooks and immediately convert them into smart contracts? Wouldn’t it be great if you could express something as complex as an LLM and “run it on-chain” without ever touching Solidity and without running into gas limits?
Further, if the strategy is proprietary, you might not want to reveal it all on-chain (alpha leak). Is there a way we could verify that a pool is following your intended strategy, without revealing the strategy itself to the world? Yes, by fully leveraging ZK.
Would this empower DeFi builders to bring henceforth unrealizable products on chain? Would this bring on an eternal summer of DeFi ?????
EZKL and QuantAMM certainly believe so and are working together to bring this vision to life.
What is QuantAMM
QuantAMM is revolutionizing automated market making (AMM) by developing dynamic pools that execute complex™️ quantitative strategies. While sophisticated on-chain trading strategies have long been out of reach for gas-constrained devs, QuantAMM has overcome these technical barriers through mathematical prowess.
As launch partners for Balancer’s upcoming V3, QuantAMM will deploy dynamic weighted pools directly on the Balancer vault. Initially, they will leverage Chainlink automation and oracles to implement well-established quantitative strategies like momentum and mean reversion, bringing sophisticated fund management natively on-chain. They call the resulting products “Blockchain Traded Funds” (BTFs).
For more advanced strategies, QuantAMM is pioneering the use of zero-knowledge proofs—specifically EZKL—to verify strategy execution. Building on the same Balancer+Chainlink stack, this breakthrough allows complex algorithms to be run off-chain while only verifying correct execution on-chain. The approach addresses a critical challenge in asset management: protecting proprietary algorithms from potential alpha leak. Unlike current decentralized finance platforms where strategies are fully visible on-chain, zero-knowledge proofs enable QuantAMM to maintain strategy privacy while ensuring computational integrity.
Weight Update Function
First, we define our momentum weight update function that calculates how pool weights should change as a jitted jax function. We will assume that the price gradient is given at the time of the weight update.
from jax import jit
import jax.numpy as jnp
@jitdef_jax_momentum_weight_update(price_gradient, k):
offset_constants =-(
k * price_gradient
).sum(axis=-1, keepdims*=True) / (jnp.sum(k))
weight_updates = k * (price_gradient + offset_constants)
weight_updates = jnp.where(k ==0.0, 0.0, weight_updates)
return weight_updates
This function _jax_momentum_weight_update outputs the change in portfolio weights for the current value of the input price_gradient, with the extent of the change depending on the scalar or vector quantity k.
Converting to ONNX
To use EZKL, we need to convert our JAX function to ONNX format. We created a wrapper that handles this conversion which
first converts the jax function to a tensorflow function using the jax2tf function
then convert that tensorflow function to an onnx model.
Proof Generation
The proof generation process involves several steps:
Setting up visibility parameters for inputs/outputs
Zero-knowledge proofs enable complex quantitative strats to be used by QuantAMM’s on-chain pools, massively lowering running costs and meaning any python quant can spin up a DeFi product running their strategy. They also offer a promising way to balance transparency and privacy in implementing dynamic pools that aim to chain their holdings over time. This proof of concept shows how we can verify asset management strategies while keeping sensitive parameters private, potentially opening new possibilities for competitive strategies run on-chain.
This approach could help bridge the gap between traditional, powerful, but hitherto necessarily centralized, quantitative asset management strategies and DeFi with its need for transparency. The complete implementation will go live on QuantAMM in 2025.