Ethereum Types
Table of Contents
Introduction
Types re-used throughout the specification, which are specific to Ethereum.
Module Contents
Classes
Atomic operation performed on the block chain. |
|
State associated with an address. |
|
Header portion of a block on the chain. |
|
A complete block. |
|
Data record produced during the execution of a transaction. |
|
Result of a transaction. |
Functions
Encode Account dataclass. |
Attributes
Module Details
Address
- Address
Address = Bytes20
Root
- Root
Root = Hash32
Bloom
- Bloom
Bloom = Bytes256
TX_BASE_COST
- TX_BASE_COST
TX_BASE_COST = 21000
TX_DATA_COST_PER_NON_ZERO
- TX_DATA_COST_PER_NON_ZERO
TX_DATA_COST_PER_NON_ZERO = 68
TX_DATA_COST_PER_ZERO
- TX_DATA_COST_PER_ZERO
TX_DATA_COST_PER_ZERO = 4
Transaction
Atomic operation performed on the block chain.
- class Transaction
- nonce :ethereum.base_types.U256
- gas_price :ethereum.base_types.Uint
- gas :ethereum.base_types.Uint
- to :Union[ethereum.base_types.Bytes0, Address]
- value :ethereum.base_types.U256
- data :ethereum.base_types.Bytes
- v :ethereum.base_types.U256
- r :ethereum.base_types.U256
- s :ethereum.base_types.U256
Account
State associated with an address.
EMPTY_ACCOUNT
- EMPTY_ACCOUNT
EMPTY_ACCOUNT = Account(
nonce=Uint(0),
balance=U256(0),
code=bytearray(),
)
encode_account
- encode_account(raw_account_data: Account, storage_root: ethereum.base_types.Bytes) → ethereum.base_types.Bytes
Encode Account dataclass.
Storage is not stored in the Account dataclass, so Accounts cannot be encoded with providing a storage root.
def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes:
return rlp.encode(
(
raw_account_data.nonce,
raw_account_data.balance,
storage_root,
keccak256(raw_account_data.code),
)
)
Header
Header portion of a block on the chain.
- class Header
- parent_hash :ethereum.crypto.hash.Hash32
- ommers_hash :ethereum.crypto.hash.Hash32
- coinbase :Address
- state_root :Root
- transactions_root :Root
- receipt_root :Root
- bloom :Bloom
- difficulty :ethereum.base_types.Uint
- number :ethereum.base_types.Uint
- gas_limit :ethereum.base_types.Uint
- gas_used :ethereum.base_types.Uint
- timestamp :ethereum.base_types.U256
- extra_data :ethereum.base_types.Bytes
- mix_digest :ethereum.base_types.Bytes32
- nonce :ethereum.base_types.Bytes8
Block
A complete block.
Log
Data record produced during the execution of a transaction.
Receipt
Result of a transaction.