circom-2-arithc(-ts)
TypeScript library for compiling circom to arithmetic circuits backed by
namnc/circom-2-arithc.
Usage
npm install circom-2-arithc
import * as c2a from 'circom-2-arithc';
async function main() {
await c2a.init();
const circuitSrc = {
'/src/main.circom': `
pragma circom 2.0.0;
template Adder() {
signal input a, b;
signal output c;
c <== a + b;
}
component main = Adder();
`,
};
const circuit = c2a.Circuit.compile(circuitSrc);
console.log(
circuit.evalArray(new Uint32Array([3, 5])),
);
}
main().catch(console.error);
Development
Build with npm run build
. This will compile the wasm subproject and also
transpile typescript into javascript. Rust toolchain
required.
Test with npm test
.
Example Project
For a more complete MPC example in the form of a repository, see
mpz-ts-example.