NAME

Bitcoin::Crypto::Script::Compiler::Opcode - Compiled script opcode

SYNOPSIS

my $ops = $script->operations;
foreach my $op (@{$ops}) {
	say $op->opcode->name;
}

DESCRIPTION

This class represents a compiled opcode. It wraps Bitcoin::Crypto::Script::Opcode along with some more data pulled out of a script.

Bitcoin::Crypto used to return plain array references as compiled opcode in the past. This class preserves the old method of access through an array reference, as well as introduces a convenience layer on top of it.

INTERFACE

Methods

new

Constructor is internal and advanced use only. You should not create objects of this class yourself, as they are only valid if they came from compiling a script.

opcode

$opcode = $object->opcode()

Returns an instance of Bitcoin::Crypto::Script::Opcode for this operation.

raw_data

$bytes = $object->raw_data()

Returns a bytestring containing the raw operation. For non-push opcodes, this will be the same as "code" in Bitcoin::Crypto::Script::Opcode, but packed into a byte. For push opcodes, this is the opcode code plus all the data they contain.

push_data

$bytes = $object->push_data()

Returns a bytestring containing bytes pushed onto the stack by the push operation. If this operation is not a push operation, returns undef.