net
Network Connectivity and Peer Information
The net namespace provides network-related methods that are part of the standard Ethereum JSON-RPC API. These methods offer information about the node's network connectivity, peer count, and network version. In Erigon, the net namespace is implemented through the NetAPI interface and NetAPIImpl struct.
The net namespace is enabled by default in Erigon's RPC daemon and provides essential network information that applications use to understand the node's connectivity status and network configuration.
For API usage refer to the below official resources:
Implementation Details
The net namespace is implemented in
NetAPIImplwhich uses theethBackendto access network information.net_listeningdetermines connectivity by attempting to retrieve peer information from the backend.net_versionandnet_peerCountrequire access to the backend and will return errors in--datadirmode when the backend is unavailable.
Backend Dependency
Methods
net_versionandnet_peerCountrequire theethBackendto be available.When running in
--datadirmode or when the backend cannot be accessed, these methods will return a "not available" error.The
net_listeningmethod gracefully handles backend unavailability by returningfalse.
Network Information Usage
net_versionis commonly used by applications to verify they're connected to the correct .Ethereum network.net_peerCounthelps monitor node connectivity and network health.net_listeningprovides a basic connectivity check for the node's network interface.
Availability and Configuration
The net namespace is enabled by default in Erigon's RPC daemon.
These methods are available on both HTTP and WebSocket connections.
For remote RPC daemon setups, the
netnamespace must be explicitly enabled for health check functionality.
Documentation References
The current implementation shows some limitations noted in the documentation, such as hardcoded return values in certain scenarios.
net_peerCountspecifically counts only internal sentries, which may not reflect the total peer count in distributed setups.
Last updated
Was this helpful?