eth_networks

Ethereum Network Configuration Module

Provides built-in configurations for popular EVM-compatible networks with default public RPC endpoints. Supports custom network configuration.

class eth_networks.NetworkConfig(name, chain_id, rpc_url, native_symbol, native_decimals=18, explorer_url=None, is_testnet=False)[source]

Bases: object

Configuration for an EVM-compatible network.

Parameters:
  • name (str)

  • chain_id (int)

  • rpc_url (str)

  • native_symbol (str)

  • native_decimals (int)

  • explorer_url (str | None)

  • is_testnet (bool)

name: str
chain_id: int
rpc_url: str
native_symbol: str
native_decimals: int = 18
explorer_url: str | None = None
is_testnet: bool = False
to_dict()[source]

Convert to dict representation.

Returns:

The result.

Return type:

Dict[str, Any]

eth_networks.get_network(network_name_or_id)[source]

Retrieve the network.

Parameters:

network_name_or_id (str) – The network name or id value.

Returns:

The result.

Return type:

Optional[NetworkConfig]

eth_networks.get_network_by_chain_id(chain_id)[source]

Retrieve the network by chain id.

Parameters:

chain_id (int) – The chain id value.

Returns:

The result.

Return type:

Optional[NetworkConfig]

eth_networks.create_custom_network(name, chain_id, rpc_url, native_symbol='ETH', native_decimals=18, explorer_url=None, is_testnet=False)[source]

Create a new custom network.

Parameters:
  • name (str) – Human-readable name.

  • chain_id (int) – The chain id value.

  • rpc_url (str) – The rpc url value.

  • native_symbol (str) – The native symbol value.

  • native_decimals (int) – The native decimals value.

  • explorer_url (Optional[str]) – The explorer url value.

  • is_testnet (bool) – The is testnet value.

Returns:

The result.

Return type:

NetworkConfig

eth_networks.list_networks(include_testnets=True)[source]

List networks.

Parameters:

include_testnets (bool) – The include testnets value.

Returns:

List of results.

Return type:

list