node

This module allows you to get information about the node and blockchain. It can be accessed from the global variable node.

getBlock

node.getBlock(height)

Get a tendermint block at the given height.

Parameters

  1. height - String|Number: The target block height

Returns

Tendermint Block

Example

node.getBlock(101)

getHeight

node.getHeight()

Get the current height of the blockchain.

Returns

String - The height of the node.

Example

JavaScript
Output
JavaScript
node.getHeight()
Output
"123"

getBlockInfo

node.getBlockInfo(height)

Get a summary block at the given height. This block information is indexed by MakeOS (not Tendermint).

Parameters

  1. height - String|Number: The target block height

Returns

String - The height of the node.

Example

JavaScript
Output
JavaScript
node.getBlockInfo(101)
Output
{
"appHash": "taKg/qP1ER5I4kI6Kw9es1aWNZtYklVh1WhhMJm5LLw=",
"hash": "Id6OEYekHgLNiT7ZEGibbkVJZnMREgUUnRxWoLM1pPc=",
"height": "101",
"lastAppHash": "0dmLRT0oSfxQroggDk/2hnGDDGwU+CX4iH/nhPPX1i8=",
"proposerAddress": "3PSYFHDDgGUTdOrG+1DY5aX92B4=",
"time": "1597666979"
}

getValidators

node.getValidators(height)

Get a list of validators that processed a given block.

Parameters

  1. height - String|Number: The target block height whose validators will be returned.

Returns

Object - The result object

Example

JavaScript
Output
JavaScript
node.getValidators(101)
Output
[
{
"address": "os1858effdlfecl30hgq0dvpesygp2daf97malemz",
"publicKey": "48gS3kCMVTJjHvJBwuQXXAFwYgJiATE7xJY34UuAJVbuHDoEZ2V",
"ticketId": "0x",
"tmAddress": "DCF4981470C380651374EAC6FB50D8E5A5FDD81E"
}
]

isSyncing

node.isSyncing()

Checks whether the node is currently synchronizing blocks and state with peers.

Returns

Boolean

Example

JavaScript
Output
JavaScript
node.isSyncing()
Output
true