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§
Structs§
- Announcement
- NewPooledTransactionHashes (eth/68+):
[types, [sizes…], [hashes…]]. - Header
Request - GetBlockHeaders.
- Hello
- The base protocol’s Hello.
- Status
- An
ethStatus 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
ethcodes start. - ETH_
VERSIONS ethversions 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 extraDatais 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’scrc32.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 mostmaxitems.- 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_getBlockByNumbernames them. When the JSON carries ahash, 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
0xhex string, or a decimal string. - reason_
code - reason_
name - transaction_
from_ hex - A signed transaction from its canonical encoding (
0x-hex, aseth_getRawTransactionByHashreturns 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.