ethereum.byzantium.fork_types
Ethereum Types ^^^^^^^^^^^^^^
.. contents:: Table of Contents :backlinks: none :local:
Introduction
Types re-used throughout the specification, which are specific to Ethereum.
Address
28 | Address = Bytes20 |
---|
Root
29 | Root = Hash32 |
---|
Bloom
30 | Bloom = Bytes256 |
---|
Account
State associated with an address.
33 | @slotted_freezable |
---|
34 | @dataclass |
---|
class Account:
nonce
40 | nonce: Uint |
---|
balance
41 | balance: U256 |
---|
code
42 | code: bytes |
---|
EMPTY_ACCOUNT
45 | EMPTY_ACCOUNT = Account( |
---|---|
46 | nonce=Uint(0), |
47 | balance=U256(0), |
48 | code=bytearray(), |
49 | ) |
encode_account
Encode Account
dataclass.
Storage is not stored in the Account
dataclass, so Accounts
cannot be
encoded without providing a storage root.
def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes:
53 | """ |
---|---|
54 | Encode `Account` dataclass. |
55 |
|
56 | Storage is not stored in the `Account` dataclass, so `Accounts` cannot be |
57 | encoded without providing a storage root. |
58 | """ |
59 | return rlp.encode( |
60 | ( |
61 | raw_account_data.nonce, |
62 | raw_account_data.balance, |
63 | storage_root, |
64 | keccak256(raw_account_data.code), |
65 | ) |
66 | ) |