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

@gstohl/t2z

v0.2.2

Published

TypeScript/Node.js bindings for t2z (Transparent to Shielded) - send transparent Zcash to shielded Orchard outputs via PCZT

Readme

@gstohl/t2z

Auto-generated - Do not edit directly. All changes must be made in gstohl/t2z.

TypeScript/Node.js bindings for t2z - enabling transparent Zcash wallets to send shielded Orchard outputs via PCZT (ZIP 374).

Installation

npm install @gstohl/t2z

Native libraries are bundled for: macOS (arm64/x64), Linux (x64/arm64), Windows (x64/arm64).

Usage

import {
  TransactionRequest,
  proposeTransaction,
  proveTransaction,
  getSighash,
  appendSignature,
  finalizeAndExtract,
  signMessage,
} from '@gstohl/t2z';

// 1. Create payment request
const request = new TransactionRequest([{
  address: 'u1...',       // unified or transparent address
  amount: '100000',       // 0.001 ZEC in zatoshis
}]);

// 2. Create PCZT from transparent UTXOs
const pczt = proposeTransaction([{
  pubkey: pubkeyBuffer,       // 33 bytes compressed
  txid: txidBuffer,           // 32 bytes
  vout: 0,
  amount: '100000000',        // 1 ZEC in zatoshis
  scriptPubKey: scriptBuffer,
}], request);

// 3. Add Orchard proofs
const proved = proveTransaction(pczt);

// 4. Sign transparent inputs
const sighash = getSighash(proved, 0);
const signature = await signMessage(privateKey, sighash);
const signed = appendSignature(proved, 0, signature);

// 5. Finalize and broadcast
const txBytes = finalizeAndExtract(signed);
// submit txBytes to Zcash network

API

See the main repo for full documentation.

| Function | Description | |----------|-------------| | new TransactionRequest(payments) | Create payment request | | proposeTransaction(inputs, request) | Create PCZT from inputs | | proveTransaction(pczt) | Add Orchard proofs | | verifyBeforeSigning(pczt, request, change) | Verify PCZT integrity | | getSighash(pczt, index) | Get 32-byte signature hash | | appendSignature(pczt, index, sig) | Add 64-byte signature | | combine(pczts) | Merge multiple PCZTs | | finalizeAndExtract(pczt) | Extract transaction bytes | | parsePczt(bytes) / serializePczt(pczt) | PCZT serialization | | signMessage(privKey, hash) | secp256k1 signing utility | | getPublicKey(privKey) | Derive compressed public key | | calculateFee(inputs, outputs) | Calculate ZIP-317 fee |

Types

interface Payment {
  address: string;    // transparent (t1...) or unified (u1...)
  amount: string;     // zatoshis as string (BigInt compatibility)
  memo?: string;      // optional, for shielded outputs
}

interface TransparentInput {
  pubkey: Buffer;       // 33 bytes compressed secp256k1
  txid: Buffer;         // 32 bytes
  vout: number;
  amount: string;       // zatoshis as string
  scriptPubKey: Buffer; // P2PKH script
}

Examples

See examples/ for complete working examples:

  • zebrad-regtest/ - Local regtest network examples (1-9)
  • zebrad-mainnet/ - Mainnet examples with hardware wallet flow

Memory

Automatic cleanup: All handles are automatically freed by the garbage collector via FinalizationRegistry. No manual cleanup required.

Consuming functions transfer ownership (input PCZT becomes invalid):

  • proveTransaction, appendSignature, finalizeAndExtract, combine

Non-consuming (read-only):

  • getSighash, serialize, verifyBeforeSigning

License

MIT