Convenience function that combines get_sighash and append_signature for cases where the private key is available in memory.
Signature
function sign_transparent_input(
pczt: WasmPczt,
input_index: number,
private_key: string
): WasmPczt
func SignTransparentInput(
pczt *Pczt,
inputIndex uint32,
privateKey []byte,
) (*Pczt, error)
fun signTransparentInput(
pczt: Pczt,
inputIndex: UInt,
privateKey: ByteArray
): Pczt
Parameters
Index of the transparent input (0-based)
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