Node

E
Last updated 3 days ago

Overview

Node APIs provide access to the client engine. Access information about the client's state and configuration.

node_getTransactionStatus

Get the status of a transaction. Learn whether a transaction has been included in a mined block or whether it is in the transaction pool.

Parameters:

Argument

Type

Required

Description

hash

String

True

The transaction's hash

Curl Example:

curl -X POST --data '{"jsonrpc":"2.0","method":"node_getTransactionStatus", "params": "0xf91be74146afb8717834f70969d02edff4316508dc62ec8716104968391fc492", "id":21}'

Console Example

> node.getTransactionStatus("0xf91be74146afb8717834f70969d02edff4316508dc62ec8716104968391fc492")

Returns:

Object or null when the node is fully synced with its peers.

Field

Type

Description

status

String

"mined" = In a block that has been mined.

"pooled" = In the transaction pool.

Output:

{
"id": 21,
"jsonrpc": "2.0",
"result": {
"status": "mined"
}
}

node_getSyncStat

Get the progress stats of block synchronization between the node and a peer.

Parameters: None

Curl Example:

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

Console Example

> node.getSyncStat()

Returns:

Object | null

Field

Type

Description

currentChainHeight

Integer

The current height of the main chain.

currentTotalDifficulty

Integer

The current total difficulty of the main chain.

progressPercent

Integer

Describes the sync progress as a percentage.

targetChainHeight

Integer

The highest chain height discovered from peer interactions.

targetTotalDifficulty

Integer

The highest total difficulty discovered from peer interactions.

Output:

{
"id": 21,
"jsonrpc": "2.0",
"result": {
"currentChainHeight": 1,
"currentTotalDifficulty": 10000000,
"progressPercent": 0,
"targetChainHeight": 8159,
"targetTotalDifficulty": 81680611840
}
}

node_isSyncing

Checks whether the client is currently syncing with peers.

Parameters: None

Curl Example:

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

Console Example

> node.isSyncing()

Returns:

Boolean

Output:

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

node_info

Get information about the node. The information returned may include sensitive details about the node.

Private: Requires authentication.

Parameters: None

Curl Example:

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

Console Example

> node.info()

Returns:

Object

Field

Type

Description

address

String

The listening address of client.

id

String

The node ID.

name

String

A random pet name.

coinbase

String

The clients loaded account used to derive its unique

network ID and receive rewards.

coinbasePublicKey

String

The public key of the client. Used to derive the

address and node ID.

listeningAddresses

Array<String>

A list of all listening addresses.

mode

String

The currently enabled environment. ("development" or "production").

syncing

Boolean

Whether the node is currently syncing.

netVersion

String

The nodes network version.

buildVersion

String

The client's build version.

buildDate

String

The client's build date.

buildCommit

String

The client's build git commit hash.node.

goVersion

String

The version of go that was used to create the build.

Output:

{
"id": 21,
"jsonrpc": "2.0",
"result": {
"name": "frankly-resolved-snipe",
"address": "ellcrys://[email protected]:9001",
"coinbase": "eH3vy3dv3KLFQ3bJD9nNuqubCZqxduWRsg",
"coinbasePublicKey": "47w9pZcNDa868gB1pD3Ye14aMGqpUzm4eZG7LUjsGym5VHNdMfF",
"id": "12D3KooWBBSJ75d1imQResWMrHf5D3GrreKjdjkHBJVKb8iWyWQ5",
"listeningAddresses": [
"/ip4/127.0.0.1/tcp/9001/ipfs/12D3KooWBBSJ75d1imQResWMrHf5D3GrreKjdjkHBJVKb8iWyWQ5",
"/ip4/192.168.40.205/tcp/9001/ipfs/12D3KooWBBSJ75d1imQResWMrHf5D3GrreKjdjkHBJVKb8iWyWQ5",
"/ip4/10.6.6.251/tcp/9001/ipfs/12D3KooWBBSJ75d1imQResWMrHf5D3GrreKjdjkHBJVKb8iWyWQ5"
],
"mode": "development",
"netVersion": "/inception/1",
"syncing": false,
"buildCommit": "2ee1b3b70a4acd6ea45d2e00ea4fba666c709ac7",
"buildDate": "2018-12-17T21:17:05Z",
"buildVersion": "0.1.5-alpha",
"goVersion": "go1.10.4"
}
}

node_basic

Get public-friendly information about the node. Unlike node_basic , the information that is returned are non-sensitive and suitable for public access.

Curl Example:

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

Console Example

> node.basic()

Returns:

Object

Field

Type

Description

id

String

The node ID.

name

String

A random pet name.

mode

String

The currently enabled environment. ("development" or "production").

syncing

Boolean

Whether the node is currently syncing.

netVersion

String

The nodes network version.

buildVersion

String

The client's build version.

buildDate

String

The client's build date.

buildCommit

String

The client's build git commit hash.node.

goVersion

String

The version of go that was used to create the build.

Output:

{
"id": 21,
"jsonrpc": "2.0",
"result": {
"id": "12D3KooWCsZKcVA2kzRwxBF4NcUXsuABK9Mmd9nRuyfyLqtKEFcR",
"mode": "production",
"name": "frankly-resolved-snipe",
"netVersion": "0001",
"syncing": false,
"buildCommit": "2ee1b3b70a4acd6ea45d2e00ea4fba666c709ac7",
"buildDate": "2018-12-17T21:17:05Z",
"buildVersion": "0.1.5-alpha",
"goVersion": "go1.10.4"
}
}

node_config

Returns the clients configurations.

Private: Requires authentication.

Parameters: None

Curl Example:

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

Console Example

> node.config()

Returns:

Object

Field

Type

Description

peer

Object

The client specific configuration.

.messageTimeout

Int

The number of seconds to wait before aborting connection attempt.

.addresses

Array<String>

A list of bootstrap connection addresses.

.cleanUpInt

Int

Number of seconds between peer address clean up.

.conEstInt

Int

Number of seconds between attempts to establish connection with unconnected peer.

.dev

Int

The environment mode. (0 = production, 1 = development, 2 = test).

getAddrInt

Int

Number of seconds between requests for more addresses.

maxAddrsExpected

Int

The maximum number of addresses expected from a peer.

maxInConnections

Int

The maximum number of inbound connections.

maxOutConnections

Int

The maximum number of outbound connections.

pingInt

Int

Number of seconds between pings to peers.

selfAdvInt

Int

Number of seconds between self advertisements to peers.

rpc

Object

RPC specific configurations.

.disableAuth

Boolean

Disable RPC authentication (default=false)

.username

String

RPC username (default=admin)

.password

String

RPC Password (default=admin)

.sessionSecretKey

String

Session key is used to bcrypt the RPC session token.

txPool

Object

Transaction pool configurations.

.cap

Int

The maximum number of transactions that is allowed in the transaction pool.

Please change the default RPC username and password before enabling RPC service. Also set up appropriate firewall to prevent unauthorized access to the RPC endpoint.

Keep your RPC session secret private.

Output:

{
"id": 21,
"jsonrpc": "2.0",
"result": {
"peer": {
"MessageTimeout": 60,
"addresses": null,
"cleanUpInt": 600,
"conEstInt": 10,
"mode": 1,
"getAddrInt": 60,
"maxAddrsExpected": 1000,
"maxInConnections": 10,
"maxOutConnections": 10,
"pingInt": 60,
"selfAdvInt": 10
},
"rpc": {
"disableAuth": false,
"password": "admin",
"sessionSecretKey": "wGzgzDAVmr....ylSiIaYbUgIU",
"username": "admin"
},
"txPool": {
"cap": 10000
}
}
}

‚Äč