A small, runnable proof of concept for cross-implementation interoperability testing of PCZT (Partially Created Zcash Transactions). PCZT is the format that lets one tool build a Zcash transaction, another sign it, and another finalize it. It is the basis for hardware wallets, multisig, and air-gapped signing.
Several teams now implement PCZT independently (OneKey, Ledger, Hito, Keystone, and the
reference implementation in librustzcash), but there is no shared way to confirm they
interoperate: the pczt crate has a single end-to-end test where librustzcash plays
every role at once, and zcash-test-vectors contains no PCZT vectors.
This repo is the seed of a fuller test suite (proposed as a Zcash Community Grant). It demonstrates the approach on real code.
Running it (cargo run) does four things:
- Creator role. Builds a base PCZT (v5 transaction, no spends or outputs) with the
pcztcrate'sCreator. - Round-trip check. Serializes the PCZT, parses it back, and serializes again, asserting the bytes are identical. Byte-stable serialization is the core property every implementation must agree on to interoperate.
- Combiner role (a role boundary). Two separate parties each hold the base PCZT, and
the
Combinerrole merges them into one. This is the seed of the full "create on A, sign on B, finalize on C" harness. - Test vector. Writes a canonical vector (
vectors/empty_v5.pcztplus a JSON manifest with hex and metadata) of the kind that would be contributed tozcash-test-vectors.
cargo runExpected output ends with the inspector summary, a successful combine, and the written vector files. Example:
[1] round-trip OK: 101 bytes, byte-stable
[2] inspector
tx_version : 5
...
[3] combiner OK: merged two parties' PCZTs into 101 bytes
[4] wrote vectors/empty_v5.pczt and vectors/empty_v5.json
cargo testCovers byte-stable round-trip, the Combiner merge, and rejection of non-PCZT input.
This is a proof of concept, not the finished suite. It uses empty (anchor-zero) bundles so
it builds and runs without proving keys or a node. The fuller grant work adds: vectors for
real transparent, Sapling, and Orchard cases; a PcztRole adapter trait so independent
implementations can be tested against each other (including sign-only hardware devices via
exported PCZT files); and per-role diagnostics. See the grant application for milestones.
MIT OR Apache-2.0.