零知识证明

LoopyLuci2026-10-27查看 1723复制 458

在实现零知识证明系统时使用。

Download (.md)

📘如何使用这个技能

  1. 1
    复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
  2. 2
    打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
  3. 3
    粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
  4. 4
    直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景

💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。

SKILL.md1952 chars
---
name: zero-knowledge-proofs
description: "Use when implementing zero-knowledge proof systems."
version: 1.0.0
author: Hermes Agent
license: MIT
metadata:
  hermes:
    tags: [zero-knowledge, ZKP, zkSNARKs, zkSTARKs, circom, cryptography]
    related_skills: [blockchain-development-solidity, cryptography-implementation-patterns, defi-smart-contracts, tokenomics-design]
---

# Zero-Knowledge Proofs

Implementing zero-knowledge proof systems — from zkSNARKs and zkSTARKs through circuit design (Circom), proof generation/verification, and practical applications.

## When to Use

- Privacy-preserving transactions on blockchain
- Verifiable computation (prove computation is correct)
- Identity and credential verification without revealing data
- Scalability (zk-rollups for Ethereum)
- Confidential smart contracts

## ZKP Fundamentals

```python
ZKP_TYPES = {
    'snark': 'Succinct Non-interactive Argument of Knowledge — small proofs, trusted setup (Groth16, PLONK)',
    'stark': 'Scalable Transparent ARgument of Knowledge — no trusted setup, larger proofs, quantum-resistant',
    'bulletproofs': 'No trusted setup, short proofs, used in Monero',
}

"""
// Circom circuit: prove knowledge of hash preimage without revealing it
pragma circom 2.0.0;

template HashPreimage() {
    signal input preimage;
    signal output hash;
    
    component hasher = MiMC7(10);
    hasher.x_in <== preimage;
    hash <== hasher.out;
}

component main { public [hash] } = HashPreimage();
"""
```

## Verification Checklist

- [ ] ZKP system chosen (SNARK, STARK, Bulletproofs)
- [ ] Circuit defined in Circom or similar DSL
- [ ] Trusted setup ceremony completed (if SNARK)
- [ ] Proving key and verification key generated
- [ ] Proof generation time acceptable for use case
- [ ] Verification gas cost (if on-chain) measured
- [ ] Security: circuit soundness, no under-constrained signals
- [ ] Integration tested (prover in app, verifier in contract)
来源:skillsdirectory

评论0

登录后参与评论

还没有评论,来抢沙发吧