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

privacy-protocol

v0.1.5

Published

Plug-and-play privacy middleware SDK with core primitives and React hooks.

Readme

privacy-protocol

Privacy Protocol is a relayer-first privacy middleware for EVM dApps.

Package exports:

  • privacy-protocol/core: low-level SDK
  • privacy-protocol/hooks: React hooks

No manual circuit import is required. The Noir circuit is bundled.

Install

npm install privacy-protocol ethers

For React apps:

npm install react

Core SDK (Quickstart)

import { ethers } from "ethers";
import { PrivacyProtocolSDK } from "privacy-protocol/core";

const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const signer = await provider.getSigner();

const sdk = new PrivacyProtocolSDK(provider, process.env.PRIVACY_PROTOCOL_POOL_ADDRESS!);

Relayer transport is built in by default. You only pass options.relayer if you want to override the default endpoint or relayer metadata.

const sdkWithCustomRelayer = new PrivacyProtocolSDK(
  provider,
  process.env.PRIVACY_PROTOCOL_POOL_ADDRESS!,
  undefined,
  {
    relayer: {
      url: process.env.PRIVACY_PROTOCOL_RELAYER_URL,
      relayerAddress: process.env.PRIVACY_PROTOCOL_RELAYER_ADDRESS,
    },
  },
);

Typical Flow

  1. Approve token spend to poolAddress.
  2. Deposit with sdk.deposit(...).
  3. Build leaves with sdk.getLeaves().
  4. Execute private action (sdk.executeAction(...)) or withdraw (sdk.withdraw(...)).
  5. Persist returned note fields (secret, nullifier, commitment).

Relay Lifecycle

Private executeAction/withdraw initially return:

  • txHash: "relay:<request_id>"

As relayer submission progresses:

  • request is queued (queued)
  • on-chain tx is submitted (submitted)
  • tx confirms (success/reverted)

Use:

const details = await sdk.getPrivateTransactionDetails(txHash);

If relayer has already submitted, this resolves to actual on-chain metadata (tx.from, gas payer, status, etc).

React Hooks

import {
  useDeposit,
  useExecuteAction,
  useWithdraw,
  useCommitments,
  usePrivateTransactionDetails,
  useLocalNotes,
} from "privacy-protocol/hooks";

Minimal hook setup:

const common = {
  poolAddress,
  provider,
  signer,
};

const { deposit } = useDeposit(common);
const { executeAction } = useExecuteAction(common);
const { withdraw } = useWithdraw(common);

You can still pass relayer in hook options to override defaults per app.

Required Inputs

  • Deployed PrivacyProtocolPool address
  • Ethers provider + signer
  • Supported token address in pool
  • Storage for note material and tx metadata

Common Errors

  • InvalidRootHash: stale leaves/root; refresh leaves and ensure latest SDK build.
  • InvalidProof: mismatched note inputs or action context.
  • NullifierUsed: note already spent.
  • TokenNotSupported: token not added to pool.