node
This module allows you to get information about the node and blockchain. It can be accessed from the global variable
node
.node.getBlock(height)
Get a tendermint block at the given height.
- 1.
height
-String|Number
: The target block height
node.getBlock(101)
node.getHeight()
Get the current height of the blockchain.
String
- The height of the node.JavaScript
Output
node.getHeight()
"123"
node.getBlockInfo(height)
Get a summary block at the given height. This block information is indexed by MakeOS (not Tendermint).
- 1.
height
-String|Number
: The target block height
String
- The height of the node.JavaScript
Output
node.getBlockInfo(101)
{
"appHash": "taKg/qP1ER5I4kI6Kw9es1aWNZtYklVh1WhhMJm5LLw=",
"hash": "Id6OEYekHgLNiT7ZEGibbkVJZnMREgUUnRxWoLM1pPc=",
"height": "101",
"lastAppHash": "0dmLRT0oSfxQroggDk/2hnGDDGwU+CX4iH/nhPPX1i8=",
"proposerAddress": "3PSYFHDDgGUTdOrG+1DY5aX92B4=",
"time": "1597666979"
}
node.getValidators(height)
Get a list of validators that processed a given block.
- 1.
height
-String|Number
: The target block height whose validators will be returned.
Object
- The result objectJavaScript
Output
node.getValidators(101)
[
{
"address": "os1858effdlfecl30hgq0dvpesygp2daf97malemz",
"publicKey": "48gS3kCMVTJjHvJBwuQXXAFwYgJiATE7xJY34UuAJVbuHDoEZ2V",
"ticketId": "0x",
"tmAddress": "DCF4981470C380651374EAC6FB50D8E5A5FDD81E"
}
]
node.isSyncing()
Checks whether the node is currently synchronizing blocks and state with peers.
Boolean
JavaScript
Output
node.isSyncing()
true
Last modified 2yr ago