Skip to main content

TACEO:Proof CoNoir

To make it easy to seamlessly integrate TACEO:Proof into your applications, we implemented client libraries for different languages. You can find the client libraries and example clients in the proof-client repository. There you will find installation instructions and example circuits.

The JavaScript clients use WebAssembly generated with wasm-pack and therefore need different packages for different targets. Currently we support nodejs and bundler with their respective npm packages @taceo/proof-client-node and @taceo/proof-client-bundler.

  • Installation: Install the package for your target using your favorite package manager

    npm install @taceo/proof-client-node
  • Setup: Create the API client configuration

    const configParams: ConfigurationParameters = {
    basePath: "https://proof.taceo.network",
    }
    const configuration = new Configuration(configParams)
    const jobInstance = new JobApi(configuration );
    const nodeInstance = new NodeApi(configuration );
  • Witness Extension + Prove Job:

    With a full prove job, the input is secret-shared, encrypted, and distributed to the designated nodes for processing. The workflow does not require a precomputed extended witness; instead, the witness extension is generated during the job execution, which is then followed by proof generation. This approach eliminates the need to upload potentially large witnesses.

    const nodes = await nodeInstance.randomNodeProviders();
    const blueprintId = "54f9ee38-0160-44e2-a1d8-08d1b6771cbf";
    const voucher = null; // only required for Restricted blueprints
    const abi = JSON.parse(fs.readFileSync("abi.json").toString());
    const publicInputs = new Uint32Array([1, 2]); // Replace with actual public input indices
    const input = JSON.parse(fs.readFileSync("Prover.json").toString());
    const jobId = await CoNoir.scheduleFullJob(
    jobInstance,
    nodes,
    blueprintId,
    voucher,
    abi,
    publicInputs,
    input
    );
  • Multiple Inputs Witness Extension + Prove Job:

    This job supports multiple inputs from different users without revealing inputs to each other. Once all inputs for the job are present, it is sent to designated nodes, which then execute the job. Additionally, an optional deadline can be set to limit the amount of time that can pass before all inputs must be present. Inputs can be dynamically added to an already created job. The input data is secret-shared, encrypted, and collected until the job gets scheduled. This approach enables more flexible workflows and computational processes.

    const nodes = await nodeInstance.randomNodeProviders();
    const blueprintId = "54f9ee38-0160-44e2-a1d8-08d1b6771cbf";
    const voucher = null; // only required for Restricted blueprints
    const deadline = new Date(Date.now() + 3600 * 1000); // 1 hour from now
    const jobId = await CoNoir.scheduleFullMultipleInputsJob(
    jobInstance,
    nodes,
    blueprintId,
    voucher,
    deadline
    );
    // multiple users can now add inputs to this job given the jobId and the selected nodes
    const abi = JSON.parse(fs.readFileSync("abi.json").toString());
    const publicInputs = new Uint32Array([1, 2]); // Replace with actual public input indices
    const input = JSON.parse(fs.readFileSync("Prover.json").toString());
    await CoNoir.addJobInputs(jobInstance, nodes, jobId, abi, publicInputs, input);
  • Prove Job:

    A proof job can be scheduled using either the Rep3 or Shamir Secret Sharing scheme. The process involves taking a witness, secret-sharing it, encrypting these shares, and distributing them to the designated nodes for execution.

    const nodes = await nodeInstance.randomNodeProviders();
    const blueprintId = "54f9ee38-0160-44e2-a1d8-08d1b6771cbf";
    const mpcProtocol = "Rep3"; // specify the MPC protocol to use (Rep3 or Shamir)
    const voucher = null; // only required for restricted blueprints
    const publicInputs = new Uint32Array([1, 2]); // Replace with actual public input indices
    const witness = new Uint8Array(fs.readFileSync("witness.gz"));
    const jobId = await CoNoir.scheduleProveJob(
    jobInstance,
    nodes,
    blueprintId,
    mpcProtocol,
    voucher,
    publicInputs,
    witness
    );
  • Fetch the job Results:

    The results of a job execution can be retrieved via a WebSocket connection. Once the results are ready, the server sends a message containing the proof, public inputs, and signatures of the computing nodes. If any party encounters an error, an error message is returned instead. The received proof and public inputs are serialized HonkProof<ark_bn254::Fr> and Vec<ark_bn254::Fr> types as defined by noir-types.

    const wsUrl = "wss://proof.taceo.network/api/v1/reports/subs";
    const jobId = "9c2814d7-25d3-4de5-b61f-0a6e3bacbe99";
    const { proof, public_inputs, signatures } = await CoNoir.fetchJobResult(wsUrl, jobId);
    fs.writeFileSync("proof", proof_bytes);
    fs.writeFileSync("public_inputs", public_inputs_bytes);

After following these steps, you will have two files named proof and public_inputs, containing the Noir Ultrahonk proof and public inputs.

You can now use barretenberg to verify the proof

bb verify --scheme ultra_honk -p proof -i public_inputs -k vk --zk