Skip to content

Net

Entity Version
Source 1.12.14-unstable/generated-at:2023-09-04T08:02:34-06:00
OpenRPC 1.2.6

net_listening

Listening returns an indication if the node is listening for network connections.

Params (0)

None

Result

bool

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "net_listening", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "net_listening", "params": []}'
1
net.listening();
Source code

1
2
3
func (s *NetAPI) Listening() bool {
    return true
}// Listening returns an indication if the node is listening for network connections.
View on GitHub →


net_peerCount

PeerCount returns the number of connected peers

Params (0)

None

Result

hexutil.Uint

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "net_peerCount", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "net_peerCount", "params": []}'
1
net.peerCount();
Source code

1
2
3
func (s *NetAPI) PeerCount() hexutil.Uint {
    return hexutil.Uint(s.net.PeerCount())
}// PeerCount returns the number of connected peers
View on GitHub →


net_version

Version returns the current ethereum protocol version.

Params (0)

None

Result

string

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "net_version", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "net_version", "params": []}'
1
net.version();
Source code

1
2
3
func (s *NetAPI) Version() string {
    return fmt.Sprintf("%d", s.networkVersion)
}// Version returns the current ethereum protocol version.
View on GitHub →



Last update: 2024-06-10