NAME

Blockchain::Ethereum::Transaction - Ethereum transaction abstraction

VERSION

version 0.020

SYNOPSIS

Ethereum transaction abstraction for signing and generating raw transactions # parameters can be hexadecimal strings or Math::BigInt instances my $transaction = Blockchain::Ethereum::Transaction::EIP1559->new( nonce => '0x0', max_fee_per_gas => '0x9', max_priority_fee_per_gas => '0x0', gas_limit => '0x1DE2B9', to => '0x3535353535353535353535353535353535353535' value => parse_unit('1', ETH), data => '0x', chain_id => '0x539' );

my $key = Blockchain::Ethereum::Keystore::Key->new(
    private_key => pack "H*",
    '4646464646464646464646464646464646464646464646464646464646464646'
);

$key->sign_transaction($transaction);

my $raw_transaction = $transaction->serialize;

print unpack("H*", $raw_transaction);

Supported transaction types:

  • Legacy

  • EIP2930 Access List

  • EIP1559 Fee Market

METHODS

serialize

To be implemented by the child classes, encodes the given transaction parameters to RLP

Returns the RLP encoded transaction bytes

hash

SHA3 Hash the serialized transaction object

Returns the SHA3 transaction hash bytes

_encode_access_list

Internal method to encode the access list for RLP serialization

Returns the properly formatted access list for RLP encoding

generate_v

Generate the transaction v field using the given y-parity

  • $y_parity y-parity

Returns the v hexadecimal value also sets the v fields from transaction

AUTHOR

REFECO <refeco@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2022 by REFECO.

This is free software, licensed under:

The MIT (X11) License