Skip to main content
Inspects a PCZT and returns structured information about its contents, including inputs, outputs, fee, and signing/proving status.

Signature

  • TypeScript
  • Go
  • Kotlin
function inspect_pczt(pczt_hex: string): PcztInfo

Parameters

pczt_hex
string
required
Hex-encoded PCZT (TypeScript) or Pczt object (Go/Kotlin)

Returns

interface PcztInfo {
  expiry_height: number;
  
  transparent_inputs: Array<{
    prevout_txid: string;     // Hex (display order)
    prevout_index: number;
    value: number;            // Zatoshis
    script_pubkey: string;    // Hex
    is_signed: boolean;
    num_signatures: number;
  }>;
  
  transparent_outputs: Array<{
    value: number;
    script_pubkey: string;
    user_address?: string;
  }>;
  
  orchard_outputs: Array<{
    value?: number;           // Zatoshis (if not redacted)
    recipient?: string;       // Hex (if not redacted)
    user_address?: string;
  }>;
  
  total_input: number;
  total_transparent_output: number;
  total_orchard_output: number;
  implied_fee: number;
  num_orchard_actions: number;
  all_inputs_signed: boolean;
  has_orchard_proofs: boolean;
}

Example

const pczt = t2z.propose_transaction(inputs, payments, changeAddr, network, expiry);
const info = t2z.inspect_pczt(pczt.to_hex());

console.log('Transaction Summary:');
console.log('  Inputs:', info.transparent_inputs.length);
console.log('  Total In:', info.total_input, 'zatoshis');
console.log('  Total Out:', info.total_orchard_output + info.total_transparent_output);
console.log('  Fee:', info.implied_fee, 'zatoshis');
console.log('  Signed:', info.all_inputs_signed ? 'Yes' : 'No');
console.log('  Proved:', info.has_orchard_proofs ? 'Yes' : 'No');

Use Cases

Calculate Change Amount

const info = t2z.inspect_pczt(pczt.to_hex());
const paymentTotal = payments.reduce((sum, p) => sum + p.amount, 0n);
const changeAmount = BigInt(info.total_orchard_output) - paymentTotal;

Check Signing Progress

const info = t2z.inspect_pczt(pczt.to_hex());
info.transparent_inputs.forEach((input, i) => {
  console.log(`Input ${i}: ${input.is_signed ? '✓' : '○'}`);
});

Verify Before Finalize

const info = t2z.inspect_pczt(pczt.to_hex());
if (!info.all_inputs_signed) {
  throw new Error('Not all inputs signed');
}
if (!info.has_orchard_proofs) {
  throw new Error('Proofs not generated');
}

See Also