A TypeScript library that enables Bitcoin-derived transparent-only Zcash wallet users to send shielded Orchard outputs using the PCZT (Partially Constructed Zcash Transaction) API.
This library bridges the gap between transparent (Bitcoin-like) and shielded (private) Zcash ecosystems, allowing users with transparent-only wallets to easily send funds to shielded addresses.
- ✅ Implements all 8 required PCZT API functions
- ✅ Supports transparent inputs → shielded Orchard outputs
- ✅ Integrates with Rust
pcztcrate via FFI for proof generation - ✅ Handles ZIP 321 payment requests
- ✅ Compatible with existing Bitcoin-derived signing infrastructure
- ✅ Comprehensive TypeScript type definitions
npm install @zcash/pczt-typescriptimport {
proposeTransaction,
proveTransaction,
getSighash,
appendSignature,
finalizeAndExtract,
} from '@zcash/pczt-typescript';
async function sendToShielded() {
// 1. Prepare transparent inputs
const inputs = [
[
{ txid: 'your-txid', vout: 0, sequence: 0xFFFFFFFF },
{ value: 100000000n, scriptPubKey: new Uint8Array([...]) }
]
];
// 2. Create payment request
const request = {
payments: [{
address: 'u1recipient...', // Unified address with Orchard
amount: 95000000n,
memo: new TextEncoder().encode('Payment')
}]
};
// 3. Build and finalize transaction
const pczt = await proposeTransaction(inputs, request);
const proved = await proveTransaction(pczt);
const sighash = await getSighash(proved, 0);
const signature = await yourWallet.sign(sighash.hash);
const signed = await appendSignature(proved, 0, signature);
const txBytes = await finalizeAndExtract(signed);
// 4. Broadcast transaction
return txBytes;
}See the API Documentation for detailed information about all available functions.
# Install dependencies
npm install
# Build TypeScript and Rust
npm run build
# Run tests
npm test
# Run integration test (requires ~4GB RAM)
./run-all.sh
# Generate documentation
npm run docs- Memory: Proof generation (
proveTransaction) requires approximately 4GB of available RAM to build the Orchard proving key. - Disk: ~2GB for build artifacts.
- Platform: macOS (ARM64/x64), Linux (x64/ARM64), Windows (x64).
TypeScript Layer (Transaction Building)
↓
FFI Bridge (napi-rs)
↓
Rust Native Module (Proof Generation)
↓
pczt Crate (Orchard Proofs)
MIT
Contributions are welcome! Please see CONTRIBUTING.md for details.