For AI agents: a documentation index is available at /llms.txt. Markdown versions of pages are available by appending .md to any documentation URL.
Skip to main content

NET methods

The NET API methods provide network-related information.

net_enode

Returns the enode URL.

Parameters

  • None

Returns

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "net_enode",
"params": [],
"id": 1
}'

net_listening

Whether the client is actively listening for network connections.

Parameters

  • None

Returns

  • Indicates if the client is actively listening for network connections.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "net_listening",
"params": [],
"id": 53
}'

net_peerCount

Returns the number of peers currently connected to the client.

Parameters

  • None

Returns

  • Number of connected peers in hexadecimal.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "net_peerCount",
"params": [],
"id": 53
}'

net_services

Returns enabled services (for example, jsonrpc) and the host and port for each service.

note

The --nat-method setting affects the JSON-RPC and P2P host and port values, but not the metrics host and port values.

Parameters

  • None

Returns

  • Enabled services.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "net_services",
"params": [],
"id": 1
}'

net_version

Returns the network ID.

Parameters

  • None

Returns

  • Current network ID.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 53
}'