midnight-core-concepts:privacy-patterns

Implement privacy-preserving on-chain logic with hashes, commitments, Merkle trees, and nullifiers.

Updated Feb 5, 2026
One-click install
npx skills add https://github.com/aaronbassett/midnight-knowledgebase --skill midnight-core-concepts-privacy-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: midnight-core-concepts:privacy-patterns
Source: https://github.com/aaronbassett/midnight-knowledgebase/tree/main/plugins/midnight-core-concepts/skills/privacy-patterns
Command: npx skills add https://github.com/aaronbassett/midnight-knowledgebase --skill midnight-core-concepts-privacy-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a toolkit for implementing privacy-preserving logic on the Compact platform by combining hashes, commitments, Merkle trees, and nullifier patterns to keep data private while enabling verifiable proofs.

Core Features & Use Cases

  • Pattern-based privacy primitives: Hashes, Pedersen commitments, Merkle trees, and nullifiers to hide data while enabling verification.
  • On-chain privacy scenarios: Private ballots, confidential asset commitments, and membership proofs where sensitive information must remain secret but verifiable.
  • Reference implementations: Example circuits and references demonstrating how to compose these primitives in real workflows.

Quick Start

Implement a small example that proves a secret value is in a precomputed Merkle tree using a path and a commitment.

Frequently Asked Questions about midnight-core-concepts:privacy-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement privacy-preserving logic for on-chain data using Compact?

To implement privacy-preserving on-chain logic in Compact, you combine hashes, Pedersen commitments, Merkle trees, and nullifier patterns. This approach keeps your application data private while still enabling verifiable proofs for on-chain state transitions.

What are on-chain nullifiers and Merkle tree commitments used for?

On-chain nullifiers prevent double-spending or double-voting by tracking spent commitments, while Merkle trees compactly commit to large datasets. Together, they allow you to prove membership or validity without revealing the underlying private data.

How do I build a private ballot or confidential asset commitment circuit?

You can build private ballots and confidential asset commitments by composing hashes and Merkle tree proofs within Compact circuits. The Skill provides reference implementations demonstrating how to structure these proofs to keep votes or asset amounts secret yet verifiable.

Do I need to understand persistentCommit and MerkleTree types to use these privacy patterns?

Yes, you need familiarity with Compact constructs like persistentCommit, MerkleTree types, and nullifier tracking. These constructs are required to properly structure your circuits and generate proofs for private on-chain logic.

When should I use nullifier tracking versus simple hash commitments?

Use nullifier tracking when you must prevent an action from occurring twice, such as double-voting in a private ballot or spending a confidential asset twice. Simple hash commitments suffice when you only need to hide data without enforcing spend or vote uniqueness.