Net

This page describes network related APIs

net_join

Instructs the client to join a network. The client sends a Handshake message to the addresses and adds them as peers if the handshake was successful.

Private: Requires authentication.

Parameters

Argument

Type

Description

addresses

Array<String>

A list of addresses.

Curl Example:

curl -X POST --data '{
    "jsonrpc":"2.0", 
    "method":"net_join", 
    "params": [
        "ellcrys://12D3KooWHHzSeKaY8xuZVzkLbKFfvNgPPeKhFBGrMbNzbm5akpqu@127.0.0.1:9000"
    ],
    "id":21
}'

Console Example

> net.join(["ellcrys://12D3KooWHHzSeKaY8xuZVzkLbKFfvNgPPeKhFBGrMbNzbm5akpqu@127.0.0.1:9000"])
> net.join(
    "ellcrys://12D3KooWHHzS...zbm5akpqu@127.0.0.1:9000", 
    "ellcrys://12D3Koo..KhFBGrMbNzbagskuda@127.0.0.1:9000"
)

Returns:

Boolean

Output:

{
  "id": 8534968035807551000,
  "jsonrpc": "2.0",
  "result": true
}    

net_addPeer

Add one or more addresses to the peer list. These addresses will be lazily connected to only when the client needs more peer connections.

Private: Requires authentication.

Parameters

Argument

Type

Description

addresses

Array<String>

A list of addresses.

Curl Example:

curl -X POST --data '{
    "jsonrpc":"2.0", 
    "method":"net_addPeer", 
    "params": [
        "ellcrys://12D3KooWHHzSeKaY8xuZVzkLbKFfvNgPPeKhFBGrMbNzbm5akpqu@127.0.0.1:9000"
    ],
    "id":21
}'

Console Example

> net.addPeer(["ellcrys://12D3KooWHHzSeKaY8xuZVzkLbKFfvNgPPeKhFBGrMbNzbm5akpqu@127.0.0.1:9000"])
> net.addPeer(
    "ellcrys://12D3KooWHHzS...zbm5akpqu@127.0.0.1:9000", 
    "ellcrys://12D3Koo..KhFBGrMbNzbagskuda@127.0.0.1:9000"
)

Returns:

Boolean

Output:

{
  "id": 8534968035807551000,
  "jsonrpc": "2.0",
  "result": true
}    

net_stats

Get the client's connection statistics.

Parameters

Curl Example:

curl -X POST --data '{"jsonrpc":"2.0",  "method":"net_stats", "id":21 }'

Console Example

> net.stats()

Returns:

Object

Field

Type

Description

inbound

Integer

The number of inbound connections.

outbound

Integer

The number of outbound connections.

intros

Integer

The number of intro messages received.

total

Integer

The total number of connections.

Output:

{
  "id": 7082198080470856000,
  "jsonrpc": "2.0",
  "result": {
    "inbound": 5,
    "intros": 3,
    "outbound": 6,
    "total": 9
  }
}  

net_getPeers

Get all known peers.

Parameters

Curl Example:

curl -X POST --data '{"jsonrpc":"2.0",  "method":"net_getPeers", "id":21 }'

Console Example

> net.getPeers()

Returns:

Array<Object>

Field

Type

Description

id

String

The ID of the peer.

name

String

The node's user-friendly name.

connected

Boolean

Indicates that the local peer is connected to the peer or not.

isInbound

Boolean

Indicates that the connection to this peer is inbound or not.

isBanned

Boolean

Indicates that the peer is currently banned or not.

isAcquainted

Boolean

Indicates that the peer and the local peer have

performed the Handshake ritual or not.

banEndTime

String

The time this peer will complete its ban term.

lastSeen

String

The time this peer was last heard from.

Output:

{
  "id": 21,
  "jsonrpc": "2.0",
  "result": [
    {
      "name": "normally-liked-eel",
      "banEndTime": "0001-01-01T00:00:00Z",
      "connected": true,
      "id": "12D3KooWHHzSeKaY8xuZVzkLbKFfvNgPPeKhFBGrMbNzbm5akpqu",
      "isAcquainted": true,
      "isBanned": false,
      "isInbound": false,
      "lastSeen": "2018-11-10T15:05:46.915069009+01:00"
    }
  ]
}

net_getActivePeers

Get all active peers. Active peers are peers that are not serving any ban time and have been seen in the last 3 hours.

Parameters

Curl Example:

curl -X POST --data '{"jsonrpc":"2.0",  "method":"net_getActivePeers", "id":21 }'

Console Example

> net.getActivePeers()

Returns:

Array<Object>

Field

Type

Description

id

String

The ID of the peer.

name

String

The node's user-friendly name.

connected

Boolean

Indicates that the local peer is connected to the peer or not.

isInbound

Boolean

Indicates that the connection to this peer is inbound or not.

isBanned

Boolean

Indicates that the peer is currently banned or not.

isAcquainted

Boolean

Indicates that the peer and the local peer have

performed the Handshake ritual or not.

banEndTime

String

The time this peer will complete its ban term.

lastSeen

String

The time this peer was last heard from.

Output:

{
  "id": 21,
  "jsonrpc": "2.0",
  "result": [
    {
      "name": "normally-liked-eel",
      "banEndTime": "0001-01-01T00:00:00Z",
      "connected": true,
      "id": "12D3KooWHHzSeKaY8xuZVzkLbKFfvNgPPeKhFBGrMbNzbm5akpqu",
      "isAcquainted": true,
      "isBanned": false,
      "isInbound": false,
      "lastSeen": "2018-11-10T15:05:46.915069009+01:00"
    }
  ]
}

net_dumpPeers

Clear all peers stored in memory and on disk.

Parameters

Curl Example:

curl -X POST --data '{"jsonrpc":"2.0",  "method":"net_dumpPeers", "id":21 }'

Console Example

> net.dumpPeers()

Returns:

Boolean

Output:

{
  "id": 21,
  "jsonrpc": "2.0",
  "result": true
}

net_broadcasters

Returns the addresses of peers that have been selected by the peer as recipients of messages (transactions, blocks, addresses e.t.c) that need to be broadcast or forwarded. These broadcasters are separated into two categories namely:

  • Regular broadcasters

  • Random broadcasters

Regular broadcasters are peers that are actively connected and known by the node. They are acquainted and compatible with the node. Random broadcasters may not be known or compatible with the node. They are mostly used for broadcasting addresses to aid the network's discovery protocol.

Parameters

Curl Example:

curl -X POST --data '{"jsonrpc":"2.0",  "method":"net_broadcasters", "id":21 }'

Console Example

> net.broadcasters()

Returns:

Object

Field

Type

Description

broadcasters

Array<string>

A list of regular broadcasters address.

randomBroadcasters

Array<string>

A list of random broadcasters address.

Output:

{
  "id": 21,
  "jsonrpc": "2.0",
  "result": {
    "broadcasters": [
      "ellcrys://12D3KooWDWA4g8EXWWBSbW...7nCDnbVADP1@127.0.0.1:9000",
      "ellcrys://12D3KooWCQgfHv8..fWvmwCPninVXpifMP@127.0.0.1:9000",
      "ellcrys://12D3KooWD276x1iei...S6AT2uAkHHFNADRx@127.0.0.1:9000"
    ],
    "randomBroadcasters": [
      "ellcrys://12D3KooWDWA4g8EXW..CDnbVADP1@127.0.0.1:9000",
      "ellcrys://12D3KooWCQgfH...b36BfWvmwCPninVXpifMP@127.0.0.1:9000",
      "ellcrys://12D3KooWD276x1ieiV9cmt...FNADRx@127.0.0.1:9000"
    ]
  }
}

net_noNet

Disables network activities. Prevents inbound or outbound connections by shutting down the client's network function.

Private: Requires authentication.

Parameters: Nonde

Curl Example:

curl -X POST --data '{
    "jsonrpc":"2.0", 
    "method":"net_noNet", 
    "params": null,
    "id":21
}'

Console Example

> net.noNet()

Returns:

Boolean

Output:

{
  "id": 8534968035807551000,
  "jsonrpc": "2.0",
  "result": true
}    

Last updated