Skip to main content
Convenience function that combines get_sighash and append_signature for cases where the private key is available in memory.

Signature

  • TypeScript
  • Go
  • Kotlin
function sign_transparent_input(
  pczt: WasmPczt,
  input_index: number,
  private_key: string
): WasmPczt

Parameters

pczt
Pczt
required
The PCZT to sign
input_index
number
required
Index of the transparent input (0-based)
private_key
string
required
32-byte secp256k1 private key (hex)

Returns

Updated PCZT with the signature added.

Example

// Sign input 0
pczt = t2z.sign_transparent_input(pczt, 0, privateKeyHex);

// Sign all inputs
for (let i = 0; i < inputs.length; i++) {
  pczt = t2z.sign_transparent_input(pczt, i, keys[i]);
}

When to Use

Use this function when:
  • Private key is available in memory
  • Testing or development
  • Simple single-party transactions
For hardware wallets or HSMs, use get_sighash + append_signature instead.

See Also