zk-circuits
БесплатноБез исполняемых скриптовНе проверенZero-knowledge circuit development using Circom and Noir languages. Supports constraint optimization, ZK-friendly cryptographic primitives, proof generation…
от a5c-ai★ 1 947 звёзд на GitHubОб этом скилле
ZK Circuit Development Skill
Zero-knowledge circuit development using Circom and Noir for privacy-preserving applications and zkRollups.
Capabilities
- Circom Circuits: Write Circom templates and components
- Noir Programs: Develop Noir ZK applications
- Constraint Optimization: Minimize circuit constraints
- ZK Primitives: Use Poseidon, MiMC, and Pedersen hashes
- Proof Systems: Generate Groth16 and PLONK proofs
- Signal Design: Design efficient circuit inputs/outputs
- Merkle Trees: Implement membership and non-membership proofs
- Witness Generation: Create efficient witness calculators
Circom Development
Installation
# Install Circom
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
git clone https://github.com/iden3/circom.git
cd circom
cargo build --release
cargo install --path circom
# Install snarkjs
npm install -g snarkjs
# Verify
circom --version
snarkjs --version
Basic Circuit
pragma circom 2.1.6;
// Simple addition circuit
template Addition() {
// Public inputs
signal input a;
signal input b;
// Output (public by default)
signal output c;
// Constraint
c <== a + b;
}
component main = Addition();
Multiplier Circuit
pragma circom 2.1.6;
template Multiplier(n) {
signal input in[n];
signal output out;
signal intermediate[n];
intermediate[0] <== in[0];
for (var i = 1; i < n; i++) {
intermediate[i] <== intermediate[i-1] * in[i];
}
out <== intermediate[n-1];
}
component main {public [in]} = Multiplier(3);
Hash Circuit (Poseidon)
pragma circom 2.1.6;
include "circomlib/circuits/poseidon.circom";
template HashPreimage() {
signal input preimage;
signal input hash;
component hasher = Poseidon(1);
hasher.inputs[0] <== preimage;
// Verify hash
hash === hasher.out;
}
component main {public [hash]} = HashPreimage();
Merkle Tree Membership
pragma circom 2.1.6;
include "circomlib/circuits/poseidon.circom";
include "circomlib/circuits/mux1.circom";
template MerkleProof(levels) {
signal input leaf;
signal input root;
signal input pathElements[levels];
signal input pathIndices[levels];
component hashers[levels];
component adapter[levels];
signal levelHashes[levels + 1];
levelHashes[0] <== leaf;
for (var i = 0; i < levels; i++) {
hashers[i] = Poseidon(2);
adapter[i] = Mux1();
adapter[i].c[0] <== levelHashes[i];
adapter[i].c[1] <== pathElements[i];
adapter[i].s <== pathIndices[i];
hashers[i].inputs[0] <== adapter[i].out;
hashers[i].inputs[1] <== levelHashes[i] + pathElements[i] - adapter[i].out;
levelHashes[i + 1] <== hashers[i].out;
}
root === levelHashes[levels];
}
component main {public [root]} = MerkleProof(20);
Circom Build Process
# Compile circuit
circom circuit.circom --r1cs --wasm --sym -o build
# Generate witness
node build/circuit_js/generate_witness.js build/circuit_js/circuit.wasm input.json witness.wtns
# Powers of Tau ceremony (one-time)
snarkjs powersoftau new bn128 14 pot14_0000.ptau
snarkjs powersoftau contribute pot14_0000.ptau pot14_0001.ptau
snarkjs powersoftau prepare phase2 pot14_0001.ptau pot14_final.ptau
# Generate proving key (Groth16)
snarkjs groth16 setup build/circuit.r1cs pot14_final.ptau circuit_0000.zkey
snarkjs zkey contribute circuit_0000.zkey circuit_final.zkey
# Export verification key
snarkjs zkey export verificationkey circuit_final.zkey verification_key.json
# Generate proof
snarkjs groth16 prove circuit_final.zkey witness.wtns proof.json public.json
# Verify proof
snarkjs groth16 verify verification_key.json public.json proof.json
# Generate Solidity verifier
snarkjs zkey export solidityverifier circuit_final.zkey Verifier.sol
Noir Development
Installation
# Install Noir (Nargo)
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
noirup
# Verify
nargo --version
Basic Noir Program
// src/main.nr
fn main(x: Field, y: pub Field) {
assert(x != y);
}
Hash Verification
use dep::std::hash::pedersen_hash;
fn main(preimage: Field, hash: pub Field) {
let computed_hash = pedersen_hash([preimage]);
assert(computed_hash == hash);
}
Merkle Proof in Noir
use dep::std::hash::poseidon;
use dep::std::merkle::compute_merkle_root;
fn main(
leaf: Field,
index: Field,
hash_path: [Field; 20],
root: pub Field
) {
let computed_root = compute_merkle_root(leaf, index, hash_path);
assert(computed_root == root);
}
Noir Build Process
# Create project
nargo new my_circuit
cd my_circuit
# Edit src/main.nr
# Edit Prover.toml with inputs
# Compile
nargo compile
# Generate witness
nargo execute
# Generate proof
nargo prove
# Verify proof
nargo verify
Opt
Установить zk-circuits в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepWriteBashEditGlobWebFetchВложенные файлы
FAQ
Что делает скилл zk-circuits?
Zero-knowledge circuit development using Circom and Noir languages. Supports constraint optimization, ZK-friendly cryptographic primitives, proof generation (Groth16, PLONK), and Merkle tree implementations.
Как установить скилл zk-circuits?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл zk-circuits запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic