Skip to content

M0.1 Benchmark: WASM-SIMD secp256k1 verify throughput in Web Workers #2

Open

Description

@melvincarvalho

Part of #1 (M0). This is the single most important number in the project.

Goal

Measure ECDSA and Schnorr verifications/sec using a WASM-compiled libsecp256k1, single-core and scaled across N Web Workers, on real signatures pulled from mainnet blocks.

Why

Whether full validation is hours or days hinges on this. The engine's current crypto is pure JS (~20-100x too slow); the node needs WASM secp. Everything downstream is speculative until this is measured.

Benchmark / acceptance

  • Report verifies/sec/core (ECDSA and Schnorr), with and without WASM SIMD.
  • Report total throughput scaling 1..N workers (near-linear?).
  • Report the x-factor vs native libsecp on the same machine.
  • Use real signatures from downloaded blocks, not synthetic.
  • Confirm: >= ~10k verifies/sec/core in WASM, scaling roughly with core count.

Notes

Use an existing WASM build of libsecp256k1. Output feeds M0.5's revised time model.

Activity

  1. melvincarvalho commented on Jun 18, 2026

    @melvincarvalho
    ContributorAuthor

    Measured (single core, this dev machine), via npm run bench:secp (bench/secp-verify.js):

    ECDSA verify/s Schnorr verify/s
    pure JS (engine secp256k1.js) ~248 ~248
    WASM (tiny-secp256k1) ~3,840 ~3,810

    WASM is 16x the pure-JS engine. Projected full-chain signature work (~2.5B ECDSA verifications):

    • pure JS, 1 core: ~117 days (the engine's BigInt secp is fine for the test suite, hopeless for IBD)
    • WASM, 1 core: ~180 h
    • WASM, 8 cores: ~23 h
    • WASM, 24 cores: ~7.5 h

    This revises the roadmap model down. I had estimated ~10k verify/s/core and ~3h on 24 cores; the real tiny-secp256k1 figure is ~3,840/s. The gap is per-call JS↔WASM marshalling overhead, which makes this WASM ~5-10x off native (not the 1.5-2x kernel figure).

    Conclusions:

    • The current pure-JS engine cannot do IBD; a WASM secp is mandatory (confirmed).
    • The real levers are batch verification (amortize the WASM boundary across many sigs) and a SIMD libsecp build — not just "compile to WASM". tiny-secp256k1 does neither, so it is a floor, not a ceiling.
    • Honest full-validation target with this class of WASM: overnight (~8-15h) on a high-core desktop, not "an afternoon (~3h)". Batch+SIMD could pull it back toward the afternoon; that needs its own benchmark.

    Next: benchmark a batched / SIMD secp before committing to block validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions