| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
4
|
|
|
4
|
|
108093
|
use v5.26; |
|
|
4
|
|
|
|
|
15
|
|
|
2
|
4
|
|
|
4
|
|
695
|
use Object::Pad ':experimental(init_expr)'; |
|
|
4
|
|
|
|
|
12493
|
|
|
|
4
|
|
|
|
|
23
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Blockchain::Ethereum::Transaction 0.007; |
|
5
|
|
|
|
|
|
|
role Blockchain::Ethereum::Transaction; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=encoding utf8 |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Blockchain::Ethereum::Transaction - Ethereum transaction abstraction |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
In most cases you don't want to use this directly, use instead: |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=over 4 |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=item * B<Legacy>: L<Blockchain::Ethereum::Transaction::Legacy> |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=item * B<EIP1559>: L<Blockchain::Ethereum::Transaction::EIP1559> |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=back |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
4
|
|
|
4
|
|
1945
|
use Carp; |
|
|
4
|
|
|
|
|
24
|
|
|
|
4
|
|
|
|
|
294
|
|
|
28
|
4
|
|
|
4
|
|
2143
|
use Crypt::Digest::Keccak256 qw(keccak256); |
|
|
4
|
|
|
|
|
29182
|
|
|
|
4
|
|
|
|
|
360
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
4
|
|
|
4
|
|
2310
|
use Blockchain::Ethereum::RLP; |
|
|
4
|
|
|
|
|
13523
|
|
|
|
4
|
|
|
|
|
6018
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
8
|
|
|
8
|
0
|
24
|
field $chain_id :reader :writer :param; |
|
|
8
|
|
|
8
|
0
|
54
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
33
|
8
|
|
|
8
|
0
|
20
|
field $nonce :reader :writer :param; |
|
|
8
|
|
|
8
|
0
|
44
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
34
|
8
|
|
|
8
|
0
|
22
|
field $gas_limit :reader :writer :param; |
|
|
8
|
|
|
8
|
0
|
37
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
35
|
8
|
|
|
8
|
0
|
19
|
field $to :reader :writer :param //= ''; |
|
|
|
|
|
8
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
36
|
8
|
|
|
0
|
0
|
45
|
field $value :reader :writer :param //= '0x0'; |
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
8
|
|
|
8
|
0
|
19
|
|
|
|
|
|
|
8
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
37
|
8
|
|
|
8
|
0
|
54
|
field $data :reader :writer :param //= ''; |
|
|
8
|
|
|
8
|
0
|
21
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
38
|
8
|
|
|
0
|
0
|
35
|
field $v :reader :writer :param = undef; |
|
|
0
|
|
|
0
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
0
|
|
|
39
|
3
|
|
|
3
|
0
|
10
|
field $r :reader :writer :param = undef; |
|
|
3
|
|
|
3
|
0
|
11
|
|
|
|
11
|
|
|
0
|
0
|
41
|
|
|
|
11
|
|
|
11
|
0
|
75
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
40
|
6
|
|
|
6
|
0
|
15
|
field $s :reader :writer :param = undef; |
|
|
6
|
|
|
6
|
0
|
41
|
|
|
|
3
|
|
|
0
|
0
|
4475212
|
|
|
|
3
|
|
|
3
|
0
|
18
|
|
|
|
|
|
|
3
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
8
|
|
|
8
|
0
|
21
|
field $rlp :reader = Blockchain::Ethereum::RLP->new(); |
|
|
6
|
|
|
8
|
0
|
14
|
|
|
|
6
|
|
|
0
|
0
|
38
|
|
|
|
3
|
|
|
6
|
0
|
95
|
|
|
|
3
|
|
|
6
|
0
|
12
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
3
|
0
|
|
|
|
|
|
|
|
3
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
8
|
|
|
|
|
50
|
=head2 serialize |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
To be implemented by the child classes, encodes the given transaction parameters to RLP |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Usage: |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
serialize() -> RLP encoded transaction bytes |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over 4 |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=back |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns the RLP encoded transaction bytes |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
method serialize; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 generate_v |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Generate the transaction v field using the given y-parity |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Usage: |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
generate_v($y_parity) -> hexadecimal v |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over 4 |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * C<$y_parity> y-parity |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=back |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Returns the v hexadecimal value also sets the v fields from transaction |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
method generate_v; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 hash |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
SHA3 Hash the serialized transaction object |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Usage: |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
hash() -> SHA3 transaction hash |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over 4 |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns the SHA3 transaction hash bytes |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
|
97
|
|
|
|
|
|
|
|
|
98
|
3
|
|
|
3
|
0
|
136324
|
method hash { |
|
|
|
|
|
3
|
1
|
|
|
|
|
|
|
|
0
|
1
|
|
|
|
99
|
|
|
|
|
|
|
|
|
100
|
3
|
|
|
|
|
24
|
return keccak256($self->serialize); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# In case of Math::BigInt given for any params, get the hex value |
|
104
|
8
|
|
|
8
|
|
21
|
method _equalize_params ($params) { |
|
|
8
|
|
|
8
|
|
18
|
|
|
|
8
|
|
|
0
|
|
17
|
|
|
|
8
|
|
|
|
|
16
|
|
|
105
|
|
|
|
|
|
|
|
|
106
|
8
|
100
|
|
|
|
26
|
return [map { ref $_ eq 'Math::BigInt' ? $_->as_hex : $_ } $params->@*]; |
|
|
66
|
|
|
|
|
1559
|
|
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
__END__ |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Reginaldo Costa, C<< <refeco at cpan.org> >> |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 BUGS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Please report any bugs or feature requests to L<https://github.com/refeco/perl-ethereum-transaction> |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This software is Copyright (c) 2023 by REFECO. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This is free software, licensed under: |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
The MIT License |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |