Skip to content

RPC API

zengchen221 edited this page Mar 15, 2019 · 10 revisions

Introduce

Update Instruction

2019-3-15 update :

  • modify block struct

  • add offset for Accounts, Blocks, AccountHistoryTopn interface

  • add SMS and Mintage modules

  • modify BlocksCountByType, Delegators return

  • modify AccountsBalances interface name to AccountsBalance

Block Struct

field type describe
type string block type
token string token hash for the transaction
address string address of generating block
balance string balance for the account
previous string previous block hash
link string if a send transaction, link is receiver address hash, if a receive transaction, link is sender block hash
sender string sms sender, encoded by base64 omitempty
receiver string sms receiver, encoded by base64 omitempty
message string sms message hash
data string vm instructions created by contract omitempty
quota int quota acquired from mortgaged assets
timestamp int64 timestamp ,now is unix time
extra string extra data for contract
representative string representative address
work string work for pow
signature string signature
tokenName string token name
amount string amount for the transaction
hash string block hash

Account struct

  • account address

  • coinBalance balance of main token (default is QLC)

  • representative representative address

  • token info :

field type describe
type string token hash
header string the latest block hash for the token chain
representative string representative address
open string the open block hash for the token chain
balance string balance for the token
account string accout that token belong to
modified int64 timestamp
blockCount int total block number for the token ch
tokenName string token name
pending string pending amount

Account

AccountCreate

Creates a new account by seed and index

  • Parameters:

    • string : seed
    • int : optional , index for account, if not set, default value is 0
  • Returns:

    • Account private key and public key for the new account
  • Example:

Request:

{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "account_create",
    "params": ["1234567890123456789012345678901234567890123456789012345678901234"]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "privKey": "f59e77456e068c5e4384776c9a6bbfd774abb7bdd99aa072a3304e40599fd658c39010e6c0a9d53a3e83f3a36970b660257f000ee940648d6cdfbc1d7a932b71",
    "pubKey": "c39010e6c0a9d53a3e83f3a36970b660257f000ee940648d6cdfbc1d7a932b71"
  }
}

AccountForPublicKey

Get account number for the public key

  • Parameters:

    • string : public key
  • Returns:

    • string : address
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":3,
  "method":"account_forPublicKey",
  "params":["d813a347c0d6d3265a269e656a1889cb2452d8c9f4b620756128ff10c8c9fdEF"]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": "qlc_3p1mnf5w3opm6sf4f9m7faeamks6cdeemx7p63tp4c9z456emzhhb1n9srco"
}

AccountPublicKey

Get the public key for the account

  • Parameters:
    • string : address
  • Returns:
    • string : public key
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":3,
  "method":"account_publicKey",
  "params":["qlc_1x8zh6nd55gfaptrqkyecr3ms6mcmidzyb3d16zf9wtiipsjkqiie6saqs1q"]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": "74df7928b18dcd45b58bcbcc56033c926a9c17ff242b013ed3f35085b3195e10"
}

AccountValidate

Returns whether the address is valid or not

  • Parameters:

    • string : address
  • Returns:

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

Request:

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

Response:

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

Ledger

AccountBlocksCount

Returns number of blocks for a specific account

  • Parameters:
    • string : account
  • Returns:
    • int : number for the account
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":3,
  "method":"ledger_accountBlocksCount",
  "params":  ["qlc_1x8zh6nd55gfaptrqkyecr3ms6mcmidzyb3d16zf9wtiipsjkqiie6saqs1q"]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result":10
}

AccountHistoryTopn

Returns blocks of the account

  • Parameters:
    • string : account
    • int: number of blocks to return
    • int: optional , offset, index of block where to start, default is 0
  • Returns:
    • []Block blockinfos
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "ledger_accountHistoryTopn",
	"params": [
		"qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
		4,
        10
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "type": "Receive",
      "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
      "address": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
      "balance": "3300000000000",
      "previous": "0231d0aa82df9a2e9cf074e9481f1d38982b56b8c1b4f04904657ede5f22e702",
      "link": "0e8c6e1c7d30e13d1167660bd76fdb3bb38a951cc6684cf66f720355d89becc9",
      "message": "0000000000000000000000000000000000000000000000000000000000000000",
      "quota": 0,
      "timestamp": 1552454728,
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "representative": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
      "work": "000000000014d619",
      "signature": "81bf5ad2cf694ed8cc51514c0834c4d2dce0c384b5a2fea24d3919fb5cd587cb8e5c5499f38e14ffd9b367fc95050a2761df8f0df1c1e1bd067f05e881235708",
      "tokenName": "QLC",
      "amount": "2200000000000",
      "hash": "27751229f46e99b88a7503708eceab833b9ad03685591d494b412c4b37d85318"
    },
    {
      "type": "Open",
      "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
      "address": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
      "balance": "1100000000000",
      "previous": "0000000000000000000000000000000000000000000000000000000000000000",
      "link": "d1a60317af550d4836d78e235fd6c729f0516260a9c09e44db30411743c15e6e",
      "message": "0000000000000000000000000000000000000000000000000000000000000000",
      "quota": 0,
      "timestamp": 1552453874,
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "representative": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
      "work": "000000000000e408",
      "signature": "719619313b8b0d08fc35a446bc7e41e258fc3c5fe99df3ae7868fc59a70b362aaec10c69b96f44d8082f8f59d12727bed93ed88762f352cb0c0c21ad70350d0e",
      "tokenName": "QLC",
      "amount": "1100000000000",
      "hash": "0231d0aa82df9a2e9cf074e9481f1d38982b56b8c1b4f04904657ede5f22e702"
    }
  ]
}

AccountInfo

Returns account detail info , include each token for the account

  • Parameters:
    • string : account
  • Returns:
    • info of the account (if account not found, return error), fields mean :
    • account : address of the account
    • coinBalance : balance of main token of the account (default is QLC)
    • representative : representative address of the account
    • tokens: each token info for the account
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "ledger_accountInfo",
	"params": [
		"qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44"
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "account": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
    "coinBalance": "40000000000000",
    "representative": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
    "tokens": [
      {
        "type": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
        "header": "758f79b656340c329cb5b11302865c5ff0b0c99fd8a268d6b8760170e33e8cd1",
        "representative": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
        "open": "758f79b656340c329cb5b11302865c5ff0b0c99fd8a268d6b8760170e33e8cd1",
        "balance": "40000000000000",
        "account": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
        "modified": 1552455585,
        "blockCount": 1,
        "tokenName": "QLC",
        "pending": "0"
      }
    ]
  }
}

AccountRepresentative

Returns the representative for account

  • Parameters:
    • string : account
  • Returns:
    • string : representative address for the account (if account not found, return error)
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "ledger_accountRepresentative",
	"params": [
		"qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44"
	]
}

Response:

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

AccountVotingWeight

Returns the voting weight for account

  • Parameters:
    • string : account
  • Returns:
    • string the voting weight for the account (if account not found, return error)
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "ledger_accountVotingWeight",
	"params": [
		"qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44"
	]
}

Response:

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

AccountsBalance

Returns balance and pending (amount that has not yet been received) for each account

  • Parameters:
    • []string : account list
  • Returns:
    • balance and pending amount of each token for each account
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 18,
	"method": "ledger_accountsBalances",
	"params": [
		[
			"qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
			"qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic"
		]
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 18,
  "result": {
    "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44": {
      "QLC": {
        "balance": "10000000000",
        "pending": "100"
      },
      "QN": {
        "balance": "1010000000",
        "pending": "0"
      }
    },
    "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic": {
      "QLC": {
        "balance": "100000000000",
        "pending": "0"
      }
    }
  }
}

AccountsFrontiers

Returns a pair of token name and block hash (representing the head block ) of each token for each account

  • Parameters:
    • []string : account list
  • Returns:
    • token name and block hash representing the head block for each token in each account
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 18,
	"method": "ledger_accountsFrontiers",
	"params": [
		[
			"qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
			"qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw"
		]
	]
}

Response:

{
	"jsonrpc": "2.0",
	"id": 18,
	"result": {
		"qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic": {
			"QLC": "0c0cdbf707919e5f95ef53f19c4e39bbe2936c82272a794b34278ad01b84aaad"
		},
		"qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw": {
			"QLC": "3964f95cf727603934c81e65cf804a7f6851b39ade4e32fa8210d1b253dfc0c5",
			"QN": "88b4a2bf43701bc6336865ac3a0b97519c413ce9b78a6854374f1c292e539c6e"
		}
	}
}

AccountsPending

Returns pending info list for accounts

  • Parameters:
    • []string : account list
    • int : get the maximum number of pending for each account
  • Returns:
    • pending info for each token in each account, means:
      • tokenName : token name
      • type : token type
      • source : sender account of transaction
      • amount : amount of transaction
      • hash : hash of send block
  • Example:

Request:

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

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw": [
      {
        "source": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
        "amount": "80000000000000",
        "type": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
        "tokenName": "QLC",
        "hash": "ae114fe97a4bc525d3771e3651cf0a0c0a55ab449dee213c470cecaeec77e7c6"
      },
      {
        "source": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
        "amount": "2100000000000000000",
        "type": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
        "tokenName": "QLC",
        "hash": "af5da09dfc9c23d5c208bb54c2e276dc4b0bee4d3df958d9234728e78a4b1b46"
      }
    ]
  }
}

AccountsCount

Returns total number of accounts of chain

  • Parameters: null
  • Returns:
    • int : total number of accounts
  • Example:

Request:

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

Response:

{
    "jsonrpc": "2.0",
    "id": 2,
    "result": 10
}

Accounts

Returns account list of chain

  • Parameters:
    • int number of accounts to return
    • int optional , offset, index of account where to start, default is 0
  • Returns:
    • list account list
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 18,
	"method": "ledger_accounts",
	"params": [
		5,
		10
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 18,
  "result": [
    "qlc_1cnripmqjj3f8ag3fdgaxku1wdw5ik6d9rsyze8umst7kjghdd1cqrxxm5zh",
    "qlc_1q1jog6eywemc6am4etjx68yegbjy6d1o594j11xs7jsc7rwdh3kej8yzbrg",
    "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
    "qlc_3c6ezoskbkgajq8f89ntcu75fdpcsokscgp9q5cdadndg1ju85fief7rrt11",
    "qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw"
  ]
}

BlockAccount

Returns the account for block

  • Parameters:
    • string block hash
  • Returns:
    • string account
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "ledger_blockAccount",
	"params": [
		"758f79b656340c329cb5b11302865c5ff0b0c99fd8a268d6b8760170e33e8cd1"
	]
}

Response:

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

BlockHash

Return hash of the block

  • Parameters:
    • block : block
  • Returns:
    • string : hash of the block
  • Example:

Request:

{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "ledger_blockHash",
    "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"
}

Blocks

Returns block list of chain

  • Parameters:
    • int number of blocks to return
    • int optional , offset, index of block where to start, default is 0
  • Returns:
    • list block list
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 3,
	"method": "ledger_blocks",
	"params": [
		5,
		10
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": [
    {
      "type": "Send",
      "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
      "address": "qlc_1q1jog6eywemc6am4etjx68yegbjy6d1o594j11xs7jsc7rwdh3kej8yzbrg",
      "balance": "40000000000",
      "previous": "af5da09dfc9c23d5c208bb54c2e276dc4b0bee4d3df958d9234728e78a4b1b46",
      "link": "2a9885a778c42d321c16adc8ecb60e2f838488b3e33efb0db9e745945cf5ac0a",
      "message": "0000000000000000000000000000000000000000000000000000000000000000",
      "quota": 0,
      "timestamp": 1553990410,
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "representative": "qlc_1q1jog6eywemc6am4etjx68yegbjy6d1o594j11xs7jsc7rwdh3kej8yzbrg",
      "work": "00000000007b4d66",
      "signature": "68d9edd802ab5078fb90993d6ce1c75395ce0b78854a54bcf7f3a9ffcfa5e73bb0d649c1dde796ec957d3ee07e00b6a945eb8964624459c2557b568fa491c20e",
      "tokenName": "QLC",
      "amount": "600000",
      "hash": "ae114fe97a4bc525d3771e3651cf0a0c0a55ab449dee213c470cecaeec77e7c6"
    },
    {
      "type": "Open",
      "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
      "address": "qlc_1q1jog6eywemc6am4etjx68yegbjy6d1o594j11xs7jsc7rwdh3kej8yzbrg",
      "balance": "100000000000",
      "previous": "0000000000000000000000000000000000000000000000000000000000000000",
      "link": "5c11ab88cf71935111313351e90de63931f1160a8ce28801dc96395171c5bc32",
      "message": "0000000000000000000000000000000000000000000000000000000000000000",
      "quota": 0,
      "timestamp": 1553990411,
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "representative": "qlc_1q1jog6eywemc6am4etjx68yegbjy6d1o594j11xs7jsc7rwdh3kej8yzbrg",
      "work": "0000000000271561",
      "signature": "ea76053ee94a73961ece8d9c7cd7a5e8d89ce8ff9b67fbca652c950cab4f96f79e544882644d5bf9f841808f4651ea8598c970996808676b7a028f910eb11e03",
      "tokenName": "QLC",
      "amount": "1000000",
      "hash": "af5da09dfc9c23d5c208bb54c2e276dc4b0bee4d3df958d9234728e78a4b1b46"
    }
  ]
}

BlocksCount

Returns the number of blocks (include smartcontrant block) and unchecked synchronizing blocks of chain

  • Parameters: null
  • Returns:
    • number of blocks , means:
      • count number of blocks , include smartcontrant block
      • unchecked number of unchecked blocks
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":3,
  "method":"ledger_blocksCount",
}

Response:

{
    "jsonrpc": "2.0",
    "id": 3,
    "result": {
        "count": 10000,
        "unchecked": 100
    }
}

BlocksCountByType

Reports number of blocks by type of chain

  • Parameters: null

  • Returns:

    • number of blocks of each type
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":3,
  "method":"ledger_blocksCountByType"

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "Change": 2,
    "ContractRefund": 0,
    "ContractReward": 1,
    "ContractSend": 1,
    "Open": 5,
    "Receive": 1,
    "Send": 3
  }
}

BlocksInfo

Return block info for block hash

  • Parameters:

    • []string : block hash list
  • Returns:

    • []block block info list
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "ledger_blocksInfo",
	"params": [
		[
			"caa7ba45c42fde4e10eea2d6efbf9e506659e86f70e280834f106be55a0e6181",
		]
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 18,
  "result": [
    {
      "type": "Send",
      "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
      "address": "qlc_1cnripmqjj3f8ag3fdgaxku1wdw5ik6d9rsyze8umst7kjghdd1cqrxxm5zh",
      "balance": "30000000000",
      "previous": "4c386c4d2ff264b226a39d2ce5fc27173686cf277c3bfc9e67a6d95b4550ca43",
      "link": "5c11ab88cf71935111313351e90de63931f1160a8ce28801dc96395171c5bc32",
      "message": "0000000000000000000000000000000000000000000000000000000000000000",
      "quota": 0,
      "timestamp": 0,
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "representative": "qlc_1cnripmqjj3f8ag3fdgaxku1wdw5ik6d9rsyze8umst7kjghdd1cqrxxm5zh",
      "work": "0000000000045245",
      "signature": "be5c8add93eac169b2d170ec19964dd598d4bf06bea064169abee13e4c5c36d75f97e22d6c8dd29489880453a641d34c0486ebcee31188a113d24e7f8cd5f304",
      "tokenName": "QLC",
      "amount": "30000000000",
      "hash": "caa7ba45c42fde4e10eea2d6efbf9e506659e86f70e280834f106be55a0e6181"
    }
  ]
}

Chain

Returns a consecutive block hash list for a specific account , starting at block up to count

  • Parameters:
    • string : block hash to start at
    • int: get the maximum number of blocks, if set n to -1, will list blocks to open block
  • Returns:
    • []string block hash
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":1,
  "method":"ledger_chain",
  "params":  ["203042e945be24f6c177846ad101a3f9e829e7f1d314bad323578508af23dd28",2]
}

Response:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        "203042e945be24f6c177846ad101a3f9e829e7f1d314bad323578508af23dd28",
        "35db29e4022cca1416f7b2327e9965d3e399b9f8a9b7bf7b712a0217bc34afc6"
    ]
}

Delegators

Returns a list of pairs of delegator and it's balance for specific representative account

  • Parameters:
    • string : account
  • Returns:
    • each delegator and it's balance
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "ledger_delegators",
	"params": [
		"qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44"
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
      "balance": "59998900000000000"
    },
    {
      "address": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
      "balance": "100000000000"
    }
  ]
}

DelegatorsCount

Get number of delegators for specific representative account

  • Parameters:
    • string : account
  • Returns:
    • int : number of delegators for the account
  • Example:

Request:

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

Response:

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

GenerateSendBlock

Returns send block by send parameter and private key

  • Parameters:
    • sendinfo : send info for the block, from,to,tokenName andamount are must required
    • string: private key
  • Returns:
    • stateblock send block
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 2,
	"method": "ledger_generateSendBlock",
	"params": [
		{
			"from": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
			"tokenName": "QLC",
			"to": "qlc_371pkh5kkd1dn43cwxnbb1a4yg363rh9un9a13kkezbcppuicejxgixyyrrw",
			"amount": "1000000",
			"sender": "158111100000",
			"receiver": "18500001111",
			"message": "086802b5b3def1802882740cb91bac8929edd80901e5db4c95786389bfcf7ae4"
		},
		"8911d87b2cfed6872be509a0e5b95ff068c4dd5e439538444424aa139f9612b0681bf5253c64672fc54c93d3b5b9a20d28965cb8f80ba70460ed3f99cb547231"
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "type": "Send",
    "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
    "address": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
    "balance": "59998899999000000",
    "previous": "bd348dc1c2567060ce596bc5c7fd41ed1ded27752f0e088c8c0b54d1abd6d7c4",
    "link": "941693c7292c0ba082ae768948102f38240e1e7dd0e80065267d2ab5b705323d",
    "sender": "IjE1ODExMTEwMDAwMCI=",
    "receiver": "IjE4NTAwMDAxMTExIg==",
    "message": "086802b5b3def1802882740cb91bac8929edd80901e5db4c95786389bfcf7ae4",
    "quota": 0,
    "timestamp": 1552469200,
    "extra": "0000000000000000000000000000000000000000000000000000000000000000",
    "representative": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
    "work": "000000000055a435",
    "signature": "02ba735276f3e7d4b43aa16255df141765739e4df10b585cf43d69653df6b30c994a727867b74d19978872c66850d1fce79436940d9f96044ad35367b06fe809"
  }
}

GenerateReceiveBlock

Returns receive block by send block and private key

  • Parameters:
    • stateblock : send block
    • string: private key
  • Returns:
    • stateblock receive block
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 2,
	"method": "ledger_generateReceiveBlock",
	"params": [
		{
			"type": "Send",
			"token": "cfb64601dee031fc045a2880ea0b8b4823c4f0ce9241d245a012d40910137536",
			"address": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
			"balance": "59999999999999990",
			"previous": "0a5f919673c3a95b66c520b74a7b2416abf6fe6cc8606d04303819f81e6db1a1",
			"link": "941693c7292c0ba082ae768948102f38240e1e7dd0e80065267d2ab5b705323d",
			"sender": "",
			"receiver": "",
			"message": "0000000000000000000000000000000000000000000000000000000000000000",
			"data": null,
			"quota": 0,
			"timestamp": 0,
			"extra": "0000000000000000000000000000000000000000000000000000000000000000",
			"representative": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
			"work": "0000000001063d8a",
			"signature": "edfb07a3575853fe833efc9f5288de89df69d243239b8d92723452cd456fcd2170e239eedc16c9650b626f26b305dcaf6a03ad8c4cb99302e6284df019c6790d"
		},
		"5f760341a57b35a09b6ea61b16d3309651ed349cbda964c976f3d54acb801d20941693c7292c0ba082ae768948102f38240e1e7dd0e80065267d2ab5b705323d"
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "type": "Open",
    "token": "cfb64601dee031fc045a2880ea0b8b4823c4f0ce9241d245a012d40910137536",
    "address": "qlc_371pkh5kkd1dn43cwxnbb1a4yg363rh9un9a13kkezbcppuicejxgixyyrrw",
    "balance": "10",
    "previous": "0000000000000000000000000000000000000000000000000000000000000000",
    "link": "4438eb09b1469b72a436fe42df3af0f6acb28b085042917210301500c0cea576",
    "sender": "",
    "receiver": "",
    "message": "0000000000000000000000000000000000000000000000000000000000000000",
    "data": null,
    "quota": 0,
    "timestamp": 0,
    "extra": "0000000000000000000000000000000000000000000000000000000000000000",
    "representative": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
    "work": "000000000007faf2",
    "signature": "c80bdeeebf4263337316965afc9cf6835a04c59e6af1dd7abbe51df7683cfb8704e9f7d802e330fcd31eedb6ff390c4af520215732d7ea1cb3c3ca2f63537a07"
  }
}

GenerateChangeBlock

Returns change block by send block and private key

  • Parameters:
    • string : account
    • string : new representative account
    • string: private key
  • Returns:
    • stateblock change block
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 2,
	"method": "ledger_generateChangeBlock",
	"params": [
		"qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
		"qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
		"df5d9818629e5d77bac5c99c79c2b437e3661e8ef3b443a81a4de8fd8442158993d31686ecd3922de39a634271360990f0ad100053483b9bcdaa19e504998104"
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "type": "Change",
    "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
    "address": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
    "balance": "59998900000000000",
    "previous": "bd348dc1c2567060ce596bc5c7fd41ed1ded27752f0e088c8c0b54d1abd6d7c4",
    "link": "0000000000000000000000000000000000000000000000000000000000000000",
    "message": "0000000000000000000000000000000000000000000000000000000000000000",
    "quota": 0,
    "timestamp": 1552469321,
    "extra": "0000000000000000000000000000000000000000000000000000000000000000",
    "representative": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
    "work": "000000000055a435",
    "signature": "2f3555e4a6d4e91e736cdc8074f3e070017a95ee42a049034cf596e6384522b4c0e4b608b35a8c4f408c1f4ffc9221c05c1b3f59ae828b5cd3ca87b0f1539a04"
  }
}

Process

check block base info , update datebase for the block ,and broadcast block

  • Parameters:

    • block block base info
  • Returns:

    • string : hash of the block
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 18,
	"method": "ledger_process",
	"params": [
		{
			"type": "Change",
			"token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
			"address": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
			"balance": "59998900000000000",
			"previous": "bd348dc1c2567060ce596bc5c7fd41ed1ded27752f0e088c8c0b54d1abd6d7c4",
			"link": "0000000000000000000000000000000000000000000000000000000000000000",
			"message": "0000000000000000000000000000000000000000000000000000000000000000",
			"quota": 0,
			"timestamp": 1552469321,
			"extra": "0000000000000000000000000000000000000000000000000000000000000000",
			"representative": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
			"work": "000000000055a435",
			"signature": "2f3555e4a6d4e91e736cdc8074f3e070017a95ee42a049034cf596e6384522b4c0e4b608b35a8c4f408c1f4ffc9221c05c1b3f59ae828b5cd3ca87b0f1539a04"
		}
	]
}

Response:

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

Representatives

Returns pairs of representative and its voting weight

  • Parameters:
    • bool , optional sorting, if not set or set false, will return representatives randomly, if set true, will sorting represetntative balance in descending order
  • Returns:
    • each representative and its voting weight
  • Example:
  1. if don't set sorting

Request:

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

Response:

{
  "jsonrpc": "2.0",
  "id": 18,
  "result": [
    {
      "address": "qlc_15ouo5bij3yrcszfwhwptczk9ghf744ii3z7qis7rn1dpfs97bacito63gae",
      "balance": "70000"
    },
    {
      "address": "qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw",
      "balance": "100000"
    },
    {
      "address": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
      "balance": "1000"
    }
  ]
}
  1. if set sorting

Request:

{
  "jsonrpc": "2.0",
  "id":2,
  "method":"ledger_representatives",
  "params": [true]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 18,
  "result": [
    {
      "address": "qlc_3nihnp4a5zf5iq9pz54twp1dmksxnouc4i5k4y6f8gbnkc41p1b5ewm3inpw",
      "balance": "10000"
    },
    {
      "address": "qlc_3pu4ggyg36nienoa9s9x95a615m1natqcqe7bcrn3t3ckq1srnnkh8q5xst5",
      "balance": "20001"
    },
    {
      "address": "qlc_3oftfjxu9x9pcjh1je3xfpikd441w1wo313qjc6ie1es5aobwed5x4pjojic",
      "balance": "1020"
    }
  ]
}

Tokens

Return all token info

  • Parameters: null
  • Returns:
    • []TokenInfo : the tokens info
  • Example:

Request:

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

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "tokenId": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
      "tokenName": "QLC",
      "tokenSymbol": "QLC",
      "totalSupply": 60000000000000000,
      "decimals": 8,
      "owner": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
      "pledgeAmount": 0,
      "withdrawTime": 0
    },
    {
      "tokenId": "fa696094adbf9683e4283c3cdabdf9768042d35c1b6e6609ec06e005137e9dbc",
      "tokenName": "QN",
      "tokenSymbol": "QN",
      "totalSupply": 10000000000000,
      "decimals": 8,
      "owner": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
      "pledgeAmount": 1000000000000,
      "withdrawTime": 1552464838
    }
  ]
}

TransactionsCount

Returns the number of blocks ( not include smartcontrant block) and unchecked synchronizing blocks of chain

  • Parameters: null
  • Returns:
    • number of blocks , means:
    • count number of blocks , not include smartcontrant block
    • unchecked number of unchecked blocks
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":3,
  "method":"ledger_transactionsCount",
}

Response:

{
    "jsonrpc": "2.0",
    "id": 3,
    "result": {
        "count": 9000,
        "unchecked": 100
    }
}

TokenInfoById

Returns token info by token id

  • Parameters:
    • string token id
  • Returns:
    • tokeninfo token detail info
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "ledger_tokenInfoById",
	"params": [
		"830420c061ec2cddeb2ab553c0e7b792bc6b7549f849ce4345cf026410c9efa5"
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tokenId": "830420c061ec2cddeb2ab553c0e7b792bc6b7549f849ce4345cf026410c9efa5",
    "tokenName": "QN",
    "tokenSymbol": "QN",
    "totalSupply": 1000000000,
    "decimals": 8,
    "owner": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
    "pledgeAmount": 1000000000000,
    "withdrawTime": 1552522682
  }
}

TokenInfoByName

Returns token info by token name

  • Parameters:
    • string token name
  • Returns:
    • tokeninfo token detail info
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "mintage_tokenInfoByName",
	"params": [
		"QN"
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tokenId": "830420c061ec2cddeb2ab553c0e7b792bc6b7549f849ce4345cf026410c9efa5",
    "tokenName": "QN",
    "tokenSymbol": "QN",
    "totalSupply": 1000000000,
    "decimals": 8,
    "owner": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
    "pledgeAmount": 1000000000000,
    "withdrawTime": 1552522682
  }
}

Mintage

GetMintageData

Gets data by mintage parameters

  • Parameters:
    • mintageParams mintage parameters
  • Returns:
    • string data for mintage
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "mintage_getMintageData",
	"params": [
		{
			"selfAddr": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
			"prevHash": "758f79b656340c329cb5b11302865c5ff0b0c99fd8a268d6b8760170e33e8cd1",
			"tokenName": "QM",
			"tokenSymbol": "QM",
			"totalSupply": "1000000000",
			"decimals": 8,
			"pledgeAmount": 1000000
		}
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "RtDOi36yRn34tcH5dS2ThaV+eOeDzObdqEz883OcFX49k3CRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7msoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlFNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJRTQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
}

GetMintageBlock

Get contract send block by mintage parameters

  • Parameters:
    • mintageParams mintage parameters
  • Returns:
    • block mintage block , type is ContractSend
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "mintage_getMintageBlock",
	"params": [
		{
			"selfAddr": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
			"prevHash": "758f79b656340c329cb5b11302865c5ff0b0c99fd8a268d6b8760170e33e8cd1",
			"tokenName": "QN",
			"tokenSymbol": "QN",
			"totalSupply": "1000000000",
			"decimals": 8,
			"pledgeAmount": 1000000000
		}
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result":     {
      "type": "ContractSend",
      "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
      "address": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
      "balance": "59999000000000000",
      "previous": "758f79b656340c329cb5b11302865c5ff0b0c99fd8a268d6b8760170e33e8cd1",
      "link": "de32f02da71ef2fccd06634bfe29d3a7514a1880873478382704e3edeeaff982",
      "message": "0000000000000000000000000000000000000000000000000000000000000000",
      "data": "RtDOi4MEIMBh7Czd6yq1U8Dnt5K8a3VJ+EnOQ0XPAmQQye+lAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7msoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlFOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJRTgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
      "quota": 0,
      "timestamp": 1552522682,
      "extra": "0000000000000000000000000000000000000000000000000000000000000000",
      "representative": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
      "work": "000000000091a0a2",
      "signature": "7fc37cad58b21f52ba29fc194d45a5ab6bb267fe1a84a45f72e86c1aca40691ad0107290085980d39757a21b7f00dde151f25a670f22eb9f7a611703c8fd3908",
      "tokenName": "QLC",
      "amount": "1000000000000",
      "hash": "257ecd944c1534771570525601b922b9453cebe7f9ccebd7f485e9d1875b5667"
    }
}

GetRewardBlock

Returns contract reward block by contract send block

  • Parameters:
    • block contract send block
  • Returns:
    • block contract reward block
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "mintage_getRewardBlock",
	"params": [
		{
			"type": "ContractSend",
			"token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
			"address": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
			"balance": "59999000000000000",
			"previous": "758f79b656340c329cb5b11302865c5ff0b0c99fd8a268d6b8760170e33e8cd1",
			"link": "de32f02da71ef2fccd06634bfe29d3a7514a1880873478382704e3edeeaff982",
			"message": "0000000000000000000000000000000000000000000000000000000000000000",
			"data": "RtDOi36yRn34tcH5dS2ThaV+eOeDzObdqEz883OcFX49k3CRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7msoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlFNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJRTQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
			"quota": 0,
			"timestamp": 1552522398,
			"extra": "0000000000000000000000000000000000000000000000000000000000000000",
			"representative": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
			"work": "0000000000000000",
			"signature": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
		}
	]
}

Response:

{
	"jsonrpc": "2.0",
	"id": 1,
	"result": {
		"type": "ContractReward",
		"token": "830420c061ec2cddeb2ab553c0e7b792bc6b7549f849ce4345cf026410c9efa5",
		"address": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
		"balance": "100000000000000000",
		"previous": "0000000000000000000000000000000000000000000000000000000000000000",
		"link": "257ecd944c1534771570525601b922b9453cebe7f9ccebd7f485e9d1875b5667",
		"message": "0000000000000000000000000000000000000000000000000000000000000000",
		"data": "gwQgwGHsLN3rKrVTwOe3krxrdUn4Sc5DRc8CZBDJ76UAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADuaygAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACGgb9SU8ZGcvxUyT07W5og0olly4+AunBGDtP5nLVHvVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6NSlEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXImdugAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACUU4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlFOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
		"quota": 0,
		"timestamp": 1552522685,
		"extra": "0000000000000000000000000000000000000000000000000000000000000000",
		"representative": "qlc_1t1uynkmrs597z4ns6ymppwt65baksgdjy1dnw483ubzm97oayyo38ertg44",
		"work": "000000000054b46a",
		"signature": "9e7ac06d995ea8ed42c7feb3c6c990e0994e95296bd8b2dde0379656794f6f55324825a98332976ee4e2c1d957f7561b1ed7de4c003b3452e6406cda8d408007",
		"tokenName": "QN",
		"amount": "100000000000000000",
		"hash": "029c2efaf67d92a29def730e008219b0e59ca6b7974ee1805c342438b961e085"
	}
}

SMS

PhoneBlocks

Returns blocks for phone number

  • Parameters:
    • string phone number
  • Returns:
    • send block and receive block for the phone number (phone number is encoded by base64 in return)
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "sms_phoneBlocks",
	"params": [
		"18000000000"
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "receive": [
      {
        "type": "Open",
        "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
        "address": "qlc_3wuwxqeamxu4ym7q33pbtzkz5wqrsrkyxs8mj7oz73qtjznig1ggpymic3ze",
        "balance": "0",
        "previous": "0000000000000000000000000000000000000000000000000000000000000000",
        "link": "0000000000000000000000000000000000000000000000000000000000000000",
        "sender": "IjE1ODExMTEwMDAwMCI=",
        "receiver": "IjE4NTAwMDAxMTExIg==",
        "message": "0000000000000000000000000000000000000000000000000000000000000000",
        "quota": 0,
        "timestamp": 0,
        "extra": "0000000000000000000000000000000000000000000000000000000000000000",
        "representative": "qlc_1111111111111111111111111111111111111111111111111111hifc8npp",
        "work": "0000000000000000",
        "signature": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "tokenName": "QLC",
        "amount": "0",
        "hash": "092c170e3e66c41488b3ad1cda47489f1fb094afceae12059b3a5b8e629baf59"
      }
    ],
    "send": [
      {
        "type": "Open",
        "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
        "address": "qlc_1edw94paqa691f99e4n769pjcztjhjx457hqsd1mt5r6eh1qsq5fifab88ud",
        "balance": "0",
        "previous": "0000000000000000000000000000000000000000000000000000000000000000",
        "link": "0000000000000000000000000000000000000000000000000000000000000000",
        "sender": "IjE4NTAwMDAxMTExIg==",
        "message": "0000000000000000000000000000000000000000000000000000000000000000",
        "quota": 0,
        "timestamp": 0,
        "extra": "0000000000000000000000000000000000000000000000000000000000000000",
        "representative": "qlc_1111111111111111111111111111111111111111111111111111hifc8npp",
        "work": "0000000000000000",
        "signature": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "tokenName": "QLC",
        "amount": "0",
        "hash": "bff20da921d2e21541e5c6b4ba59ffa76308a912094a543ab408bf648f1e476d"
      }
    ]
  }
}

MessageBlock

Returns block for message hash

  • Parameters:
    • string message hash
  • Returns:
    • block block for the message hash
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "sms_messageBlock",
	"params": [
		"87cc4915ae6e46aa0a744b4b1eca65b3ca8afcf1486b0dc40353b1b0feec6241"
	]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "type": "Open",
    "token": "45dd217cd9ff89f7b64ceda4886cc68dde9dfa47a8a422d165e2ce6f9a834fad",
    "address": "qlc_1pp6t4ksoypp3xetxyw4c4hy687yn5mjz67p4x9xo5arask753dyga1qqthp",
    "balance": "0",
    "previous": "0000000000000000000000000000000000000000000000000000000000000000",
    "link": "0000000000000000000000000000000000000000000000000000000000000000",
    "sender": "IjE4NTAwMDAxMTExIg==",
    "message": "87cc4915ae6e46aa0a744b4b1eca65b3ca8afcf1486b0dc40353b1b0feec6241",
    "quota": 0,
    "timestamp": 0,
    "extra": "0000000000000000000000000000000000000000000000000000000000000000",
    "representative": "qlc_1111111111111111111111111111111111111111111111111111hifc8npp",
    "work": "0000000000000000",
    "signature": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "tokenName": "QLC",
    "amount": "0",
    "hash": "08b595a3e4e8f17efd0f702160b57107007f584145e8358f30163242037ba34a"
  }
}

MessageHash

Returns hash for message

  • Parameters:
    • string message
  • Returns:
    • string hash for the message
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "sms_messageHash",
	"params": [
		"qlcqlc"
	]
}

Response:

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

MessageStore

store message and return message hash

  • Parameters:
    • string message
  • Returns:
    • string hash for the message
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "sms_messageStore",
	"params": [
		"qlcqlc"
	]
}

Response:

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

Wallet

GetBalances

Returns balance for each token of the wallet

  • Parameters:
    • string master address of the wallet
    • string passphrase
  • Returns:
    • balance of each token in the wallet
  • Example:

Request:

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

Response:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "QLC": "234000000000000000000",
        "QN1": "234991200",
        "QN2": "23499001200"
    }
}

GetRawKey

Returns raw key (public key and private key) for a account

  • Parameters:
    • string account
    • string passphrase
  • Returns:
    • private key and public key for the address
  • Example:

Request:

{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "wallet_getRawKey",
    "params": ["qlc_3s1agkbw6osftnodbcu9otawgdhz6q74xzpgsu641qzjgs8qdqfujim3z7ii","ge#QWDdsf123"]
}

Response:

{
    "jsonrpc": "2.0",
    "id": 3,
    "result": {
        "pubKey": "c39010e6c0a9d53a3e83f3a36970b660257f000ee940648d6cdfbc1d7a932b71",
        "privKey": "f59e77456e068c5e4384776c9a6bbfd774abb7bdd99aa072a3304e40599fd658c39010e6c0a9d53a3e83f3a36970b660257f000ee940648d6cdfbc1d7a932b71"
    }
}

NewSeed

Generate new seed

  • Parameters: null
  • Returns:
    • string hex string for seed
  • Example:

Request:

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

Response:

{
    "jsonrpc": "2.0",
    "id": 2,
    "result": "1234567890123456789012345678901234567890123456789012345678901234"
}

NewWallet

Create new wallet and Returns the master address

  • Parameters:
    • string passphrase
    • string optional, hex string for seed , if not set, will create seed randomly
  • Returns:
    • Address : master address of the wallet
  • Example
  1. if don't set seed

Request:

{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "wallet_newWallet",
    "params": ["fgeQW#1234"]
}

Response:

{
    "jsonrpc": "2.0",
    "id": 2,
    "result": "qlc_3s1agkbw6osftnodbcu9otawgdhz6q74xzpgsu641qzjgs8qdqfujim3z7ii"
}
  1. if set seed

Request:

{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "wallet_newWallet",
    "params": ["fgeQW#1234","1234567890123456789012345678901234567890123456789012345678901234"]
}

Response:

{
    "jsonrpc": "2.0",
    "id": 2,
    "result": "qlc_3s1agkbw6osftnodbcu9otawgdhz6q74xzpgsu641qzjgs8qdqfujim3z7ii"
}

ChangePassword

Returns raw key (public key and private key) for a address

  • Parameters:
    • string master address of the wallet
    • string old passphrase
    • new old passphrase
  • Returns null
  • Example:

Request:

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "wallet_changePassword",
	"params": [
		"qlc_3p1mnf5w3opm6sf4f9m7faeamks6cdeemx7p63tp4c9z456emzhhb1n9srco",
		"qlc",
		"qlcqlc"
	]
}

Response:

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

Net

OnlineRepresentatives

Returns online representative accounts that have voted recently

  • Parameters: null
  • Returns:
    • []account: account list
  • Example:

Request:

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

Response:

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

Util

Decrypt

Decrypt the cryptograph string by passphrase

  • Parameters:

    • string : cryptograph , encoded by base64
    • string : passphrase
  • Returns:

    • string : raw data
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":2,
  "method":"util_decrypt",
  "params":  ["p7zCeF6TImaZYYCHUoxPvImQ/CR/EnQ+KpyuqFkHVqA=","98qUb5Ud"]
}

Response:

{
  "jsonrpc": "2.0",
  "id":2,
  "result":"a7bcc2785e93226699618087528c4fbc8990fc247f12743e2a9caea8590756a0"

Encrypt

Encrypt encrypt raw data by passphrase

  • Parameters:
    • string : raw data
    • string : passphrase
  • Returns:
    • string: cryptograph , encoded by base64
  • Example:

Request:

{
  "jsonrpc": "2.0",
  "id":2,
  "method":"util_encrypt",
  "params":  ["a7bcc2785e93226699618087528c4fbc8990fc247f12743e2a9caea8590756a0","98qUb5Ud"]
}

Response:

{
  "jsonrpc": "2.0",
  "id":2,
  "result":"p7zCeF6TImaZYYCHUoxPvImQ/CR/EnQ+KpyuqFkHVqA="

RawToBalance

Return balance by specific unit for raw

  • Parameters:
    • int : raw
    • string : unit
    • string : token name , it's a optional parameter, if not set , default is QLC
  • Returns:
    • int : balance for the unit
  • Example:
  1. if token name not set

Request:

{
  "jsonrpc": "2.0",
  "id":1,
  "method":"util_rawToBalance",
  "params":  ["200000000","QLC"]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "2"
}
  1. if token name set

Request:

{
  "jsonrpc": "2.0",
  "id":1,
  "method":"util_rawToBalance",
  "params":  ["200000000","QLC","QLC"]
}

Response:

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

BalanceToRaw

Returns raw for the balance by specific unit

  • Parameters:
    • int : balance
    • string : unit
    • string : token name , it's a optional parameter, if not set , default is QLC
  • Returns:
    • int : raw
  • Example:
  1. if token name not set

Request:

{
  "jsonrpc": "2.0",
  "id":1,
  "method":"util_balanceToRaw",
  "params":  ["2","QLC"]
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "200000000"
}
  1. if token name set

Request:

{
  "jsonrpc": "2.0",
  "id":1,
  "method":"util_balanceToRaw",
  "params":  ["2","QLC", "QLC"]
}

Response:

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

Clone this wiki locally