Skip to content

RPC API (discard)

zengchen221 edited this page Mar 15, 2019 · 2 revisions

this is a temporary version, we will discard later,please read finally version

AccountsFrontiers

Returns a list of pairs of token hash and block hash representing the head block for each address of the accounts list

  • Parameters:
    • []string : addresses
  • Returns:
    • map
      • key: address
      • value: map
        • key : token hash
        • value: the frontier block hash
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":3,
  "method":"qlcclassic_accountsFrontiers",
  "params":  [["qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw"
,"qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic"]]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "qlc_1x8zh6nd55gfaptrqkyecr3ms6mcmidzyb3d16zf9wtiipsjkqiie6saqs1q": {
      "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914": "d96876af286cf6e45a065a690b5c63f3011dfb13909ad7ac25d400246ac50afb"
    },
    "qlc_3cuo5tmfnarrbq63wa7x4733zgxqqf86camh8otciqzrre4ep88yo674ytax": {
      "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914": "0f1200c6d9c0f3c3a289ac7ee4c6499171ff318071990c32d58c3d345015ea46"
    }
  }
}

AccountsBalances

Returns how much balance and how many have not yet been received by each address of the accounts list

  • Parameters:

    • []string : addresses
  • Returns:

    • map
      • key: address
      • value: map
        • key : token hash
        • value: include two values, the first is token balance, the second is pending amount
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":1,
  "method":"qlcclassic_accountsBalances",
  "params":  [["qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw"
,"qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic"]]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw": {
      "5cf2e09fd74e53163a2a562bbb581b6cc8a8699f2729e19876305f1a9851b506": [
        "1539022610",
        "0"
      ],
      "b4a285e3666efa3abfc853154f39bb6d5bc82d214edceae6f3e554a8848b5e33": [
        "1693916588",
        "0"
      ]
    },
    "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic": {
      "9ca2c53e18c265db2ad623a30191d1017aab2a82d31a2c13ab544e1cff6faaab": [
        "1440134343",
        "0"
      ],
      "a1f10a367d7209fb10b0b4f5a75bb40e4020050c9377817ce60c4565e31c05c5": [
        "1947501414",
        "0"
      ]
    }
  }
}

AccountHistoryTopn

Returns blocks of the account, blocks amount of each token of the account up to n

  • Parameters:

    • string : address
    • int: get the maximum number of blocks
  • Returns:

    • array blockinfos
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":1,
  "method":"qlcclassic_accountHistoryTopn",
  "params":  ["qlc_3gkfq68xh8z53n3afgw4okoyf6rje6niw78pgrd6wts1pm8a9pg1rxnpj5hj",10]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "token": "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914",
      "balance": "6000000",
      "link": "0000000000000000000000000000000000000000000000000000000000000000",
      "representative": "qlc_1t7yczfb1dzbsxs4pxis8nhsqwm5w97sstcourfqntiujkt8gnffsc4sry89",
      "type": "State",
      "address": "qlc_1t7yczfb1dzbsxs4pxis8nhsqwm5w97sstcourfqntiujkt8gnffsc4sry89",
      "previous": "4e805af709013d3a35bcb32f22ef9249dcc760ed86c6d7757f16ce96865be317",
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "work": "0000000000ab567f",
      "signature": "37ba87de05d03895fcac296e2739e2f9fb8c612e97f97934271a6c9ef03b306caeb09eea8be4d0a14de6c38f3799efb63e18031a449b6073609db547604b1704",
      "subType": "change",
      "tokenName": "QLC",
      "amount": "0",
      "hash": "203042e945be24f6c177846ad101a3f9e829e7f1d314bad323578508af23dd28"
    },
    {
      "token": "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914",
      "balance": "3000000",
      "link": "f78f4046f2e8a2c50ea99593509ceadeb2cfe7b8f82921f01fe640cae6d2f2a2",
      "representative": "qlc_1t7yczfb1dzbsxs4pxis8nhsqwm5w97sstcourfqntiujkt8gnffsc4sry89",
      "type": "State",
      "address": "qlc_1t7yczfb1dzbsxs4pxis8nhsqwm5w97sstcourfqntiujkt8gnffsc4sry89",
      "previous": "203042e945be24f6c177846ad101a3f9e829e7f1d314bad323578508af23dd28",
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "work": "000000000113d819",
      "signature": "73613d33e2a911c48841c55956e8fca8da5081cf84411e6935e212a577b7581ee7ed2dafcc72d8a7e1e4992bab2a533c823b92f249a2dfe0b68cf4d1341dd701",
      "subType": "send",
      "tokenName": "QLC",
      "amount": "3000000",
      "hash": "36d5c9447ce1541581a6d35287da17c5736a482d0cff19d500994eb33d99b0d7"
    }
  ]
}

AccountsPending

Returns a list of block hashes which have not yet been received by these accounts

  • Parameters:

    • []string : addresses
    • int : get the maximum number of pending for each address
  • Returns:

    • map
      • key:address
      • value: pendinginfos , the pendinginfo it's a map
        • pendingInfo: base info of pending
        • tokenName : the token's name of the token in the pending
        • hash: the send block's hash, the pending created via the block
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":3,
  "method":"qlcclassic_accountsPending",
  "params":  [["qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw"
,"qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic"],10]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw": [
      {
        "pendingInfo": {
          "source": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
          "amount": "1998888",
          "type": "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914"
        },
        "tokenName": "QLC",
        "hash": "00a88aa88f511bdf7cb73d231692e63e3dd93ee8d1ab530f2293c017cc8a84cf"
      }
    ],
    "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic": [
      {
        "pendingInfo": {
          "source": "qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw",
          "amount": "8888",
          "type": "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914"
        },
        "tokenName": "QLC",
        "hash": "91c7cb2f5f471c1b4eae9790d463c952c33a543f7a7df5a5e3f04a7ce7981642"
      }
    ]
  }
}

AccountInfo

Returns accountmeta info of account

  • Parameters:

    • string : address
  • Returns:

    • map accountmeta info
      • account: address of the account
      • tokens: tokeninfos of the account
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":2,
  "method":"qlcclassic_accountInfo",
  "params":  ["qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw"]
}

Response:

{
  "jsonrpc": "2.0",
  "id":2,
  "result": {
    "account": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
    "tokens": [
      {
        "type": "a1f10a367d7209fb10b0b4f5a75bb40e4020050c9377817ce60c4565e31c05c5",
        "header": "f32d91751e16b84809f8cc29a880be243c536386456cf18d94508666e1847e57",
        "rep": "qlc_3b6i3tth3oh7q7odgkgc776fpt9mtyanke9j1ojxrzucerknphoccwaj1txy",
        "open": "89d52f7fac51192da338fe54c50edd0c116665f8abdf22afb6b9154d0d833e34",
        "balance": "1947501414",
        "account": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
        "modified": 1546954201,
        "block_count": 1
      },
      {
        "type": "aa8ea33ff56f274b4b3272793460ca417dfb40910cc2b223dc07b4471c2e61f9",
        "header": "ba2e2b4810b265fcb609449692abbd4280a7a2e0bceee1d1365639a46d1d7ecf",
        "rep": "qlc_1qjsentjtmxyxbo4mpsujrr1mc9gxcsur7dcyfr7pmsw5oqbraak5acc99c7",
        "open": "1406ebe31e2b1a4345931a328d3f484833ca4e8cf289c4293bcc635eb84db40a",
        "balance": "2126176118",
        "account": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
        "modified": 1546954201,
        "block_count": 1
      }
    ]
  }
}

ValidateAccount

Return whether the address is valid or not

  • Parameters:

    • string : address
  • Returns:

    • bool valid return true, or return false
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":1,
  "method":"qlcclassic_validateAccount",
  "params":  ["qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw"]
}

Response:

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

BlocksInfo

Return blockinfos by blocks hash

  • Parameters:

    • []string : blocks hash
  • Returns:

    • array blocks info
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":1,
  "method":"qlcclassic_blocksInfo",
  "params":  [["8c40a31f0bbe9a843155224e20c010d858f4c1745b442bf67b94ff623f02498e","dbe0c5d6331a4f8f08e95169b24e3cbf0d043c3988496d26c5e8653a2020e571"]]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "token": "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914",
      "balance": "4000000",
      "link": "7d3a38d3f52ab1a3e2e3219bece6acf9f1d71220a4a66e4610f83b5d7e2d5d29",
      "representative": "qlc_1wzkyq3pc4oy6sqbgpekf6jws5ygk3iaanmuic4s1448zeoz885hypprimkk",
      "type": "State",
      "address": "qlc_1wzkyq3pc4oy6sqbgpekf6jws5ygk3iaanmuic4s1448zeoz885hypprimkk",
      "previous": "7f22b5987e351ce80b62733c3d5faec362662db48911fcfc743e582c3e5ee40c",
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "work": "000000000231bcb5",
      "signature": "74445c50533d2cbb93f218fa3c04b2a7d8b9f85dcfa97e6f47ef7bd1d8850a143912a3a7be36ecba0fd1f3ca23d1a3dcf15397588720d096c24155ea403a110a",
      "subType": "send",
      "tokenName": "QLC",
      "amount": "6000000",
      "hash": "3c1253c7c31f94d2de5dfa8639c540e810c1b0d2b6b5e5fcbf04f667ad8dd432"
    },
    {
      "token": "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914",
      "balance": "6000000",
      "link": "0000000000000000000000000000000000000000000000000000000000000000",
      "representative": "qlc_1zbt95bzccojnhjg8aeuxmmcsyhjtwb43b78fs533y3udoz4tqbbfutm4r7q",
      "type": "State",
      "address": "qlc_1zbt95bzccojnhjg8aeuxmmcsyhjtwb43b78fs533y3udoz4tqbbfutm4r7q",
      "previous": "96ca1256926b407a48eb9d45cfb96ed42e264eec78527db77c7bf4fc3815faaf",
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "work": "0000000000447701",
      "signature": "fea7167fbd9e010321463bab89adfb2ddb6adf1a160c2b97d76b3aef2d6ba44db62ac02f6b8bb2891a5c5120508413f20e1c7dec567ea169f3e31934aae4b605",
      "subType": "change",
      "tokenName": "QLC",
      "amount": "0",
      "hash": "35db29e4022cca1416f7b2327e9965d3e399b9f8a9b7bf7b712a0217bc34afc6"
    }
  ]
}

Process

check block and ledger process by the block

  • Parameters:

    • object : the block base info
  • Returns:

    • string : hash of the block
  • Example:

Request:

{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "qlcclassic_process",
    "params": [
        {
            "token": "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914",
            "balance": "5966",
            "link": "bf17296341abf560791162b966dec3c111beb0a7caf84d9b0b8acf1845a326a8",
            "representative": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
            "type": "State",
            "address": "qlc_3ajyep41dot83n8ctkis6w6797gn79tsh8iq3bqnrbpj44mqhj95n75cio4h",
            "previous": "39836c1fcf9b44118b1d903578cbac385de526ab365cd1b784e76c7d19d9747d",
            "extra": "0000000000000000000000000000000000000000000000000000000000000000",
            "work": "0000000000108fc0",
            "signature": "4a2b581f5137603b46034f39d1cae1b570fc664b837f1ba1b9f5a6b9fb6085006c72933132a0b5bfc01545230ac7bf3ab6998914f6e976bc275f97bc29f1d40d"
        }
    ]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": "7f22b5987e351ce80b62733c3d5faec362662db48911fcfc743e582c3e5ee40c"
}

Tokens

Return all the smart contrant tokens

  • Parameters: null

  • Returns:

    • array : the tokens info
  • Example:

Request:

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

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "tokenId": "9bf0dd78eb52f56cf698990d7d3e4f0827de858f6bdabc7713c869482abfd914",
      "tokenName": "QLC",
      "tokenSymbol": "qlc",
      "totalSupply": "60000000000000000",
      "decimals": 8,
      "owner": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic"
    },
    {
      "tokenId": "02acb4a0e87c1fdd09b794a317ccaa6eddcb143c5fa0139f6fe145e9d94fcb17",
      "tokenName": "QN1",
      "tokenSymbol": "qn1",
      "totalSupply": "70000000000000000",
      "decimals": 8,
      "owner": "qlc_1uudbhpenjr1ii3k4ah9kax8f5f1qh3tt9qirjkj9mghew61qkfibw4haxtc"
    },
    {
      "tokenId": "3b32f29885c04d9931319a8a564692880f68d1310a4ed527dd65bfd87896e8e4",
      "tokenName": "QN2",
      "tokenSymbol": "qn2",
      "totalSupply": "50000000000000000",
      "decimals": 8,
      "owner": "qlc_3s1agkbw6osftnodbcu9otawgdhz6q74xzpgsu641qzjgs8qdqfujim3z7ii"
    }
  ]
}

GetOnlineRepresentatives

Returns the online representative

  • Parameters: null

  • Returns:

    • array : addresses
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":2,
  "method":"qlcclassic_getOnlineRepresentatives"
}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": ["qlc_3s1agkbw6osftnodbcu9otawgdhz6q74xzpgsu641qzjgs8qdqfujim3z7ii","qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic"]
}

Clone this wiki locally