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:
1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"method":"net_join",
4
"params": [
5
"ellcrys://[email protected]:9000"
6
],
7
"id":21
8
}'
Copied!

Console Example

1
> net.join(["ellcrys://[email protected]:9000"])
2
> net.join(
3
"ellcrys://[email protected]:9000",
4
"ellcrys://[email protected]:9000"
5
)
Copied!

Returns:

Boolean

Output:

1
{
2
"id": 8534968035807551000,
3
"jsonrpc": "2.0",
4
"result": true
5
}
Copied!

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:
1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"method":"net_addPeer",
4
"params": [
5
"ellcrys://[email protected]:9000"
6
],
7
"id":21
8
}'
Copied!

Console Example

1
> net.addPeer(["ellcrys://[email protected]:9000"])
2
> net.addPeer(
3
"ellcrys://[email protected]:9000",
4
"ellcrys://[email protected]:9000"
5
)
Copied!

Returns:

Boolean

Output:

1
{
2
"id": 8534968035807551000,
3
"jsonrpc": "2.0",
4
"result": true
5
}
Copied!

net_stats

Get the client's connection statistics.
Parameters
Curl Example:
1
curl -X POST --data '{"jsonrpc":"2.0", "method":"net_stats", "id":21 }'
Copied!

Console Example

1
> net.stats()
Copied!

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:

1
{
2
"id": 7082198080470856000,
3
"jsonrpc": "2.0",
4
"result": {
5
"inbound": 5,
6
"intros": 3,
7
"outbound": 6,
8
"total": 9
9
}
10
}
Copied!

net_getPeers

Get all known peers.
Parameters
Curl Example:
1
curl -X POST --data '{"jsonrpc":"2.0", "method":"net_getPeers", "id":21 }'
Copied!

Console Example

1
> net.getPeers()
Copied!

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:

1
{
2
"id": 21,
3
"jsonrpc": "2.0",
4
"result": [
5
{
6
"name": "normally-liked-eel",
7
"banEndTime": "0001-01-01T00:00:00Z",
8
"connected": true,
9
"id": "12D3KooWHHzSeKaY8xuZVzkLbKFfvNgPPeKhFBGrMbNzbm5akpqu",
10
"isAcquainted": true,
11
"isBanned": false,
12
"isInbound": false,
13
"lastSeen": "2018-11-10T15:05:46.915069009+01:00"
14
}
15
]
16
}
Copied!

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:
1
curl -X POST --data '{"jsonrpc":"2.0", "method":"net_getActivePeers", "id":21 }'
Copied!

Console Example

1
> net.getActivePeers()
Copied!

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:

1
{
2
"id": 21,
3
"jsonrpc": "2.0",
4
"result": [
5
{
6
"name": "normally-liked-eel",
7
"banEndTime": "0001-01-01T00:00:00Z",
8
"connected": true,
9
"id": "12D3KooWHHzSeKaY8xuZVzkLbKFfvNgPPeKhFBGrMbNzbm5akpqu",
10
"isAcquainted": true,
11
"isBanned": false,
12
"isInbound": false,
13
"lastSeen": "2018-11-10T15:05:46.915069009+01:00"
14
}
15
]
16
}
Copied!

net_dumpPeers

Clear all peers stored in memory and on disk.
Parameters
Curl Example:
1
curl -X POST --data '{"jsonrpc":"2.0", "method":"net_dumpPeers", "id":21 }'
Copied!

Console Example

1
> net.dumpPeers()
Copied!

Returns:

Boolean

Output:

1
{
2
"id": 21,
3
"jsonrpc": "2.0",
4
"result": true
5
}
Copied!

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:
1
curl -X POST --data '{"jsonrpc":"2.0", "method":"net_broadcasters", "id":21 }'
Copied!

Console Example

1
> net.broadcasters()
Copied!

Returns:

Object
Field
Type
Description
broadcasters
Array<string>
A list of regular broadcasters address.
randomBroadcasters
Array<string>
A list of random broadcasters address.

Output:

1
{
2
"id": 21,
3
"jsonrpc": "2.0",
4
"result": {
5
"broadcasters": [
6
"ellcrys://[email protected]:9000",
7
"ellcrys://[email protected]:9000",
8
"ellcrys://[email protected]:9000"
9
],
10
"randomBroadcasters": [
11
"ellcrys://[email protected]:9000",
12
"ellcrys://[email protected]:9000",
13
"ellcrys://[email protected]:9000"
14
]
15
}
16
}
17
Copied!

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:
1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"method":"net_noNet",
4
"params": null,
5
"id":21
6
}'
Copied!

Console Example

1
> net.noNet()
Copied!

Returns:

Boolean

Output:

1
{
2
"id": 8534968035807551000,
3
"jsonrpc": "2.0",
4
"result": true
5
}
Copied!