Get Node Information
Sometimes it's needed to get certain info from the Node to determine for example if the node is synced or which features it has enabled. You can get this info from a Client instance.
Client in Wallet
If you are using a wallet you can always get the client by calling the client()
/getClient()
/get_client()
method
The following code example will:
- Create a
Client
which will connect to the Shimmer Testnet. - Use the created client to get information about the node.
- Print the information to the console.
Code Example
- Rust
- Nodejs
- Python
sdk/examples/how_tos/client/get_info.rs
loading...
bindings/nodejs/examples/how_tos/client/get-info.ts
loading...
bindings/python/examples/how_tos/client/get_info.py
loading...
Expected Output
- Rust
- Nodejs
- Python
{
"name": "HORNET",
"version": "2.0.0-rc.6",
"status": {
"isHealthy": true,
"latestMilestone": {
"index": 5857259,
"timestamp": 1687786864,
"milestoneId": "0x4acfdc55bf4d7eab9e947cda3f6c4c88578c3fd59e44d3b461b706ef73186622"
},
"confirmedMilestone": {
"index": 5857259,
"timestamp": 1687786864,
"milestoneId": "0x4acfdc55bf4d7eab9e947cda3f6c4c88578c3fd59e44d3b461b706ef73186622"
},
"pruningIndex": 4749782
},
"supportedProtocolVersions": [
2
],
"protocol": {
"version": 2,
"networkName": "testnet-1",
"bech32Hrp": "rms",
"minPowScore": 1500,
"belowMaxDepth": 15,
"rentStructure": {
"vByteCost": 100,
"vByteFactorKey": 10,
"vByteFactorData": 1
},
"tokenSupply": "1450896407249092"
},
"pendingProtocolParameters": [],
"baseToken": {
"name": "Shimmer",
"tickerSymbol": "SMR",
"unit": "SMR",
"subunit": "glow",
"decimals": 6,
"useMetricPrefix": false
},
"metrics": {
"blocksPerSecond": 1.2,
"referencedBlocksPerSecond": 0.6,
"referencedRate": 50.0
},
"features": []
}
{
name: 'HORNET',
version: '2.0.0-rc.6',
status: {
isHealthy: true,
latestMilestone: {
index: 5792633,
timestamp: 1687456380,
milestoneId: '0x5d554e0c20779dae25288efefb33c385b11c2dc6088f9418d3a1fececa1385fc'
},
confirmedMilestone: {
index: 5792633,
timestamp: 1687456380,
milestoneId: '0x5d554e0c20779dae25288efefb33c385b11c2dc6088f9418d3a1fececa1385fc'
},
pruningIndex: 4750998
},
supportedProtocolVersions: [ 2 ],
protocol: {
version: 2,
networkName: 'testnet-1',
bech32Hrp: 'rms',
minPowScore: 1500,
belowMaxDepth: 15,
rentStructure: { vByteCost: 100, vByteFactorKey: 10, vByteFactorData: 1 },
tokenSupply: '1450896407249092'
},
pendingProtocolParameters: [],
baseToken: {
name: 'Shimmer',
tickerSymbol: 'SMR',
unit: 'SMR',
subunit: 'glow',
decimals: 6,
useMetricPrefix: false
},
metrics: {
blocksPerSecond: 1.4,
referencedBlocksPerSecond: 0.2,
referencedRate: 14.285714285714285
},
features: []
}
{
"name": "HORNET",
"version": "2.0.0-rc.6",
"status": {
"isHealthy": true,
"latestMilestone": {
"index": 5792633,
"timestamp": 1687456380,
"milestoneId": "0x5d554e0c20779dae25288efefb33c385b11c2dc6088f9418d3a1fececa1385fc"
},
"confirmedMilestone": {
"index": 5792633,
"timestamp": 1687456380,
"milestoneId": "0x5d554e0c20779dae25288efefb33c385b11c2dc6088f9418d3a1fececa1385fc"
},
"pruningIndex": 4750998
},
"supportedProtocolVersions": [
2
],
"protocol": {
"version": 2,
"networkName": "testnet-1",
"bech32Hrp": "rms",
"minPowScore": 1500,
"belowMaxDepth": 15,
"rentStructure": {
"vByteCost": 100,
"vByteFactorKey": 10,
"vByteFactorData": 1
},
"tokenSupply": "1450896407249092"
},
"pendingProtocolParameters": [],
"baseToken": {
"name": "Shimmer",
"tickerSymbol": "SMR",
"unit": "SMR",
"subunit": "glow",
"decimals": 6,
"useMetricPrefix": false
},
"metrics": {
"blocksPerSecond": 1.4,
"referencedBlocksPerSecond": 0.2,
"referencedRate": 14.285714285714285
},
"features": []
}