NAME

Bitcoin::Crypto::Transaction::Digest::Result - Result of digesting a transaction

SYNOPSIS

my $digest = $tx->get_digest(...);

say to_format [hex => $digest];

DESCRIPTION

This is a simple class that holds the result of digesting a transaction by "get_digest" in Bitcoin::Crypto::Transaction and similar methods. It stringifies automatically to "preimage", or throws an exception if there is no preimage.

INTERFACE

Attributes

taproot

Available in the constructor.

This boolean flag controls whether legacy (when false, uses hash256) or taproot (when true, uses tagged_hash) hashing should be used to obtain "hash" from "preimage". Default: false.

preimage

Available in the constructor.

This bytestring is a preimage of the transaction. Note that preimage can not be set in some edge cases.

predicate: has_preimage

hash

Available in the constructor.

This bytestring is a hashed preimage. If it is not set, it will be generated lazily.

Methods

new

$block = $class->new(%args)

This is a standard Moo constructor, which can be used to create the object. It takes arguments specified in "Attributes".

Returns class instance.

as_string

$preimage = $object->as_string()

Returns "preimage". Same as using the object in the string context.

SEE ALSO

Bitcoin::Crypto::Transaction