core-concepts:privacy-patterns
OfficialPrivacy-preserving patterns for Compact
System Documentation
What problem does it solve?
This Skill helps developers design and reason about privacy-preserving patterns for Compact smart contracts so on-chain protocols can hide sensitive values, prove membership anonymously, and prevent linkability or double-actions without leaking secret data. It synthesizes commitments, nullifiers, Merkle membership proofs, commit-reveal flows, selective disclosure, and round-based unlinkability into actionable guidance and threat mitigations.
Core Features & Use Cases
- Commitment vs Hash Guidance: When to use persistentCommit (hiding with randomness) versus persistentHash or transient variants, and how witness taint is affected.
- Nullifier Construction & Domain Separation: Patterns to derive round-specific or purpose-specific nullifiers and store them safely in Sets to prevent double-actions.
- MerkleTree & HistoricMerkleTree Usage: End-to-end anonymous membership proofs, computing merkleTreePathRoot from full path structs, and TypeScript witness integration for path construction.
- Selective Disclosure & Threat Model: Techniques to disclose boolean checks only, mitigate leaf-guessing, and plan capacity and timing to reduce deanonymization risks.
- Use Case Example: Build an anonymous voting system where members register commitments, prove membership with Merkle paths, and cast one vote per round via nullifiers.
Quick Start
Ask the assistant to design a Compact circuit that registers members with HistoricMerkleTree, derives round-specific nullifiers via domain-separated persistentHash, and enforces a commit-reveal or single-action-per-round flow while preserving selective disclosure.
Dependency Matrix
Required Modules
None requiredComponents
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: core-concepts:privacy-patterns Download link: https://github.com/devrelaicom/midnight-expert/archive/main.zip#core-concepts-privacy-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.