net_listening - Mantle RPC Method
Check the legacy net_listening compatibility method on Mantle. Public endpoints may return a boolean or an unsupported-method response depending on the client.
Checks whether the connected Mantle client reports that its P2P networking layer is listening for peers. Depending on the client behind the endpoint, this call may return true, false, or an unsupported-method error.
Why Mantle? Build on the world's largest ZK rollup by TVL with $2.5B+ secured and deep Bybit integration with near-instant ZK finality via OP Succinct, $6.2B treasury backing, mETH liquid staking, and 25% Bybit trading fee discounts.
When to Use This Method
net_listening is useful for DeFi developers, liquid staking builders, and teams seeking institutional exchange integration:
- P2P Diagnostics — Check whether the connected client exposes peer-listening state at all
- Client Capability Checks — Distinguish between boolean responses and unsupported-method errors across different node clients
- Peer-Network Troubleshooting — Combine with
net_peerCountandeth_syncingwhen investigating peer discovery or sync issues - Operational Audits — Confirm what the endpoint reports before wiring it into monitoring or dashboards
Request Parameters
This method accepts no parameters.
Response Body
true if the client reports that it is listening for peers, false otherwise
Code Examples
curl -X POST https://api-mantle-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "net_listening",
"params": [],
"id": 1
}'Common Use Cases
1. Capability-Aware Peer Diagnostic
Combine net_listening with other status methods, but treat unsupported responses as normal:
async function getPeerDiagnostic(provider) {
const [peerCountHex, syncing] = await Promise.all([
provider.send('net_peerCount', []),
provider.send('eth_syncing', [])
]);
let listening = { supported: false };
try {
listening = { supported: true, value: await provider.send('net_listening', []) };
} catch (error) {
listening = { supported: false, message: error.message };
}
const peerCount = parseInt(peerCountHex, 16);
return {
listening,
peerCount,
synced: syncing === false
};
}2. Fallback-Friendly Check
async function readListeningStatus(provider) {
try {
return { supported: true, value: await provider.send('net_listening', []) };
} catch (error) {
return { supported: false, message: error.message };
}
}3. Multi-Node Fleet Monitor
Check which endpoints expose net_listening and what they report:
import requests
from concurrent.futures import ThreadPoolExecutor
def check_fleet_listening(endpoints):
def check_node(endpoint):
try:
response = requests.post(
endpoint,
json={'jsonrpc': '2.0', 'method': 'net_listening', 'params': [], 'id': 1},
timeout=5
)
payload = response.json()
if 'error' in payload:
return {'endpoint': endpoint, 'supported': False, 'error': payload['error']['message']}
return {'endpoint': endpoint, 'supported': True, 'listening': payload.get('result', False)}
except Exception as e:
return {'endpoint': endpoint, 'supported': False, 'error': str(e)}
with ThreadPoolExecutor(max_workers=10) as executor:
results = list(executor.map(check_node, endpoints))
supported = [r for r in results if r.get('supported')]
unsupported = [r for r in results if not r.get('supported')]
print(f'{len(supported)}/{len(results)} endpoints expose net_listening')
for node in unsupported:
print(f' UNSUPPORTED: {node["endpoint"]} — {node.get("error", "not available")}')
return resultsError Handling
| Error Code | Description | Solution |
|---|---|---|
| -32601 | Method not found | The connected client may not expose this legacy method |
| -32603 | Internal error | Some clients surface unsupported compatibility methods through a generic internal-error path |
| -32005 | Rate limit exceeded | Reduce polling frequency or implement backoff |
| Connection refused | Cannot connect | The RPC endpoint may be unavailable — check endpoint health separately |
Related Methods
net_peerCount— Get number of connected peersnet_version— Get the network IDeth_syncing— Check node sync progressweb3_clientVersion— Get node client info