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

@mwaddip/ergots-proof

v0.1.0

Published

Pure-TypeScript Ergo NiPoPoW proof verifier — parse, serialize, verify, compare; plus the P2P envelope codec.

Downloads

35

Readme

@mwaddip/ergots-proof

Pure-TypeScript Ergo NiPoPoW proof verifier. Browser-compatible. Validated byte-for-byte against ergo-nipopow (sigma-rust).

Install

npm install @mwaddip/ergots-proof

Usage

import { verifyProof, parseProof, compareProofs } from '@mwaddip/ergots-proof';

const proofBytesA: Uint8Array = /* first proof from peer A */;
const proofBytesB: Uint8Array = /* second proof from peer B */;

// Verify (default checks Autolykos v2 PoW per header):
const result = verifyProof(proofBytesA);
console.log(result.suffixTipHeight, 'headers in proof:', result.totalHeaders);

// Or parse without verification:
const proof = parseProof(proofBytesA);

// Compare two proofs from different peers:
const aIsBetter = compareProofs(proofBytesA, proofBytesB);

See API.md for the full reference (every export, its signature, error codes, and type definitions).

P2P envelope codec

The wire envelope for Ergo's P2P message codes 90 (GetNipopowProof) and 91 (NipopowProof) ships under a subpath:

import {
  parseGetNipopowProof,
  serializeNipopowProofEnvelope,
  GET_NIPOPOW_PROOF,
  NIPOPOW_PROOF,
} from '@mwaddip/ergots-proof/envelope';

Browser compatibility

Runs unchanged in evergreen browsers and Node >= 20. No Buffer, no node:crypto, no dynamic Node built-ins. ESM-only.

The verifier is stateless: bytes in, structured result out. It does not fetch proofs, persist headers, or follow the chain tip — those concerns live in future packages (@mwaddip/ergots-gossip, @mwaddip/ergots-light-client).

What this package does NOT do

  • Proof construction. Building a proof requires a local header chain with cached interlinks — that's a different package.
  • Transport. Callers fetch proofs over their own channel.
  • Storage. No header chain, no IndexedDB.
  • Light-client sync. Bootstrapping from a verified proof + following the tip lives in @mwaddip/ergots-light-client.

Verification scope

  • NiPoPoW proof structure (parse + serialize + round-trip)
  • Parent-linkage connections (sigma-rust's has_valid_connections semantics, 11-entry lookback window)
  • Strict-increasing heights across the proof
  • Per-header Autolykos v2 PoW (version 1 headers are structurally accepted; v1 PoW is not verified, mirroring sigma-rust's Unsupported behavior)
  • Pairwise comparison (KMZ17 §4.3 is_better_than)

Reference implementation

This package is a clean-room TypeScript port of ergo-nipopow from sigma-rust. Every primitive is validated byte-for-byte against fixtures generated by the Rust reference, including 5 real mainnet headers and 1 real mainnet NiPoPoW proof from ergo-node-rust.

License

MIT