Net API

The web3.net object exposes methods to interact with the RPC APIs under the net_ namespace.

Properties

The following properties are available on the web3.net namespace.

property web3.net.chainId

Warning

Deprecated: This property is deprecated as of EIP 1474.

property web3.net.listening
  • Delegates to net_listening RPC method

Returns true if client is actively listening for network connections.

>>> web3.net.listening
True
property web3.net.peer_count
  • Delegates to net_peerCount RPC method

Returns number of peers currently connected to the client.

>>> web3.net.peer_count
1
property web3.net.peerCount

Warning

Deprecated: This property is deprecated in favor of peer_count

property web3.net.version
  • Delegates to net_version RPC Method

Returns the current network id.

>>> web3.net.version
'8996'