ethereum.forks.spurious_dragon.fork_typesethereum.forks.byzantium.fork_types
Ethereum Types.
.. contents:: Table of Contents :backlinks: none :local:
Introduction
Types reused throughout the specification, which are specific to Ethereum.
Address¶
| 23 | Address = Bytes20 |
|---|
Root¶
| 24 | Root = Hash32 |
|---|
Bloom¶
| 25 | Bloom = Bytes256 |
|---|
EMPTY_CODE_HASH¶
| 27 | EMPTY_CODE_HASH = keccak256(b"") |
|---|
Account ¶
State associated with an address.
| 30 | @slotted_freezable |
|---|
| 31 | @dataclass |
|---|
class Account:
nonce¶
| 37 | nonce: Uint |
|---|
balance¶
| 38 | balance: U256 |
|---|
code_hash¶
| 39 | code_hash: Hash32 |
|---|
EMPTY_ACCOUNT¶
| 42 | EMPTY_ACCOUNT = Account( |
|---|---|
| 43 | nonce=Uint(0), |
| 44 | balance=U256(0), |
| 45 | code_hash=EMPTY_CODE_HASH, |
| 46 | ) |
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:
| 50 | """ |
|---|---|
| 51 | Encode `Account` dataclass. |
| 52 | |
| 53 | Storage is not stored in the `Account` dataclass, so `Accounts` cannot be |
| 54 | encoded without providing a storage root. |
| 55 | """ |
| 56 | return rlp.encode( |
| 57 | ( |
| 58 | raw_account_data.nonce, |
| 59 | raw_account_data.balance, |
| 60 | storage_root, |
| 61 | raw_account_data.code_hash, |
| 62 | ) |
| 63 | ) |