caver.rpc.net

caver.rpc.net provides JSON-RPC call with net name space.

caver.rpc.net.getNetworkId

caver.rpc.net.getNetworkId([callback])

Returns the network identifier (network ID) of the Klaytn Node.

Parameters

Return Value

Promise returns number

Example

> caver.rpc.net.getNetworkId().then(console.log)
1001

caver.rpc.net.isListening

caver.rpc.net.isListening([callback])

Returns true if the Klaytn Node is actively listening for network connections.

Parameters

Return Value

Promise returns boolean

Example

> caver.rpc.net.isListening().then(console.log)
true

caver.rpc.net.getPeerCount

caver.rpc.net.getPeerCount([callback])

Returns the number of peers currently connected to the Klaytn Node.

Parameters

Return Value

Promise returns string

Example

> caver.rpc.net.getPeerCount().then(console.log)
0x3

caver.rpc.net.getPeerCountByType

caver.rpc.net.getPeerCountByType([callback])

Returns the number of connected nodes by type and the total number of connected nodes with key/value pairs.

Parameters

Return Value

Promise returns object

Example

> caver.rpc.net.getPeerCountByType().then(console.log)
{ en: 1, pn: 2, total: 3 }

Last updated