> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloak.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# Circuits Package

> How transaction circuits are built and consumed across SDK and programs

`packages/` contains the zk circuit toolchain used by Cloak.

## Canonical transaction circuit

* File: `packages/circuits/transaction.circom`
* Template: `Transaction(32, 2, 2)`
* Public signals: `root`, `publicAmount`, `extDataHash`, `mintAddress`, `inputNullifier`, `outputCommitment`, `chainNoteHash`

This is the circuit shape consumed by both SDK and on-chain verifier logic.

## Build pipeline

`packages/justfile` orchestrates:

* circom compile
* Groth16 setup/beacon
* verification key export
* artifact copy for SDK/web consumers
* vkey conversion for on-chain binary include

## Important scripts

* `packages/scripts/convert-vkey.ts`: transforms JSON vkey into verifier binary layout
* Artifact publishing: circuit artifacts and the manifest are published to the hosted
  circuits bucket (`storage.googleapis.com/cloak-circuits`) consumed by both SDKs

## Consumer surfaces

* SDK proof generation reads circuit artifacts for witness/proof generation
* Program build includes converted verifier key binary
* Tests and integration fixtures depend on artifact consistency

## Operational note

Keep artifact paths and copy steps synchronized across `packages`, `sdk`, and `programs`; mismatched paths are a common source of runtime proof-loading failures.
