npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tokamak-zk-evm/verify-wasm-nodejs

v0.1.0

Published

Tokamak zkEVM SNARK Verifier - WASM implementation for nodejs

Readme

Tokamak zkEVM Verifier - WebAssembly

Browser-Ready! Works seamlessly in all major browsers (Chrome, Firefox, Safari, Edge).

🎯 Key Features

  • Full Browser Support: Chrome 57+, Firefox 52+, Safari 11+, Edge 16+
  • Mobile Support: iOS Safari, Chrome Android
  • No Server Required: All verification runs client-side
  • Privacy Preserving: No data transmitted externally
  • Fast: Verification completes in 3-5 seconds

🚀 Quick Start

Option A: Install from NPM (Recommended)

# For Web/Browser
npm install @tokamak-zk-evm/verify-wasm-web

# For Node.js
npm install @tokamak-zk-evm/verify-wasm-nodejs

# For Bundlers (Webpack, Vite, etc.)
npm install @tokamak-zk-evm/verify-wasm-bundler

Option B: Build from Source

cd packages/backend/verify/verify-wasm

# Install wasm-pack (first time only)
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

# Build
chmod +x build.sh
./build.sh

2. Test in Browser

# Start local server
python3 -m http.server 8000

# Open in browser
open http://localhost:8000/example-simple.html

3. Use in Your Code

Using NPM Package (Web)

<!DOCTYPE html>
<html>
  <head>
    <title>Verifier Demo</title>
  </head>
  <body>
    <button id="verify">Verify Proof</button>
    <div id="result"></div>

    <script type="module">
      // Import from NPM package
      import init, { Verifier } from '@tokamak-zk-evm/verify-wasm-web';

      // Or if using local build:
      // import init, { Verifier } from './pkg-web/verify_wasm.js';

      document.getElementById('verify').onclick = async () => {
        // Initialize WASM (~50ms)
        await init();

        // Load data
        const setupParams = await fetch('setupParams.json').then((r) =>
          r.json(),
        );
        const instance = await fetch('instance.json').then((r) => r.json());

        // Create verifier
        const verifier = new Verifier(
          JSON.stringify(setupParams),
          JSON.stringify(instance),
        );

        // Run verification (3-5 seconds)
        const result = verifier.verify_keccak256();

        // Display result
        document.getElementById('result').textContent =
          result === 0
            ? '✅ Passed'
            : result === 1
              ? '❌ Failed'
              : '⚠️ No Keccak data';

        // Clean up memory
        verifier.free();
      };
    </script>
  </body>
</html>

📦 Browser Compatibility

✅ Supported Browsers

| Browser | Desktop | Mobile | Released | | -------------------- | ------- | ------ | -------- | | Chrome | 57+ | 57+ | 2017 | | Firefox | 52+ | 52+ | 2017 | | Safari | 11+ | 11+ | 2017 | | Edge | 16+ | - | 2017 | | Opera | 44+ | 44+ | 2017 | | Samsung Internet | - | 7.2+ | 2018 |

Conclusion: All browsers from 2017+ are supported! Compatible with 99%+ of current users.

🎨 Framework Integration

React

import { useEffect, useState } from 'react';
import init, { Verifier } from '@tokamak-zk-evm/verify-wasm-bundler';

function VerifyButton() {
  const [result, setResult] = useState('');
  const [loading, setLoading] = useState(false);

  useEffect(() => {
    init(); // Component mount 시 WASM 초기화
  }, []);

  const handleVerify = async () => {
    setLoading(true);
    try {
      const verifier = new Verifier(setupParamsJson, instanceJson);
      const res = verifier.verify_keccak256();
      setResult(res === 0 ? 'Passed ✅' : 'Failed ❌');
      verifier.free();
    } finally {
      setLoading(false);
    }
  };

  return (
    <button onClick={handleVerify} disabled={loading}>
      {loading ? 'Verifying...' : 'Verify Proof'}
    </button>
  );
}

Vue.js

<template>
  <button @click="verify" :disabled="loading">
    {{ loading ? 'Verifying...' : 'Verify Proof' }}
  </button>
  <p v-if="result">{{ result }}</p>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import init, { Verifier } from '@tokamak-zk-evm/verify-wasm-bundler';

const loading = ref(false);
const result = ref('');

onMounted(() => init());

const verify = async () => {
  loading.value = true;
  try {
    const verifier = new Verifier(setupParamsJson, instanceJson);
    const res = verifier.verify_keccak256();
    result.value = res === 0 ? 'Passed ✅' : 'Failed ❌';
    verifier.free();
  } finally {
    loading.value = false;
  }
};
</script>

Vanilla JavaScript

// 가장 간단한 방법
import init, { Verifier } from './pkg-web/verify_wasm.js';

async function verify() {
  await init();

  const verifier = new Verifier(
    JSON.stringify(setupParams),
    JSON.stringify(instance),
  );

  const result = verifier.verify_keccak256();
  console.log('Result:', result);

  verifier.free();
}

verify();

🛠️ Build Options

For Web Browsers

wasm-pack build --target web --out-dir pkg-web

Usage:

import init from './pkg-web/verify_wasm.js';

For Bundlers (Webpack, Vite, Rollup)

wasm-pack build --target bundler --out-dir pkg

Usage with NPM:

import init from '@tokamak-zk-evm/verify-wasm-bundler';

Or with local build:

import init from './pkg/verify_wasm.js';

For Node.js

wasm-pack build --target nodejs --out-dir pkg-node

Usage with NPM:

import { Verifier } from '@tokamak-zk-evm/verify-wasm-nodejs';
// or
const { Verifier } = require('@tokamak-zk-evm/verify-wasm-nodejs');

Or with local build:

import { Verifier } from './pkg-node/verify_wasm.js';

🐛 Troubleshooting

"CORS policy blocked" Error

Cause: WASM file loaded from different domain

Solution:

// Method 1: Host WASM on same domain

// Method 2: Add CORS headers on server
Access-Control-Allow-Origin: *

// Method 3: For local testing
python3 -m http.server 8000

"Memory access out of bounds" Error

Cause: Insufficient memory

Solution:

// Process large data in Web Worker
const worker = new Worker('verifier-worker.js');
worker.postMessage({ setupParams, instance });
worker.onmessage = (e) => {
  console.log('Result:', e.data);
};

Slow Performance

Solution:

# 1. Ensure release mode build
wasm-pack build --release

# 2. Size optimization
[profile.release]
opt-level = "z"  # Size optimization
lto = true       # Link Time Optimization

📱 Using in Mobile Browsers

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<script type="module">
  import init, { Verifier } from './pkg-web/verify_wasm.js';

  // Works on mobile too!
  await init();
  const verifier = new Verifier(setupParamsJson, instanceJson);
  const result = verifier.verify_keccak256();

  alert(result === 0 ? '✅ Verified!' : '❌ Failed');
  verifier.free();
</script>

Tested on:

  • ✅ iPhone 12 Pro (iOS 15, Safari)
  • ✅ Samsung Galaxy S21 (Android 12, Chrome)
  • ✅ iPad Pro (iOS 16, Safari)

🔐 Security Considerations

Content Security Policy (CSP)

<meta
  http-equiv="Content-Security-Policy"
  content="default-src 'self'; 
               script-src 'self' 'wasm-unsafe-eval';"
/>

Memory Management

// ✅ Always call free()
try {
  const verifier = new Verifier(setupParamsJson, instanceJson);
  const result = verifier.verify_keccak256();
  return result;
} finally {
  verifier.free(); // Release memory
}

Input Validation

// Validate user input
function validateSetupParams(params) {
  if (!params.n || !Number.isInteger(params.n)) {
    throw new Error('Invalid n parameter');
  }
  if (!isPowerOfTwo(params.n)) {
    throw new Error('n must be power of two');
  }
  // ... additional validation
}

📊 Example Files

  1. example-simple.html: Simplest example (copy and use directly)
  2. example-browser.html: Demo with complete UI
  3. example-node.js: Node.js usage example

🎯 Next Steps

  1. Build: Run ./build.sh
  2. Test: Open example-simple.html
  3. Integrate: Add to your app
  4. Deploy: Enable compression and deploy

📚 References