Class

Net

Net()

Constructor

# new Net()

View Source methods/net/net.ts, line 2

Methods

# addNode(params) → {Promise.<null>}

Attempts to add or remove a node from the addnode list.

Or try a connection to a node once.

Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).

Parameters:
Name Type Description
params
node string

The node (see getpeerinfo for nodes)

command string

'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once

View Source methods/net/net.ts, line 172

Promise.<null>

# clearBanned(params) → {Promise.<null>}

Clear all banned IPs.

Parameters:
Name Type Description
params

View Source methods/net/net.ts, line 229

Promise.<null>

# disconnectNode(params) → {Promise.<null>}

Immediately disconnects from the specified peer node.

Strictly one out of 'address' and 'nodeid' can be provided to identify the node.

To disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.

Parameters:
Name Type Attributes Description
params
address string <optional>

The IP address/port of the node

nodeid number <optional>

The node ID (see getpeerinfo for node IDs)

View Source methods/net/net.ts, line 185

Promise.<null>

# getAddedNodeInfo(params) → {Promise.<Array.<GetAddedNodeInfoResponse>>}

Returns information about the given added node, or all added nodes (note that onetry addnodes are not listed here)

Parameters:
Name Type Attributes Description
params
node string <optional>

If provided, return information about this specific node, otherwise all nodes are returned.

View Source methods/net/net.ts, line 193

Promise.<Array.<GetAddedNodeInfoResponse>>

# getConnectionCount() → {Promise.<number>}

Returns the number of connections to other nodes.

View Source methods/net/net.ts, line 143

The connection count

Promise.<number>

# getNetTotals() → {Promise.<GetNetTotalsresponse>}

Returns information about network traffic, including bytes in, bytes out, and current time.

View Source methods/net/net.ts, line 199

Promise.<GetNetTotalsresponse>

# getNetworkInfo() → {Promise.<GetNetworkInfoResponse>}

Returns an object containing various state info regarding P2P networking.

View Source methods/net/net.ts, line 205

Promise.<GetNetworkInfoResponse>

# getPeerInfo() → {Promise.<Array.<GetPeerInfoResponse>>}

Returns data about each connected network node as a json array of objects.

View Source methods/net/net.ts, line 159

Promise.<Array.<GetPeerInfoResponse>>

# listBanned() → {Promise.<Array.<ListBannedResponse>>}

List all banned IPs/Subnets.

View Source methods/net/net.ts, line 222

Promise.<Array.<ListBannedResponse>>

# ping() → {Promise.<Ping>}

Requests that a ping be sent to all other nodes, to measure ping time.

Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.

Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.

View Source methods/net/net.ts, line 153

Promise.<Ping>

# setBan(params) → {Promise.<null>}

Attempts to add or remove an IP/Subnet from the banned list.

Parameters:
Name Type Attributes Description
params
subnet string

The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)

command string

'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list

bantime number <optional>

Time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)

absolute boolean <optional>

If set, the bantime must be an absolute timestamp in seconds since epoch (Jan 1 1970 GMT)

View Source methods/net/net.ts, line 216

Promise.<null>

# setNetworkActive(params) → {Promise.<boolean>}

Disable/enable all p2p network activity.

Parameters:
Name Type Description
params
param.state boolean

True to enable networking, false to disable

View Source methods/net/net.ts, line 237

Promise.<boolean>

# testGetAssetData() → {Promise.<null>}

Helper RPC CALL, dont use

View Source methods/net/net.ts, line 243

Promise.<null>