Skip to main content
Signing is a two-step process per ZIP 374:
  1. Get the sighash — Compute the signature hash for an input
  2. Append the signature — Add the signed result to the PCZT
This separation enables external signing with hardware wallets, HSMs, or air-gapped systems.

Two Approaches

External Signing

Use get_sighash + append_signature when:
  • Using a hardware wallet
  • Key is in an HSM
  • Signing on a separate system
Recommended for production

Convenience Method

Use sign_transparent_input when:
  • Key is available in memory
  • Testing/development
  • Simple use cases
Combines both steps internally

External Signing Flow

Step 1: Get Sighash

Step 2: Sign Externally

Sign the sighash with ECDSA secp256k1. The signature must be DER-encoded with the sighash type byte appended.

Step 3: Append Signature

Convenience Method

For simple cases where the private key is available:

Signing Multiple Inputs

Each input must be signed individually:

Signature Format

The signature appended to the PCZT must be:

Example DER Signature

Hardware Wallet Integration

The external signing flow is designed for hardware wallets:
The sighash is a standard 32-byte hash. Any ECDSA secp256k1 signer that supports raw message signing will work.

Verifying Signatures

After signing, use inspect_pczt to verify:

Common Errors

The signature doesn’t validate for the sighash. Check:
  • Correct private key for the input
  • Proper DER encoding
  • Sighash type byte (0x01) appended
The public key doesn’t match the input’s scriptPubkey. Ensure you’re using the correct key for each input.
The input index is out of bounds. Check inputs.length from inspect_pczt.

Next Step

After all inputs are signed, proceed to generating proofs for Orchard outputs.