Skip to main content

Module eth

Module eth 

Source
Expand description

The messages: the devp2p base protocol (Hello, Disconnect, Ping, Pong) and the eth subprotocol at versions 68 and 69, plus the pieces they are made of — block headers as structured JSON and their hashes, fork identifiers (EIP-2124), enode URLs, transactions.

Message codes on the wire: the base protocol owns 0x00–0x0f; capabilities follow in alphabetical order, each taking as many codes as it defines. NetGet offers only eth, so a matched eth always starts at 0x10.

Modules§

code

Structs§

Announcement
NewPooledTransactionHashes (eth/68+): [types, [sizes…], [hashes…]].
HeaderRequest
GetBlockHeaders.
Hello
The base protocol’s Hello.
Status
An eth Status at version 68 or 69.

Enums§

Origin
Where a header request starts.

Constants§

BASE_VERSION
Base protocol version sent in Hello; 5 turns on Snappy compression.
DISCONNECT_REASONS
Disconnect reasons (devp2p spec), by code.
ETH_OFFSET
Where eth codes start.
ETH_VERSIONS
eth versions NetGet speaks, newest first.
MAX_BODY_ITEMS
The most transactions, uncles or withdrawals one body may carry.
MAX_CAPS
The most capabilities a Hello may list.
MAX_CLIENT_ID_CHARS
The longest client id kept from a Hello, in characters.
MAX_EXTRA_DATA
extraData is at most 32 bytes on mainnet; a little room for other chains.
MAX_HELLO_BYTES
The largest Hello accepted (go-ethereum’s baseProtocolMaxMsgSize).
MAX_TRANSACTION_BYTES
The largest single transaction accepted from the model.

Functions§

big_json
A big integer for the model: a JSON number when it fits in 64 bits, hex otherwise.
body_from_json
A block body from {transactions: ["0x…"], uncles: [header], withdrawals: [..] | absent}.
body_json
crc32_update
Continue a CRC-32 (IEEE) over data, as Go’s crc32.Update.
decode_block_range
BlockRangeUpdate (eth/69): [earliest, latest, latest_hash].
decode_disconnect
A Disconnect payload’s reason. Peers write [reason], a bare integer, or nothing.
decode_hash_request
[request_id, [hash…]] (GetBlockBodies, GetPooledTransactions, GetReceipts).
decode_response
[request_id, [items…]], at most max items.
empty_payload
The empty list Ping and Pong carry.
encode_disconnect
rlp([reason]), as go-ethereum writes it.
encode_hash_request
encode_response
[request_id, [items…]].
eth_length
How many codes eth/<version> takes.
fork_hash
The fork hash of a chain with this genesis that has passed these forks (block numbers or timestamps, in activation order; zeros — forks active at genesis — are skipped).
format_enode
header_from_json
Build a header from JSON fields named as eth_getBlockByNumber names them. When the JSON carries a hash, it must be the hash of the header these fields make.
header_hash
keccak-256 of the header’s RLP: the block hash.
header_number
header_parent
header_to_json
A header as JSON, with its computed hash.
hex0x
parse_big
An unsigned big integer (up to 256 bits) as minimal big-endian bytes.
parse_enode
enode://<128 hex>@<host>:<port> (a ?discport= query is ignored).
parse_fixed
parse_hex
Bytes from a 0x-prefixed (or bare) hex string.
parse_u64
An unsigned integer: a JSON number, a 0x hex string, or a decimal string.
reason_code
reason_name
transaction_from_hex
A signed transaction from its canonical encoding (0x-hex, as eth_getRawTransactionByHash returns it): how it is embedded in a list (a legacy transaction is the RLP list itself, a typed one is its EIP-2718 envelope as a byte string) and its hash.
transaction_json
How a transaction in a list is reported: its hash, type and size.