zk Proof verification

zkPortal provides a way to verify ZK proofs in a browser using WebAssembly. When a ZK proof is generated, there's also a proving key generated along with it, and public inputs for the proof. To verify a proof you need to provide a verifying key, which is a part of a proving key and is provided to you by zkPortal, and public inputs.

Using verification library

The library comes with a WebAssembly module and supporting JavaScript code and type definitions. If your JS execution environment supports it, the library will use WebAssembly streaming API. In order to use it your JS execution environment also needs to support Response.arrayBuffer() method. The library can either use the bundled WebAssembly module or fetch it from a remote location. Note that to fetch the module from a remote location and to use streaming API, the web server needs to set Content-Type header to application/wasm.

Import the library into your project

Check out https://github.com/zkportal/zk-verifier.

A WebAssembly library for verifying zero-knowledge proofs from zkPortal.

This library is derived from ark-circom.

Proof verification function is exported and compiled into a WebAssembly module using wasm-pack.


The package is not published to NPM yet. Download dist directory if you want to add files to your project, or download the whole repository and import it as a local package.

import init, { verify_proof } from '@zkportal/zk-verifier';

async function verify() {
  await init(); // uses bundled WebAssembly module, you can also provide an argument, see API section of the README
  const verifyingKey = Uint8Array.from(...);
  const proof = Uint8Array.from(...);
  const publicInputs = Uint8Array.from(...);
  const success = verify_proof(verifyingKey, proof, publicInputs);


initInitialize the moduleOne of:
  • undefined to use bundled WebAssembly module
  • string with WebAssembly module URL
  • URL
  • Fetch API Request
  • Fetch API Response
  • BufferSource
  • WebAssembly.Module
  • Promise of any type above
Promise<any>Default export
verify_proofVerify a proof using a proof, verifying key, and public inputs
  • verifying_keyUint8Array
  • proofUint8Array
  • public_inputsUint8Array
boolean - verification successDestructured export


Examples provide the following files:

  • proof.json - contains serialized decimal bytes of a zero-knowledge proof
  • verifying_key.json - contains serialized decimal bytes of a verifying key you can use with the proof to verify it
  • public_inputs.json - contains serialized decimal bytes of public inputs you need to supply to verify the proof

If you use a bundler, then you can import those files, then create Uint8Array arrays from them and supply to verify_proof function.

  • Banlist This directory contains JSON files with serialized inputs you can use to verify that supplied country code "NL" is not in the list of banned countries "US IR RU".

    This example is a proof that a private, hidden from the verifier, country code string (supplied at the time of creating the proof) isn’t in the public, visible to verifier list of banned country codes (in this case it’s US, IR, RU).

  • Minimum age This directory contains JSON files with serialized inputs you can use to verify that supplied user's date of birth is earlier than the date of minimum age.

    This example is a proof that a private, hidden from the verifier, user's date of birth timestamp (supplied at the time of creating the proof) is earlier than the public, visible to verifier, minimum age timestamp (date of proof - required age).