View Source BitcoinLib.Script.Opcodes.Crypto.CheckSig (BitcoinLib v0.4.7)

Based on https://en.bitcoin.it/wiki/Script

Word OP_CHECKSIG Opcode 172 Hex 0xac Input sig pubkey Output True / false Description The entire transaction's outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.

Link to this section Summary

Functions

Returns <<0xac>>

The entire transaction's outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.

v()

Returns 0xac

Link to this section Types

@type t() :: BitcoinLib.Script.Opcodes.Crypto.CheckSig

Link to this section Functions

@spec encode() :: <<_::8>>

Returns <<0xac>>

examples

Examples

iex> BitcoinLib.Script.Opcodes.Crypto.CheckSig.encode()
<<0xac>>
Link to this function

execute(check_sig, list)

View Source
@spec execute(t(), list()) :: {:ok, list()}

The entire transaction's outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.

examples

Examples

iex> sig_pub_key = <<0x0218fb7aff2c6cb9c25b7cd9aa0b9bdd712e5617f07cb0c96bdda0b44c25a5d25f::264>>
...> signature = <<0x304402202911998439e90fc7c3e12c8fd9e5b65d451c3e157fdfdf0991281fb90038eaf20220623615e5e4a768edc19fd480ac67b7f39d46689fdbfb54ffa49145117d17aa71::560>>
...> %BitcoinLib.Script.Opcodes.Crypto.CheckSig{
...>   script: <<0x76a91417cdc02e31846f9e7c25952700f53e9752a0a3c288ac::200>>
...> }
...> |> BitcoinLib.Script.Opcodes.Crypto.CheckSig.execute([sig_pub_key, signature, 3])
{:ok, [1, 3]}
@spec v() :: 172

Returns 0xac

examples

Examples

iex> BitcoinLib.Script.Opcodes.Crypto.CheckSig.v()
0xac