Skip to main content

Account query APIs

The interface introduced in this chapter is the account information query interface

GetAccounts

  • Get a list of addresses owned by the node

Request the "GetAccounts" interface get list of addresses.

For example: http://IP:port/GetAccounts


curl http://localhost:20620/GetAccounts -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": "GetAccounts",
"result": {
"acccountlist": [
"0x6a72ad3e9762d67D45a311954CdC6ad4693203a9",
"0x87dE53fdC1e5AA53eB9Cb839C2EF664Cab0f4C01",
"0x9d394DFB4475Eaef15A27396568e5028f13C3F85",
"0xD4c60A4866BeE49e0642feC293ee8560C237b758",
"0xf535227CCA5487776e666374c839de8b7005892B"
],
"code": 0,
"message": "success"
}
}

GetBalance

  • Get TTOS address balance

For example: http://IP:port/GetBalance

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

Sample Request:

{
"id":"1",
"jsonrpc":"2.0",
"params":{"addr":"0x0796B6DB27e5eb1e9F8Bd2c4d03191C902D22F0f"}
}

Sample Response:

{
"id": "1",
"jsonrpc": "2.0",
"method": "GetBalance",
"result": {
"balance": "1905999939500",
"code": 0,
"message": "success"
}
}
caution

Actual amount = balance/100000000

GetStakeUtxo

  • Get stake utxo

Parameter:
  fromAddr – query node address
Returned value:
  code – Return code,0 is success
  message – Return message
  utxos – UTXO at the time of stake: Amount at the time of stake


For example: http://IP:port/GetStakeUtxo

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

Sample Request:

{
"id":"1",
"jsonrpc":"2.0",
"params":{"fromAddr":"5c8bf650F93d82A7131C2FeA01Ec2bFB3C61A03B"}
}

Sample Response:

{
"id": "1",
"jsonrpc": "2.0",
"method": "GetAllStakeNodeList",
"result": {
"code": 973051808,
"message": "",
"utxos": {
"827022b125d2b60e9ed40a1e7bfa6874b90bb6dbccd515824cb353f0ab3397c6": 100000000000
}
}
}

GetDisinvestUtxo

  • Get UTXO for disinvest

Parameter:
  fromAddr – investor address
  toAddr – Verifier address invested
Returned value:
  code – Return code,0 is success
  message – Return message
  utxos – UTXO records of historical pledges


For example: http://IP:port/GetDisinvestUtxo

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

Sample Request:

{
"id":"1",
"jsonrpc":"2.0",
"params":{
"fromAddr":"5c8bf650F93d82A7131C2FeA01Ec2bFB3C61A03B",
"toAddr":"5c8bf650F93d82A7131C2FeA01Ec2bFB3C61A03B"
}
}

Sample Response:

{
"id": "1",
"jsonrpc": "2.0",
"method": "GetAllStakeNodeList",
"result": {
"code": 0,
"message": "success",
"utxos": {
"utxo": [
"17c62bacc4db9eee7a9b4596894dbf6a17754319fc8b24204fd4e7519a3f4457"
]
}
}
}

GetDelegateInfo

  • Get investment information based on node address
tips:

The maximum amount that a node address can be invested in is 65000*100000000


Parameter:
  addr – node address
Returned value:
  code – Return code,0 is success
  message – Return message
  info – Investment address: Investment amount


For example: http://IP:port/GetDelegateInfo

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

Sample Request:

  {
"id":"1",
"jsonrpc":"2.0",
"params":{"addr":"0xadc2A709EC1413eCcEB4d115E50BD9ebBA35E3Ce"}
}

Sample Response:

  {
"id": "1",
"jsonrpc": "2.0",
"method": "GetDelegateInfo",
"result": {
"code": 0,
"info": {
"0x3389E3e87EFC0464df70C8be58656274A66252af": "500000000000",
"0x50fa281932a411e323dA8EA59269101DdF81C96C": "600000000000",
"0x638c172F63db3caf32c410D0188143E0Eff74bC8": "800000000000",
"0xadc2A709EC1413eCcEB4d115E50BD9ebBA35E3Ce": "1000000000000"
},
"message": "success"
}
}