NAME

Blockchain::Ethereum::RLP - Ethereum RLP encoding/decoding utility

VERSION

Version 0.002

SYNOPSIS

Allow RLP encoding and decoding

This class is basically an transpilation of the RLP encode/decode python sample given at https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/

my $rlp = Blockchain::Ethereum::RLP->new();

my $tx_params  = ['0x9', '0x4a817c800', '0x5208', '0x3535353535353535353535353535353535353535', '0xde0b6b3a7640000', '0x', '0x1', '0x', '0x'];
my $encoded = $rlp->encode($params); #ec098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a764000080018080

my $encoded_tx_params = 'ec098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a764000080018080';
my $decoded = $rlp->decode(pack "H*", $encoded_tx_params); #['0x9', '0x4a817c800', '0x5208', '0x3535353535353535353535353535353535353535', '0xde0b6b3a7640000', '0x', '0x1', '0x', '0x']
...

METHODS

encode

Encodes the given input to RLP

This module accepts only hexadecimal encoded values as individual parameters or items of the array reference

  • $input hexadecimal string or reference to an hexadecimal string array

Return the encoded bytes

decode

  • $input RLP encoded bytes

Returns an hexadecimal array reference

AUTHOR

Reginaldo Costa, <refeco at cpan.org>

BUGS

Please report any bugs or feature requests to https://github.com/refeco/perl-RPL

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Blockchain::Ethereum::RLP

LICENSE AND COPYRIGHT

This software is Copyright (c) 2022 by REFECO.

This is free software, licensed under:

The MIT License