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

zeitstempel

v0.1.0

Published

Lightweight OpenTimestamps library — stamp, upgrade, and verify — with optional React components

Readme

zeitstempel

A lightweight TypeScript library for the full OpenTimestamps lifecycle: stamp, upgrade, and verify -- with optional React components. Works in browsers and Node.js.

Zeitstempel is German for "timestamp". This is the TypeScript sibling of zeitstempel, a Rust CLI for the same purpose.

What it does

OpenTimestamps lets you prove that data existed at a certain point in time by anchoring a hash to the Bitcoin blockchain. This library handles the entire workflow:

  1. Stamp -- hash your data and submit it to OpenTimestamps calendar servers
  2. Upgrade -- once Bitcoin confirms (1-3 blocks, typically 30 min to 3 hours), fetch the completed proof chain
  3. Verify -- replay the proof's hash operations and check the result against a real Bitcoin block header

The entire core is about 1,300 lines of TypeScript -- significantly smaller than the reference python-opentimestamps implementation. The binary .ots format parser, serializer, tree walker, and operation replay engine are all written from scratch. The only runtime dependency is @noble/hashes for cryptographic hash functions.

Install

Not yet published to npm. For now, install from GitHub:

npm install github:xfaSts9cwY6VqLNTMAtR/zeitstempel-react

Core API

Import from zeitstempel (no React dependency required):

import {
  stampFile,
  stampHash,
  upgradeProof,
  verifyFile,
  verifyDigest,
  parseOts,
  writeOts,
  formatProofTree,
} from 'zeitstempel';

Stamp a file

// From raw file data
const fileData = new Uint8Array(await file.arrayBuffer());
const otsBytes = await stampFile(fileData);
// Save otsBytes as a .ots file

// Or from a pre-computed SHA256 hex digest
const otsBytes = await stampHash('abcd1234...');

Upgrade a pending proof

After stamping, the proof is pending until Bitcoin confirms it. Call upgradeProof later to complete it:

const ots = parseOts(otsBytes);
const result = await upgradeProof(ots);

console.log(result.upgraded);      // number of attestations upgraded
console.log(result.stillPending);  // number still waiting for Bitcoin
console.log(result.alreadyComplete); // true if nothing to upgrade

if (result.upgraded > 0) {
  const upgradedBytes = writeOts(ots); // save the upgraded proof
}

Verify a file

const results = await verifyFile(fileData, otsBytes);

for (const r of results) {
  if (r.status === 'verified') {
    console.log(`Verified at Bitcoin block #${r.height}`);
    console.log(`Block time: ${new Date(r.blockTime * 1000)}`);
  } else if (r.status === 'pending') {
    console.log(`Pending: ${r.uri}`);
  }
}

// Or verify against a pre-computed digest (no original file needed)
const results = await verifyDigest('abcd1234...', otsBytes);

Inspect a proof

const ots = parseOts(otsBytes);
console.log(formatProofTree(ots));
File hash: 7e0b2290f512...5232 (SHA256)
|
+-- append(d19c5f3dbf07...)
    +-- SHA256
        +-- append(0728...)
        |   +-- SHA256
        |       +-- ...
        |           +-- Bitcoin block #935777
        +-- append(6da7...)
            +-- SHA256
                +-- ...
                    +-- Pending (https://bob.btc.calendar.opentimestamps.org)

React Components

Import from zeitstempel/react (requires React 18+):

import {
  VerifyTimestampButton,
  TimestampStatus,
  TimestampDownloadLinks,
} from 'zeitstempel/react';

VerifyTimestampButton

A button that calls an async verification function and shows the result with visual feedback:

<VerifyTimestampButton
  onVerify={() => verifyFile(fileData, otsBytes)}
  showLabel
/>

TimestampStatus

A lightweight status badge for displaying verification state in lists or tables:

<TimestampStatus state="verified" result={verifyResult} />

TimestampDownloadLinks

Download links for hash files and .ots proofs, plus a link to opentimestamps.org for external verification:

<TimestampDownloadLinks
  timestamp={{
    contentHash: 'abcd1234...',
    otsProof: btoa(String.fromCharCode(...otsBytes)),
  }}
/>

All components are unstyled by default -- use className props to apply your own styles.

Testing

# Unit tests (fast, no network)
npm test

# Integration test -- stamps a real file via calendar servers
OTS_WAIT=0 npx vitest run tests/integration/lifecycle.test.ts

# Integration test with full wait for Bitcoin confirmation (~3 hours)
OTS_WAIT=1 npx vitest run tests/integration/lifecycle.test.ts

# Interactive mode -- prompts whether to wait
npx vitest run tests/integration/lifecycle.test.ts

Unit tests include golden fixtures created by the reference Python ots tool, ensuring parser and writer correctness against the canonical implementation.

Architecture

src/
  core/
    stamp.ts       Submit file hashes to calendar servers, build .ots proofs
    upgrade.ts     Fetch completed proofs from calendar servers
    verify.ts      Replay hash operations, check against Bitcoin blocks
    parser.ts      Binary .ots format parser (LEB128 varints, tree walking)
    writer.ts      Binary .ots format serializer (inverse of parser)
    operations.ts  Hash/append/prepend/reverse operation executors
    bitcoin.ts     Blockstream.info API client (mempool.space fallback)
    crypto.ts      SHA256, SHA1, RIPEMD160 via @noble/hashes
    info.ts        ASCII art proof tree renderer
    hex.ts         Hex encoding/decoding utilities
    types.ts       TypeScript types (OtsFile, Timestamp, Attestation, etc.)
    constants.ts   OTS binary format constants and tags
  react/
    VerifyTimestampButton.tsx   Verification button with status feedback
    TimestampStatus.tsx         Lightweight status badge
    TimestampDownloadLinks.tsx  Download links for external verification

What's written from scratch

  • Binary .ots format parser and serializer
  • LEB128 varuint encoder/decoder
  • Timestamp tree walker (for verify, upgrade, and info)
  • Attestation parser (Bitcoin, Litecoin, Ethereum, Pending)
  • Operation replay engine
  • Calendar server interaction (stamp + upgrade)
  • ASCII art proof tree renderer

Dependencies

  • @noble/hashes -- cryptographic hash functions (SHA256, SHA1, RIPEMD160)
  • React 18+ -- optional peer dependency, only needed for the React components

Supported features

  • Stamp files via OpenTimestamps calendar servers (Alice + Bob)
  • Upgrade pending proofs to Bitcoin-anchored
  • Bitcoin attestation verification against public block explorers
  • Litecoin/Ethereum attestations are recognized and displayed, but not verified
  • SHA256, SHA1, RIPEMD160, Keccak256 hash operations
  • Append, prepend, reverse, hexlify operations
  • Proof tree forks (multiple attestation paths)
  • API fallback: Blockstream.info -> mempool.space
  • Parse, serialize, and inspect .ots proofs

See also

zeitstempel -- the Rust CLI version. Same stamp/upgrade/verify lifecycle, compiles to a single portable binary. Use it if you want a command-line tool rather than a library.

License

MIT