NAME
Bitcoin::Crypto::Transaction::Output - Bitcoin transaction output instance
SYNOPSIS
my
$tx
= btc_transaction->new;
$tx
->add_output(
value
=> 1234,
locking_script
=> [
P2WPKH
=>
$my_address
],
);
$tx
->outputs->[0]->
dump
;
DESCRIPTION
This is an output instance implementation used in transactions. It is rarely interacted with directly.
INTERFACE
Attributes
value
Non-negative integer value of the output in the smallest unit (satoshi). It is an instance of Math::BigInt with type coercions from integers and strings. Required.
Available in the constructor.
writer: set_value
locking_script
An instance of the script used to lock the coins. Required.
Can be constructed from a standard script by passing an array reference with script type and an address.
Available in the constructor.
writer: set_locking_script
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.
is_standard
$boolean
=
$object
->is_standard()
Returns true if "locking_script" is a standard script type.
set_max_value
$object
=
$object
->set_max_value()
Sets the max possible value for this output, as required by digests. Mostly used internally.
value_serialized
$bytestring
=
$object
->value_serialized()
Returns the bytesting of serialized value ready to be included in a serialized transaction or digest. Mostly used internally.
to_serialized
$bytestring
=
$object
->to_serialized()
Returns the serialized output data to be included into a serialized transaction.
from_serialized
$object
=
$class
->from_serialized(
$bytestring
,
%params
)
Creates an object instance from serialized data.
%params
can be any of:
pos
Position for partial string decoding. Optional. If passed, must be a scalar reference to an integer value.
This integer will mark the starting position of
$bytestring
from which to start decoding. It will be set to the next byte after end of output stream.
dump
$text
=
$object
->
dump
()
Returns a readable description of the output.
EXCEPTIONS
This module throws an instance of Bitcoin::Crypto::Exception if it encounters an error. It can produce the following error types from the Bitcoin::Crypto::Exception namespace:
Transaction - general error with transaction