Our Uniswap Hook Incubator Hookathon
.png)
At Rayls, we’re on a mission to bring the power of blockchain to banks and financial institutions without compromising on privacy, compliance, or trust.
As part of this journey, we recently took part in Uniswap Hook Incubator’s Hookathon, a competition exploring the possibilities of Uniswap v4’s new “hooks” architecture.
Our submission, the Rayls Compliance & Privacy Hook, introduced two complementary features that bring privacy-preserving compliance and private trading to DeFi: the Suitability Verifier and Private Swaps , both powered by Zero-Knowledge Proofs (ZK-SNARKs).
Why We Built It
In traditional finance, investors must complete suitability checks before trading certain assets. These checks assess experience, risk appetite, and financial background, but they require users to hand over private data to intermediaries, creating friction, privacy risks, and bureaucracy.
In DeFi, the problem is the opposite: everything is public. When a trader submits a swap, all details are visible on-chain before execution. This transparency exposes users to front-running and MEV (Maximal Extractable Value) attacks, where others exploit advance knowledge of trades for profit.
We wanted to mitigate both sides of that problem:
- Help users prove they’re eligible to trade without revealing their personal data.
- Enable traders to execute swaps privately without exposing their strategy to the world.
What We Built
The Suitability Verifier
The Suitability Verifier allows investors to prove they meet regulatory requirements without revealing how or why.
Users answer a short suitability questionnaire privately, and then generate a Zero-Knowledge Proof - a cryptographic way of saying, “I’ve passed the test,” without showing the answers.
The Uniswap hook verifies this proof on-chain, allowing users to trade with regulatory confidence while keeping all private data secure on their own device.
It’s privacy by design, with compliance built in.
Private Swaps
The Private Swaps extension introduces commit–reveal trading to Uniswap v4, enabling users to conceal their swap parameters until a predefined execution timestamp is reached.
Here’s how it works:
- The user defines their swap (amount, tokenIn, tokenOut, execution timestamp) and signs an ERC-20 permit message to allow token access. They can also select an auditor, who will have permission to view the encrypted swap details.
- Rayls Middleware generates a ZK-SNARK proof of knowledge of these parameters, producing a Poseidon hash. If an auditor is selected, the swap parameters are encrypted using the auditor’s public key, generating a ciphertext. A unique commitment ID is then derived by running keccak256 over the auditor ciphertext and the Poseidon hash.
- Rayls Middleware submits this data via storeCommitment(id, ciphertext, permit) to the Uniswap v4 hook contract, which records the commitment and emits a CommitmentStored event.
- When the timestamp expires, Rayls Middleware privately calls executeCommitment(id, zkProof). The hook verifies the proof’s validity, confirms the commitment, and checks the ERC-20 permit. It then executes the swap through Uniswap’s PoolManager, settles balances, and emits a CommitmentExecuted event.
- Auditor Oversight
At any point, the auditor can retrieve the on-chain ciphertext, decrypt it using their private key, and independently verify the swap parameters for compliance.
This design balances privacy, auditability, and trust : three qualities that rarely coexist in DeFi today.
Key Use Cases
- MEV Protection : By concealing swap intent until execution, traders significantly reduce exposure to front-running and MEV bots.
- Price Impact Mitigation : Large trades can be split into multiple timed commitments, reducing volatility and slippage.
- Compliance & Oversight: DAOs and regulated protocols can prove, on-chain, that their swaps follow pre-approved schedules or tokenomics without revealing internal strategy or sensitive data.
What’s Innovative About It
This project bridges the gap between institutional requirements and DeFi principles.
- For regulators: It demonstrates that compliance and transparency can coexist with user privacy.
- For traders: It offers a new layer of protection against MEV and front-running.
- For Uniswap: It showcases how v4’s flexible “hooks” architecture can extend far beyond AMM logic , powering advanced cryptographic and compliance features directly in the protocol layer.
From a technical standpoint, the challenges were substantial: translating regulatory questionnaires into efficient ZK circuits, building Poseidon hash-based commitments, and integrating ECIES encryption into a hybrid on-chain/off-chain workflow , all while maintaining a simple user experience.
What It Means for Rayls and Uniswap
For Rayls, this project marks an important milestone in our mission to enable institutions to engage with DeFi safely, privately, and compliantly. The Suitability Verifier and Private Swaps demonstrate that it’s possible to align regulatory trust with blockchain transparency.
For Uniswap, it highlights the vast potential of v4’s modular hook architecture. Hooks allow developers to introduce new layers from compliance and privacy to automation and risk control without changing the underlying protocol.
Looking ahead, we see promising opportunities for collaboration. By combining Rayls’ privacy-first infrastructure with Uniswap’s open, permissionless design, we can pave the way for institution-ready DeFi where privacy and compliance are not trade-offs, but core features.
Closing Thoughts
The Uniswap Hook Incubator’s Hookathon gave us the perfect environment to experiment, and the results went far beyond a hackathon prototype.
The Rayls Compliance & Privacy Hook offers a glimpse into the future of decentralised finance one where privacy, auditability, and compliance can operate seamlessly together.
At Rayls, we believe this is the next frontier of finance , and we’re building it, one hook at a time.
.png)


.jpg)