npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

uniswap-v4-confidential-hook

v0.0.1

Published

Uniswap v4 Confidential Hook

Readme

Uniswap v4 Confidential Hook

Overview

Uniswap v4 Confidential Hook is a privacy-preserving hook implementation for Uniswap v4 that leverages Zero-Knowledge (ZK) Proof to enable confidential trading with compliance, policy, and strategy verification.

Built with Noir ZK circuits and Solidity smart contracts, this hook ensures that swap and liquidity operations meet specific criteria without revealing sensitive transaction details on-chain.

Key Features

  • ZK-Powered Privacy: Utilizes Noir circuits to generate and verify zero-knowledge proofs for confidential transactions
  • Triple Verification System:
    • Compliance Verification: Ensures transactions meet regulatory compliance requirements
    • Policy Verification: Validates adherence to custom trading policies
    • Strategy Verification: Confirms execution aligns with predefined trading strategies
  • Uniswap v4 Hook Integration: Seamlessly integrates with Uniswap v4's hook architecture
  • BeforeSwap & BeforeAddLiquidity Hooks: Validates ZK proofs before allowing swaps and liquidity additions
  • Honk zkProof System: Leverages Barretenberg's Honk verifier for efficient on-chain proof verification

Use Case

  • Institutional Trading: Allows institutions to execute trades while maintaining confidentiality and proving compliance
  • Privacy-Preserving DeFi: Enables traders to protect their trading strategies while demonstrating adherence to platform policies
  • Regulated Market Access: Facilitates access to DeFi markets with built-in compliance verification
  • Confidential Liquidity Provision: Lets liquidity providers add funds while keeping position sizes and strategies private

Tech Stack

  • ZK Circuit: Noir (v1.0.0-beta.18)

    • ZK Circuit Library: @aztec/bb.js (v3.0.0-devnet.6-patch.1) & @noir-lang/noir_js (v1.0.0-beta.18)
    • Incremental Merkle Tree (IMT) Library: @zk-kit/imt (v2.0.0-beta.8)
  • Smart Contract: Solidity

  • Blockchain: Arbitrum Sepolia Testnet

Architecture & Userflow

                ┌───────────────────────────┐
Enterprise      │ Private intent + identity │
(Institution)   └────────────┬─────────────-┘
                             ▼
                 ┌──────────────--───-┐
                 │ Noir Circuit(s)    │
                 │                    │
                 │ - Policy Proof     │
                 │ - Strategy Proof   │
                 │ - Compliance Proof │
                 └─────────┬──────────┘
                           │ proof + publicInputs
                           ▼
                  ┌─────────────────────────────────┐
                  │ Uniswap v4 Confidential Hook    │
                  │                                 │
                  │ _beforeSwap()                   │
                  │ _beforeAddLiquidity()           │
                  │       ▼                       │
                  │ - verifyComplianceProof()       │
                  │ - verifyPolicyProof()           │
                  │ - verifyStrategyProof()         │
                  └─────────┬───────────────┬───────┘
                            ▼               ▼        
                  ┌──────────────────┐   ┌────────┐
                  │ Pool Liquidity   │   │ Swap   │
                  └──────────────────┘   └────────┘

Deployed Contract Addresses (on Unichain Sepolia)

Newly deployed-contract addresses (on Unichain Sepolia) by this project

| Contract | Address | |----------|---------| | HonkVerifier (of the Compliance ZK circuit) | 0x786B31a1E67a9745f848DFfb6C54a1d8aCCB8F1c | | HonkVerifier (of the Policy ZK circuit) | 0x44B3ae18A72A44b17CD762C48f5206AD4F4A17C9 | | HonkVerifier (of the Strategy ZK circuit) | 0xBb058974aF8cC8A3606bFE952e234Bd8a5E11858 | | ComplianceProofVerifier | 0x1aA877Bfb71e7eC24224415a30E1E0345Dc1d4C0 | | PolicyProofVerifier | 0x132DB810D64ceF15dDA378b58069B2B3daDC434B | | StrategyProofVerifier | 0x98165b549582844227f1CB08375bDf099A991406 | | UniswapV4ConfidentialHook | 0x05f2ba624e4121Ac8D5416f7a33291A010588880 |

Existing deployed-contract addresses (on Unichain Sepolia)

| Contract | Address | |----------|---------| | PoolManager | 0xC81462Fec8B23319F288047f8A03A57682a35C1A | | USDC | 0x31d0220469e10c4e71834a79b1f276d740d3768f | | WETH | 0x4200000000000000000000000000000000000006 |

DEMO Video

  • DEMO of the End-To-End script using ./scripts/e2e.ts: https://www.loom.com/share/e0531eb349aa4662a9949e6a37a6d276

Installation

Noir ZK circuit

  • Circuit Test
cd circuits/invoice-refactoring

sh circuit_test.sh
  • Circuit Artifacts & Solidity Verifier generation
cd circuits/invoice-refactoring

sh build.sh

Smart Contract

  1. Install dependencies:
cd contracts
forge install
  1. Compile contracts:
forge build
  1. Run tests:
IN PROGRESS
  1. Deploy contracts on Unichain Sepolia:
cd contracts/scripts/deployments/unichain-sepolia

sh deploy.sh

Run the e2e script

  • Install the node modules with the bun CLI
cd scripts
bun install
  • e2e script
cd scripts
bun run e2e

References

  • ZK circuit in Noir (powered by Aztec)
    • Noir Documentation

    • Barretenberg Documentation

    • noir-examples/solidity-example

      • js/generate-proof.ts (How to use the verifierTarget: "evm"): https://github.com/noir-lang/noir-examples/blob/master/solidity-example/js/generate-proof.ts#L16
    • Recursive Proof:

      • Doc:https://barretenberg.aztec.network/docs/explainers/recursive_aggregation/
      • noir-examples/recursion:https://github.com/noir-lang/noir-examples/tree/master/recursion
  • Uniswap v4 Hook

    • Template: https://github.com/uniswapfoundation/v4-template
  • Unichain

    • Fancet: https://docs.unichain.org/docs/tools/faucets
    • WETH: You can convert your Narive ETH to the WETH by calling the deposit() in the Block Explorer: https://unichain-sepolia.blockscout.com/address/0x4200000000000000000000000000000000000006?tab=read_write_contract
    • USDC: https://faucet.circle.com/
  • Uniswap v4