NAME
Bitcoin::Crypto::Transaction::Flags - Consensus flags
SYNOPSIS
use Bitcoin::Crypto::Transaction::Flags;
# full set of flags
my $all_flags = Bitcoin::Crypto::Transaction::Flags->new;
# disable some flags (those not passed are active)
my $some_flags = Bitcoin::Crypto::Transaction::Flags->new(
der_signatures => !!0,
);
# use flags in transaction verification
$transaction->verify(flags => $some_flags);
DESCRIPTION
This is a class that represents a set of consensus rules used in transaction verification and associated systems. Each attribute of this class represents a single rule.
By default, all implemented consensus rules are active, and all implemented standardness rules are inactive when calling "new". As Bitcoin and this module progress, more rules may be added all enabled by default on arrival. Since Bitcoin is extended through softforks (implemented in a backward-compatible manner), this should rarely pose a problem with Bitcoin::Crypto code. If you want to be extra sure, see "new_empty".
INTERFACE
All the following flags are attributes available in the constructor of the object. They have writer methods named set_X.
Consensus flags
All consensus flags are active by default.
p2sh
Whether P2SH verification defined in BIP16 should be used.
der_signatures
Whether strict DER signature verification defined in BIP66 should be used.
checklocktimeverify
Whether OP_CHECKLOCKTIMEVERIFY opcode defined in BIP65 should be used.
checksequenceverify
Whether OP_CHECKSEQUENCEVERIFY opcode defined in BIP112 should be used.
null_dummy
Whether OP_CHECKMULTISIG null dummy verification defined in BIP147 should be used.
segwit
Whether segwit-specific verification defined in BIP141 should be used.
taproot
Whether taproot-specific verification defined in BIP341 should be used.
Standardness flags
All standardness flags are inactive by default.
signature_pushes_only
Disallows non-push opcodes in signature scripts of inputs for legacy non-P2SH transactions. Automatically active for P2SH.
minimal_if
Whether the argument to OP_IF must be minimal (OP_1 or OP_0). Only applicable to Segregated Witness scripts.
compressed_pubkeys
Whether public keys used is signature-checking scripts must be compressed. Only applicable to Segregated Witness scripts.
strict_encoding
Disallows non-strictly encoded DER signatures and public keys.
low_s_signatures
Disallows signatures encoded with low S.
minimal_data
When active, data pushed by push opcodes must be minimally encoded.
null_fail
Causes non-taproot signature-checking opcodes to stop script execution on failure, unless the signature is empty.
clean_stack
Requires script stack to have exactly one element at the end of execution to consider the execution successful.
const_script
Causes the script to fail if OP_CODESEPARATOR or a signature is encoded in a pre-SegWit script.
known_witness
Causes the transaction verification to fail if unknown version of Segregated Witness program is encountered.
illegal_upgradeable_nops
Disallows the use of OP_NOPX opcodes (but not OP_NOP).
Methods
new
$object = $class->new(%args)
This is a standard Moo constructor, which can be used to create the object. It takes arguments specified in "Consensus flags" and "Standardness flags".
Returns a class instance.
new_empty
$object = $class->new_empty(%args)
Same as "new", but assumes all flags unspecified in %args are disabled.
new_full
$object = $class->new_full(%args)
Same as "new", but assumes all flags unspecified in %args are enabled.
strict_signatures
$bool = $object->strict_signatures()
Return true if any one of "strict_encoding", "der_signatures" or "low_s_signatures" are enabled. Having either one of these flags in effect is the same as having "der_signatures" enabled.