Skip to main content

Network query APIs

The interface introduced in this chapter is the Transformers node information query interface

GetVersion

  • Get the current version

Request the "GetVersion" interface get current client version, network version, database version and config version.

For example: http://IP:port/GetVersion


curl http://localhost:20620/GetVersion -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0"
}
'

Sample Request:

{
"id":"1",
"jsonrpc":"2.0"
}

Sample Response:

{
"id": "1",
"jsonrpc": "2.0",
"method": "GetVersion",
"result": {
"clientVersion": "1_1.0.0_d",
"code": 0,
"configVersion": "1.0.0",
"dbVersion": "1_1.0.0_d",
"message": "success",
"netVersion": "1"
}
}

GetChainId

  • Get the chainId

Request the "GetChainId" interface get chainId.

For example: http://IP:port/GetChainId


curl http://localhost:20620/GetChainId -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0"
}
'

Sample Request:

{
"id":"1",
"jsonrpc":"2.0"
}

Sample Response:

{
"id": "1",
"jsonrpc": "2.0",
"method": "GetChainId",
"result": {
"chainId": "0x1080c0ce",
"code": 0,
"message": "success"
}
}

GetPeerList

  • Get list of nodes currently connected to the node

Request the "GetPeerList" interface get list of nodes.

For example: http://IP:port/GetPeerList


curl http://localhost:20620/GetPeerList -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0"
}
'

Sample Request:

{
"id":"1",
"jsonrpc":"2.0"
}

Sample Response:

{
"id": "1",
"jsonrpc": "2.0",
"method": "GetPeerList",
"result": {
"code": 0,
"message": "success",
"peers": [
{
"addr": "0x0aFeBC02da4d5111d05d425e74e822B032274f2b",
"fd": 16,
"heartProbes": 3,
"height": 2499,
"ip": "192.168.1.100",
"ip_l": "192.168.1.81",
"kind": 1,
"name": "",
"port": 55302,
"port_l": 20619,
"version": "1_1.0.0_d"
},
{
"addr": "0xd57730E2CE30d412cea04689C9cDE2f0846df169",
"fd": 17,
"heartProbes": 3,
"height": 2499,
"ip": "192.168.1.110",
"ip_l": "192.168.1.81",
"kind": 1,
"name": "",
"port": 36874,
"port_l": 20619,
"version": "1_1.0.0_d"
}
],
"size": 2
}
}

GetAllStakeNodeList

  • Get all stake node list

Just request the "GetAllStakeNodeList" interface from the request node without any parameters

For example: http://IP:port/GetAllStakeNodeList


curl http://localhost:20620/GetAllStakeNodeList -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0",
"params":{}
}
'

Sample Request:

{
"id":"1",
"jsonrpc":"2.0",
"params":{}
}

Sample Response:

{
"id": "1",
"jsonrpc": "2.0",
"method": "GetAllStakeNodeList",
"result": {
"code": 0,
"list": {
"list": [
{
"addr": "0x01921896D8AAC12B19BC8413135907AB5aE82326",
"height": "590",
"identity": "MCowBQYDK2VwAyEAnkb8f/5s/LsQXNlU7/SDXR2sPf8IZZrbZ9v2HmYJffk=",
"ip": "192.168.1.86",
"version": "1_1.0.0_d"
},
{
"addr": "0x0796B6DB27e5eb1e9F8Bd2c4d03191C902D22F0f",
"height": "590",
"identity": "MCowBQYDK2VwAyEAHDoLfSX+ygmvSICr/1Q/UnfLlPFkAQBB4oPZne/SoVo=",
"ip": "192.168.1.118",
"version": "1_1.0.0_d"
}
],
"message": "success",
"version": "1_1.0.0_d"
},
"message": "success"
}
}

GetBonusInfo

  • Obtain a list of node signature quantities

For example: http://IP:port/GetBonusInfo


curl http://localhost:20620/GetBonusInfo -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0",
"params":{}
}
'

Sample Request:

{
"id":"1",
"jsonrpc":"2.0",
"params":{}
}

Sample Response:

{
"id": "1",
"jsonrpc": "2.0",
"method": "GetBonusInfo",
"result": {
"code": 0,
"info": {
"addr_count": [
{
"address": "0xCA66A76E2a279050EF6b57797ac53199379abB9F",
"count": 3 // Number of signatures
},
{
"address": "0xdaAfa89eafe616EEa5Aa219d93bC8b1C0299Cc9E",
"count": 4
}
],
"time": "1717113600000000"
},
"message": "message"
}
}

GetRatesInfo

  • Obtain information on interest rates across the entire network

Parameter:
  None
Returned value:
  code – Return code,0 is success
  message – Return message
  TotalCirculatingSupply – Total circulation
  TotalBurn – Total Destruction
  TotalStaked – Total stake
  StakingRate – Stake rate
  CurrentAPR: – Annualized rate


For example: http://IP:port/GetRatesInfo


curl http://localhost:20620/GetRatesInfo -X POST -H "Content-Type: application/json" -d '
{
"id":"1",
"jsonrpc":"2.0",
"params":{}
}
'

Sample Request:

{
"id":"1",
"jsonrpc":"2.0",
"params":{}
}

Sample Response:

{
"id": "1",
"jsonrpc": "2.0",
"method": "GetRatesInfo",
"result": {
"CurrentAPR": "0.193600",
"StakingRate": "0.016928",
"TotalBurn": "66698700",
"TotalCirculatingSupply": "7000088131803423",
"TotalStaked": "118497110000000",
"code": 0,
"message": "success"
}
}

Node pub info

  • View the status of node links
note

return data in non-json format.

For example: http://IP:20620/pub

Sample Response:

file_name:./tfs_v1.1.0_68d583b_testnet 
==================================
ca_active_task:0
ca_pending_task:0
==================================
net_active_task:0
net_pending_task:0
==================================
broadcast_active_task:0
broadcast_pending_task:0
==================================
tx_active_task:0
tx_pending_task:0
==================================
syncBlock_active_task:0
syncBlock_pending_task:0
==================================
saveBlock_active_task:0
saveBlock_pending_task:0
==================================
block_active_task:0
block_pending_task:0
==================================
work_active_task:0
work_pending_task:0
==================================
g_queueRead:0
g_queueWork:0
g_queueWrite:0


------------------------------------------
BlockMsg: 3 size: 0.032 MB
BuildBlockBroadcastMsg: 44 size: 0.579 MB
CheckTxAck: 1378 size: 0.541 MB
KeyExchangeRequest: 400 size: 0.0645 MB
KeyExchangeResponse: 250 size: 0.0403 MB
NodeHeightChangedReq: 82936 size: 16.4 MB
PingReq: 9866 size: 0.847 MB
PongReq: 9725 size: 0.835 MB
RegisterNodeAck: 148 size: 2.17 MB
RegisterNodeReq: 281 size: 0.0909 MB
SeekPreHashByHightReq: 10 size: 0.00152 MB
SyncGetBlockAck: 115 size: 0.584 MB
SyncGetBlockReq: 5 size: 0.0176 MB
SyncGetHeightHashAck: 5188 size: 2.61 MB
SyncGetHeightHashReq: 3265 size: 0.504 MB
SyncGetSumHashAck: 2880 size: 20.6 MB
SyncGetSumHashReq: 4655 size: 0.715 MB
SyncNodeAck: 1183 size: 15.6 MB
SyncNodeHashAck: 3746 size: 0.797 MB
SyncNodeHashReq: 6013 size: 0.895 MB
SyncNodeReq: 1325 size: 0.197 MB
newSeekContractPreHashReq: 12 size: 0.0027 MB
------------------------------------------
Count: 133428 Total: 64.1 MB


amount:
0x079da3A25c2F5C6B25552D86683DC48a5f45f1a1:99940000


Public PeerNode size is: 117

------------------------------------------------------------------------------------------------------------
ip(46.4.64.123) port(35566) ip_l(52.8.162.216) port_l(20619) kind(2) fd(103) addr(0x019F52d4552C417F1cF2d19a829874E9957A53F5) pulse(3) height( 157 ) name(dnsarz) version(1_1.1.0_t) logo(https://s3.amazonaws.com/keybase_processed_uploads/d351ed361a4fb96af568efa01c80b505_360_360.jpg)
ip(84.247.167.223) port(58666) ip_l(52.8.162.216) port_l(20619) kind(1) fd(115) addr(0x0318aedfaB29543f83ba285164454D2CE6cF39dF) pulse(3) height( 157 ) name(Moonlighter) version(1_1.1.0_t) logo(https://i.ibb.co/vDNZXf6/43675.png)
ip(213.21.202.33) port(46288) ip_l(52.8.162.216) port_l(20619) kind(1) fd(65) addr(0x0375f4371472871A01E03472Ea5043A50c8A18e3) pulse(3) height( 0 ) name() version(1_1.1.0_t) logo()
ip(144.217.180.121) port(33346) ip_l(52.8.162.216) port_l(20619) kind(1) fd(33) addr(0x06E43Ae952d6AeA45210C00dCe4113A606FE9fc8) pulse(3) height( 157 ) name() version(1_1.1.0_t) logo()
------------------------------------------------------------------------------------------------------------
PeerNode size is: 117