Skip to main content

pubkeyPositionInScript

bitcoinjs-lib v1.0.7


bitcoinjs-lib / psbtutils / pubkeyPositionInScript

Function: pubkeyPositionInScript()

pubkeyPositionInScript(pubkey, script): number

Defined in: ts_src/psbt/psbtutils.ts:75

Finds the position of a public key in a script.

Parameters

pubkey

Uint8Array

The public key to search for.

script

Uint8Array

The script to search in.

Returns

number

The index of the public key in the script, or -1 if not found.

Throws

If there is an unknown script error.