go-ethereum/docs/interacting-with-geth/rpc/ns-net.md

34 lines
972 B
Markdown
Raw Permalink Normal View History

2022-09-09 09:28:25 -03:00
---
title: net Namespace
description: Documentation for the JSON-RPC API "net" namespace
---
The `net` API provides insight about the networking aspect of the client.
2022-11-25 17:34:46 +00:00
## net_listening {#net-listening}
2022-09-09 09:28:25 -03:00
Returns an indication if the node is listening for network connections.
| Client | Method invocation |
| :------ | ----------------------------- |
| Console | `net.listening` |
| RPC | `{"method": "net_listening"}` |
2022-11-25 17:34:46 +00:00
## net_peerCount {#net-peercount}
2022-09-09 09:28:25 -03:00
Returns the number of connected peers.
| Client | Method invocation |
| :------ | ----------------------------- |
| Console | `net.peerCount` |
| RPC | `{"method": "net_peerCount"}` |
2022-11-25 17:34:46 +00:00
## net_version {#net-version}
2022-09-09 09:28:25 -03:00
Returns the devp2p network ID (e.g. 1 for mainnet, 5 for goerli).
| Client | Method invocation |
| :------ | --------------------------- |
| Console | `net.version` |
| RPC | `{"method": "net_version"}` |