Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Latest commit

 

History

History
100 lines (67 loc) · 1.4 KB

JSONRPC-net-module.md

File metadata and controls

100 lines (67 loc) · 1.4 KB
title
The `net` Module

JSON-RPC methods

JSON-RPC API Reference

net_listening

Returns true if client is actively listening for network connections.

Parameters

None

Returns

  • Boolean - true when listening, otherwise false.

Example

Request

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

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

net_peerCount

Returns number of peers currenly connected to the client.

Parameters

None

Returns

  • Quantity - Integer of the number of connected peers

Example

Request

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

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x2" // 2
}

net_version

Returns the current network protocol version.

Parameters

None

Returns

  • String - The current network protocol version

Example

Request

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

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "8995"
}