Skip to main content
This section documents all functions available in the t2z SDKs. The API is consistent across all platforms (TypeScript, Go, Kotlin) with language-appropriate naming conventions.

Function Overview

Transaction Construction

FunctionDescription
propose_transactionCreate a PCZT from inputs and payments
inspect_pcztGet detailed info about a PCZT

Signing

FunctionDescription
get_sighashGet the sighash for external signing
append_signatureAdd a signature to the PCZT
sign_transparent_inputSign with an in-memory private key

Proving & Finalization

FunctionDescription
prove_transactionGenerate Orchard proofs
verify_before_signingVerify PCZT matches request
finalize_and_extractExtract final transaction

Utilities

FunctionDescription
parse_pcztParse PCZT from bytes
serialize_pcztSerialize PCZT to bytes
prebuild_proving_keyPre-build the proving key
is_proving_key_readyCheck if proving key is cached
generate_test_addressGenerate test Orchard address
generate_test_keypairGenerate test keypair
versionGet library version

Naming Conventions

The API uses consistent naming across platforms with language-appropriate conventions:
TypeScriptGoKotlin
propose_transactionProposeTransactionproposeTransaction
get_sighashGetSighashgetSighash
WasmTransparentInputTransparentInputTransparentInput

Error Handling

  • TypeScript
  • Go
  • Kotlin
Functions throw Error on failure:
try {
  const pczt = t2z.propose_transaction(...);
} catch (err) {
  console.error('Failed:', err.message);
}

Type Reference

TransparentInput

Represents a transparent UTXO to spend.
FieldTypeDescription
pubkeybytes (33)Compressed secp256k1 public key
prevoutTxidbytes (32)Transaction ID (little-endian)
prevoutIndexuint32Output index
valueuint64Value in zatoshis
scriptPubkeybytesP2PKH scriptPubkey
sequenceuint32?Sequence number (default: 0xffffffff)

Payment

Represents a payment output.
FieldTypeDescription
addressstringUnified or transparent address
amountuint64Amount in zatoshis
memobytes?Memo for shielded outputs (max 512 bytes)
labelstring?Display label

ExpectedTxOut

For verification, represents an expected output.
FieldTypeDescription
addressstringExpected address
amountuint64Expected amount in zatoshis

PcztInfo

Result of inspect_pczt, contains transaction details.
FieldTypeDescription
expiry_heightuint32Transaction expiry block
transparent_inputsarrayInput details
transparent_outputsarrayTransparent output details
orchard_outputsarrayOrchard output details
total_inputuint64Sum of input values
total_transparent_outputuint64Sum of transparent outputs
total_orchard_outputuint64Sum of Orchard outputs
implied_feeuint64Calculated fee
num_orchard_actionsuint32Number of Orchard actions
all_inputs_signedboolWhether all inputs have signatures
has_orchard_proofsboolWhether proofs are present