Registry / testing / circom_wasm

circom_wasm

JSON →
library0.2.1jsnpmunverified

Circom_wasm compiles zkSNARK circuits to WebAssembly. Current stable version is 0.2.1 (pre-release, not audited). It is a port of the circom compiler that targets wasm instead of native, enabling client-side circuit compilation. Key differentiators: allows compilation directly in browser/Node.js without native binaries; supports circom v2.1.5 and v2.1.6 syntax. Note: experimental, limited testing, not recommended for production.

npm install circom_wasm
INSTALL
IMPORT
SIG · CIRCOM_WASM
C
circom_wasm
testingjavascriptv0.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

compile
import { compile } from 'circom_wasm';
const compile = require('circom_wasm').compile;
ESM-only package; require() will fail in Node < v12 or without --experimental-modules.
CircomCircuit
import { CircomCircuit } from 'circom_wasm';
import CircomCircuit from 'circom_wasm';
This is a named export, not default.
default
import circomWasm from 'circom_wasm';
import { default } from 'circom_wasm';
Default export is the module itself, not recommended; prefer named imports.

Read a .circom file, compile it to wasm, and instantiate the compiled circuit using CircomCircuit.

import { compile, CircomCircuit } from 'circom_wasm'; import { readFileSync } from 'fs'; async function main() { // Read a circom file const source = readFileSync('circuit.circom', 'utf-8'); // Compile to wasm const circuit = await compile(source, 'circuit.circom'); console.log('Compiled wasm size:', circuit.wasm.byteLength); // Instantiate const instance = new CircomCircuit(circuit); console.log('Instance created'); } main().catch(console.error);
Debug
Known issues
gotchaThe package is experimental and has not undergone sufficient testing; it may produce incorrect circuits or crash.
fix
Use the official native circom compiler for production. Contribute to testing if you use this package.
affects: >=0.0.0
breakingThe 'compile' function signature changed in v0.2.0: previously took a file path, now takes source string and file name.
fix
Update code: pass source code as first argument and filename as second argument.
affects: <0.2.0
deprecatedCircomCircuit class may be renamed in future versions to align with upstream circom. Currently no deprecation warning.
fix
Watch for API changes on GitHub.
affects: >=0.2.0
Errors
Common errors & fixes
Error: Cannot find module 'circom_wasm'
Package not installed or not in node_modules.
fix
Install it: npm install circom_wasm. If using npm <7, ensure you have peer dependency 'circom' installed.
SyntaxError: Unexpected token 'export'
Running a non-ESM environment that doesn't support import/export.
fix
Use a bundler/webpack or set type: 'module' in package.json. Alternatively, downgrade to CommonJS by using the .cjs extension.
TypeError: compile is not a function
Incorrect import: used default import for named export.
fix
Use named import: import { compile } from 'circom_wasm';
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
circomrequiredcircom_wasm is a wasm port of the native circom compiler; requires matching version
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
circom_wasm — npm install circom_wasm · libregistry