Functions to receive details about the current connected network.
rsk3.net.getId([callback])
Gets the current network ID.
none
Promise
returns Number
: The network ID.
rsk3.net.getId().then(console.log);
> 1
rsk3.net.isListening([callback])
Checks if the node is listening for peers.
none
Promise
returns Boolean
rsk3.net.isListening().then(console.log);
> true
rsk3.net.getPeerCount([callback])
Get the number of peers connected to.
none
Promise
returns Number
rsk3.net.getPeerCount().then(console.log);
> 25
rsk3.net.getNetworkType([callback])
Guesses the chain the node is connected by comparing the genesis hashes.
It's recommended to use the
rsk3.getChainId
method
to detect the currently connected chain.
Promise
returns String
:"main"
for main network"morden"
for the morden test network"rinkeby"
for the rinkeby test network"ropsten"
for the ropsten test network"kovan"
for the kovan test network"private"
for undetectable networks.rsk3.net.getNetworkType().then(console.log);
> "main"
Go to top