Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

circom-2-arithc

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circom-2-arithc

Library for compiling circom to arithmetic circuits

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

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 = {
    // In a real project you should be able to include these as regular files,
    // but how those files find their way into this format depends on your build
    // tool.

    '/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(
    // In future named inputs and outputs should work via
    // `circuit.eval({ a: 3, b: 5 })`
    circuit.evalArray(new Uint32Array([3, 5])),
  ); // [8]

  // For use with mpz-ts, use `circuit.toMpzCircuit()` (not yet implemented).
}

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.

Keywords

FAQs

Package last updated on 14 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc