TriportRPC

net_listening

Last updated:

`net_listening` reports whether the underlying Ethereum node is currently listening for inbound peer-to-peer network connections. It returns a single boolean: `true` when the node is accepting connections, `false` otherwise.

Use it as a lightweight health/liveness probe before issuing heavier calls, or as part of a monitoring loop. It takes no parameters and is available on the free tier, so it is a cheap way to confirm the endpoint is reachable and your API key is valid.

This is a read-only method in the `net` namespace. It does not reflect peer count — use [`net_peerCount`](./net_peerCount.md) for that.

Parameters

This method takes no parameters.

Returns

net_listening return value
FieldType
resultobject

Examples

curl https://<your-endpoint>/ \
  -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"net_listening","params":[]}'
const res = await fetch("https://<your-endpoint>/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "id": 1,
  "method": "net_listening",
  "params": [],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"net_listening","params":[],"jsonrpc":"2.0"})
print(resp.json())
{
  "id": 1,
  "result": true,
  "jsonrpc": "2.0"
}

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet.
  3. Credit cost: 1 per call.

FAQ

What does net_listening do?
Returns whether the Ethereum node is actively listening for network connections.
How many credits does net_listening cost?
net_listening costs 1 credit(s) per call on Triport by default.
Is net_listening available over WebSocket?
net_listening is an HTTP JSON-RPC method.