Klaytn Docs
Search…
net
APIs used to query network configuration.
The namespace net provides functions related to the Klaytn networks.

net_networkID

Returns the network identifier (network ID).
Parameters
None
Return Value
Type
Description
QUANTITY
The integer of the network identifier. - "1001": Klaytn Baobab testnet. - "8217": Klaytn Cypress mainnet.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_networkID","params":[],"id":67}' https://api.baobab.klaytn.net:8651
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":67,
8
"result":"1001"
9
}
Copied!

net_listening

Returns true if the client is actively listening for network connections.
Parameters
None
Return Value
Type
Description
Boolean
true when listening, otherwise false.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}' https://api.baobab.klaytn.net:8651
3
4
// Result
5
{
6
"id":67,
7
"jsonrpc":"2.0",
8
"result":true
9
}
Copied!

net_peerCount

Returns the number of peers currently connected to the client.
Parameters
None
Return Value
Type
Description
QUANTITY
Integer of the number of connected peers.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}' https://api.baobab.klaytn.net:8651
3
4
// Result
5
{
6
"id":74,
7
"jsonrpc": "2.0",
8
"result": "0x3" // 2
9
}
Copied!

net_peerCountByType

Returns the number of connected nodes by type and the total number of connected nodes with key/value pairs.
Parameters
None
Return Value
Type
Description
JSON string
The number of connected peers by type as well as the total number of connected peers.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_peerCountByType","params":[],"id":74}' https://api.baobab.klaytn.net:8651
3
4
// Result
5
{
6
"id":74,
7
"jsonrpc": "2.0",
8
"result": {"en":3,"pn":2,"total":5}
9
}
Copied!

net_version

Return the current klaytn protocol version.
Parameters
None
Return Value
Type
Description
QUANTITY
The integer of the klaytn protocol version. - "1001": Klaytn Baobab testnet. - "8217": Klaytn Cypress mainnet.
Example
1
// Request
2
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}' https://api.baobab.klaytn.net:8651
3
// Result
4
{
5
"jsonrpc":"2.0",
6
"id":67,
7
"result":"1001"
8
}
Copied!
Last modified 3mo ago