@zefi/circomjs
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

CIRCOMJS

CircomJS is a javascript framework for automating and easing workflow around developing in the Circom DSL.

We would suggest getting started with this gitbook, and you should also checkout our blog post on why we made CircomJS.

The framework operates on a simple circuit.config.js file, which is a configuration file for circomJS.

img_1.png

You can also take a look at CircomJS starter repository for reference.

CircomJS gives you the following capabilities in Javascript!

Compile your circuits

const {CircomJS} = require("@zefi/circomjs")

const main = async() => {
    const circomjs = new CircomJS()
    const circuit =  circomjs.getCircuit("mul")

    // it will build the circuit with cID mul
    await circuit.compile()
}

main()

Generate Proofs

const {CircomJS} = require("@zefi/circomjs")

const main = async() => {
    const circomjs = new CircomJS()
    const circuit =  circomjs.getCircuit("mul")

    // important to await compilation, before running circuit.genProof()
    await circuit.compile()

    const input = {
        x: 3,
        y: 5
    }

    const proof = await circuit.genProof(input);
    console.log("proof verification result ----->",await circuit.verifyProof(proof))
}

main()

Verify proofs

const {CircomJS} = require("@zefi/circomjs")

const main = async() => {
    const circomjs = new CircomJS()
    const circuit =  circomjs.getCircuit("mul")

    // important to await compilation, before running circuit.genProof()
    await circuit.compile()

    const input = {
        x: 3,
        y: 5
    }

    const proof = await circuit.genProof(input);
    console.log("proof verification result ----->",await circuit.verifyProof(proof))
}

main()

and much more!

You can do a lot more than this:

  • calculate witness
  • calculate total constraints
  • check constraints on a generated witness
  • export solidity smart contract verifier { coming-soon }
  • export solidity call-data { coming-soon }

Upcoming features

We are working towards adding new features to the framework, some of which include:

  • Support for C compilation of circuits { witness generation programs }
  • Automatic download of ideal power of tau file
  • Parallel build of ZK Circuits
  • Integration with Ethersjs to deploy smart contract verifiers
  • Using sha-256 hashing to only build circuits when source code changes

We at zefi are open to ideas around the project and would love to interact with the community and see contributions comings its way, feel free to join our telegram group and say hi, also feel free to write to us at contact@zefi.io.

Package Sidebar

Install

npm i @zefi/circomjs

Weekly Downloads

6

Version

1.0.6

License

ISC

Unpacked Size

461 kB

Total Files

80

Last publish

Collaborators

  • authlayer-dev