Skip to content

BootNodeDev/zama-s2-bounty-skills

Repository files navigation

zama-s2-bounty-skills

A Claude Code skill bundle for building confidential smart contracts on Zama's FHEVM — fully homomorphic-encryption EVM. Authored by BootNode for Zama Bounty Track Mainnet S2.

The bundle wraps the FHEVM v0.11.x stack into 12 routed skills covering protocol concepts, contract authoring, ERC-7984 confidential tokens, decryption flows, testing, static analysis, and React/Next.js + Vite frontends. A canonical Hardhat workspace ships alongside in project/, and /create-template scaffolds either contracts, frontend, or both into a fresh directory in seconds.

What's inside

Path What it is
skills/fhevm-overview/ Protocol mental model — coprocessor, KMS, gateway, relayer; ZKPoK input-proof flow; v0.9+ async decryption
skills/fhevm-setup/ Hardhat workspace bootstrap; hardhat vars workflow; pinned versions
skills/fhevm-contracts/ @fhevm/solidity@0.11.x API: encrypted types, FHE.* ops, ACL lifecycle, input proofs, control-flow patterns
skills/fhevm-erc7984/ OpenZeppelin confidential tokens: IERC7984, FHESafeMath, the v0.4 extension family, 10 DeFi blueprints
skills/fhevm-decryption/ User decryption + the v0.9 three-step public-decrypt pattern via @zama-fhe/sdk@3.0.0
skills/fhevm-testing/ Mocha + Hardhat patterns; hre.fhevm.isMock gating; mock KMS proof construction; three-gate ship checklist
skills/fhevm-frontend/ React (Vite + Next.js App Router) integration; ZamaProvider; encrypt/decrypt hooks; ERC-7984 wrap/unwrap UI
skills/fhevm-antipatterns/ v0.11-era rename catalogue, the 12 high-frequency footguns, debug checklist
skills/fhevm-static-analysis/ Slither / Aderyn / Semgrep / Halmos integration on FHEVM contracts (incl. ZamaConfig source-map workaround)
skills/create-template/ /create-template wizard — scaffold contracts-only / frontend-only / both into a new repo
project/ Canonical Hardhat workspace — three flagship contracts (counter, ERC-7984 token, voting), Sepolia + mock tests, deploy scripts
templates/frontend-next/, templates/frontend-vite/ React frontend skeletons consumed by /create-template

Install

This repo is packaged as a Claude Code plugin named bn-fhevm. Once installed, the ten skills surface as /bn-fhevm:fhevm-overview, /bn-fhevm:fhevm-contracts, etc. — namespaced so they don't collide with skills from other plugins.

Option 1 — Claude Code marketplace (recommended)

From any Claude Code session:

/plugin marketplace add github:BootNodeDev/zama-s2-bounty-skills
/plugin install bn-fhevm

Option 2 — install script (no marketplace, no clone)

Copy the plugin into a target directory in one command:

mkdir -p /path/to/your/project
curl -fsSL https://raw.githubusercontent.com/BootNodeDev/zama-s2-bounty-skills/main/scripts/install.sh | bash -s /path/to/your/project

The target's .claude-plugin/plugin.json + skills/ get populated. Per-file overwrite prompts; non-interactive runs (CI, piped) default to "no".

Option 3 — from a local clone

git clone https://github.com/BootNodeDev/zama-s2-bounty-skills.git
cd zama-s2-bounty-skills
./scripts/copy-plugin.sh /path/to/your/project

Use the contracts workspace directly

npm --prefix project install
npm --prefix project test                  # mock-mode tests
npm --prefix project run test:sepolia      # real Sepolia (requires hardhat vars)

Scaffold a fresh project

From inside Claude Code, with this plugin installed:

/bn-fhevm:create-template

Quick scaffold via /create-template

/create-template is an interactive wizard. Choose:

  • contracts — copies project/ into your target directory
  • frontend (Next.js) or frontend (Vite) — copies the matching template
  • both — contracts + frontend in one shot

It customizes package.json metadata, .env defaults, and the Sepolia RPC URL via AskUserQuestion prompts — no hand-editing.

Example prompts

Three prompts that exercise different parts of the bundle. Drop any of them into a Claude Code session in a project with these skills available.

1. Greenfield: scaffold, write, test

Scaffold a fresh FHEVM Hardhat workspace at ./encrypted-counter using /create-template, then implement a counter whose value is an euint64 readable only by the deployer via user decryption. Grant ACL with FHE.allowThis after every state write and FHE.allow(deployer) in the constructor. Add Mocha tests that pass in mock mode (hre.fhevm.isMock) and userDecryptEuint the value to assert it.

Exercises: create-template, fhevm-setup, fhevm-contracts, fhevm-testing, fhevm-decryption.

2. ERC-7984 token + Next.js wrap/unwrap UI

Implement an ERC-7984 confidential token with operator support (setOperator, no approve/allowance) and an ERC20-wrapper path using ERC7984ERC20Wrapper. Use FHESafeMath.tryIncrease/tryDecrease for all balance mutations. Then add a Next.js App Router page using ZamaProvider from @zama-fhe/react-sdk@3.0.0 with a wrap → transfer → unwrap flow. Include tests for the operator-pattern transfer path, and run Slither against the contracts (use the canonical slither . invocation, not npx slither).

Exercises: fhevm-erc7984, fhevm-frontend, fhevm-testing, fhevm-static-analysis.

3. Brownfield review and v0.9 → v0.11 migration

Audit contracts/ for the 12 FHEVM antipatterns, the v0.11 rename catalogue (TFHEFHE, SepoliaZamaFHEVMConfigZamaEthereumConfig, ConfidentialFungibleTokenERC7984, TFHESafeMathFHESafeMath, isUserAllowedcanTransact), and any remaining FHE.requestDecryption oracle callbacks. List findings ordered by severity, then propose a migration patch that replaces FHE.requestDecryption with the v0.9 three-step makePubliclyDecryptable → off-chain publicDecryptFHE.checkSignatures flow.

Exercises: fhevm-antipatterns (incl. references/v0.11-migration.md), fhevm-decryption, fhevm-contracts.

Stack

  • Solidity 0.8.27 (evmVersion: cancun)
  • Hardhat 2.28.x + @fhevm/hardhat-plugin@0.4.2 (mock coprocessor on hardhat network)
  • @fhevm/solidity@0.11.1, @fhevm/mock-utils@0.4.2, @openzeppelin/confidential-contracts@0.4.0
  • @zama-fhe/sdk@3.0.0 (frontend), @zama-fhe/relayer-sdk@0.4.1 exact (Hardhat-side)
  • Node >= 20 (contracts), >= 22 (frontend SDK)

Full pinned table lives in skills/fhevm-overview/SKILL.md.

Documentation map

  • architecture.md — repo structure + FHEVM data flow
  • CLAUDE.md — agent conventions for working in this repo
  • project/README.md — Hardhat workspace usage + customizations vs upstream fhevm-hardhat-template

License

MIT — see LICENSE.

About

Zama Bounty Track . AI Skills for Zama development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors