JSON RPC API

JSON RPC API

JSON is a lightweight data-interchange format. It can represent numbers, strings, ordered sequences of values, and collections of name/value pairs.

JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol. Primarily this specification defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in many various message passing environments. It uses JSON (RFC 4627) as data format.

go-symverse supports JSON-RPC 2.0

JavaScript API

To talk to an symverse node from inside a JavaScript application offering API library with the web3.js library (from Ethereum)

the library gives an convenient interface for the RPC methods. See the JavaScript API for more.

JSON-RPC Endpoint

Default JSON-RPC endpoints:

  http://localhost:8545

You can start the HTTP JSON-RPC with the --rpc flag

  > gsym --rpc

change the default port (8545) and listing address (localhost) with:

  > gsym --rpc --rpcaddr <ip> --rpcport <portnumber>

If accessing the RPC from a browser, CORS will need to be enabled with the appropriate domain set. Otherwise, JavaScript calls are limit by the same-origin policy and requests will fail:

  > gsym --rpc --rpccorsdomain "http://localhost:3000"

The JSON RPC can also be started from the gsym console using the admin.startRPC(addr, port) command.

Output HEX values

At present there are two key datatypes that are passed over JSON: unformatted byte arrays and quantities. Both are passed with a hex encoding, however with different requirements to formatting:

When encoding QUANTITIES (integers, numbers): encode as hex, prefix with "0x", the most compact representation (slight exception: zero should be represented as "0x0"). Examples:

  • 0x41 (65 in decimal)

  • 0x400 (1024 in decimal)

  • WRONG: 0x (should always have at least one digit - zero is "0x0")

  • WRONG: 0x0400 (no leading zeroes allowed)

  • WRONG: ff (must be prefixed 0x)

When encoding UNFORMATTED DATA (byte arrays, account addresses, hashes, bytecode arrays): encode as hex, prefix with "0x", two hex digits per byte. Examples:

  • 0x41 (size 1, "A")

  • 0x004200 (size 3, "\0B\0")

  • 0x (size 0, "")

  • WRONG: 0xf0f0f (must be even number of digits)

  • WRONG: 004200 (must be prefixed 0x)

Currently go-symverse provides JSON-RPC communication only over http.

The default block parameter

Some methods have a extra default block parameter.

The following options are possible for the defaultBlock parameter:

  • HEX String - an integer block number

  • String "earliest" - for the earliest/genesis block

  • String "latest" - for the latest mined block

  • String "pending" - for the pending state/transactions

Curl Examples Explained

The curl options below might return a response where the node complains about the content type, this is because the --data option sets the content type to application/x-www-form-urlencoded . If your node does complain, manually set the header by placing -H "Content-Type: application/json" at the start of the call.

The examples also do not include the URL/IP & port combination which must be the last argument given to curl e.x. 127.0.0.1:8545

Oracle parameters

Oracle parameters are used for reward calculation in the blockchain. The parameters are applied by Oraclizer through oracle_sendOracle method.

Following parameters are defined.

  • price: float - SYM price from outside Oracle Service

  • costNodeA: uint - Reference A group warrant node cost per month

  • costNodeB": uint - Reference B group warrant node cost per month

  • costNodeCA: uint - Reference CA node cost per month

  • costNodeOra: uint - Reference Oraclizer node cost per month

  • numNodeA: uint - Number of Reference A group warrant node

  • numNodeB: uint - Number of Reference B group warrant node

  • numNodeCA: uint - Number of Reference CA node

  • numNodeOra: uint - Number of Reference Oraclizer node

  • qualDappGas: int - Minimum collateral for gas discount

  • qualNodeA: int - Minimum collateral for A group warrant node

  • qualNodeB: int - Minimum collateral for B group warrant node

  • qualNodeCA: int - Minimum collateral for CA node

  • qualNodeOraclizer: int - Minimum collateral for Oraclizer node

  • qualRewardGas: int - Minimum account balance for reward

  • numRewardGas: uint - Number of reward receivers who'd used gas one more per day = M

  • totalSupply: uint - Total supply amount of new coin after genesis

  • degreeOfFreedom: float - Factor of changing supply amount

  • minTxContribution: uint - Minimum transaction count for reward

  • maxGasDiscountRate: float - Maximum discount rate using at gas discount function

  • normPrice: float - Normalized SYM price for initial value

JSON RPC API Reference

web3_clientVersion

Returns the current client version.

Parameters

none

Returns

String - The current client version.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}'

// Result
{
  "id":67,
  "jsonrpc":"2.0",
  "result": "Gsym/v0.0.6-Develope-074c4306/linux-amd64/go1.10.4"
}

web3_sha3

Returns the standardized SHA3-256 of the given data.

Parameters

  1. DATA - the data to convert into a SHA3 hash.

params: ["0x68656c6c6f20776f726c64"];

Returns

DATA - The SHA3 result of the given string.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f20776f726c64"],"id":64}'

// Result
{
  "id":64,
  "jsonrpc": "2.0",
  "result": "0x5b2c76da96136d193336fad3fbc049867b8ca157da22f69ae0e4923648250acc"
}

net_version

Returns the current network id.

Parameters

none

Returns

String - The current network id.

  • "1": Symverse Mainnet

  • "2": Testnet

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}'

// Result
{
  "id":67,
  "jsonrpc": "2.0",
  "result": "2"
}

net_listening

Returns true if client is actively listening for network connections.

Parameters

none

Returns

Boolean - true when listening, otherwise false.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}'

// Result
{
  "id":67,
  "jsonrpc":"2.0",
  "result":true
}

net_peerCount

Returns number of peers currently connected to the client.

Parameters

none

Returns

QUANTITY - integer of the number of connected peers.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}'

// Result
{
  "id":74,
  "jsonrpc": "2.0",
  "result": "0x2" // 2
}

sym_protocolVersion

Returns the current symverse protocol version.

Parameters

none

Returns

String - The current symverse protocol version.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_protocolVersion","params":[],"id":67}'

// Result
{
  "id":67,
  "jsonrpc": "2.0",
  "result": "0x40"
}

sym_syncing

Returns an object with data about the sync status or false.

Parameters

none

Returns

Object|Boolean, An object with sync status data or FALSE, when not syncing:

  • currentBlock: QUANTITY - The current block, same as sym_blockNumber

  • startingBlock: QUANTITY - The block at which the import started (will only be reset, after the sync reached his head)

  • highestBlock: QUANTITY - The estimated highest block

  • pulledStates: QUANTITY - Number of state trie entries already downloaded

  • knownStates: QUANTITY - Total number of state trie entries known about

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_syncing","params":[],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": {
      startingBlock: "0x0", //0
      currentBlock: "0xe8", //232,
      highestBlock: "0x129", //297,
      pulledStates: "0x10", //16,
      knownStates: "0x10", //16,
  }
}
// Or when not syncing
{
  "id":1,
  "jsonrpc": "2.0",
  "result": false
}

sym_symbase

Returns the client coinbase address.

Parameters

none

Returns

DATA, 10 bytes - the current coinbase address.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_symbase","params":[],"id":64}'

// Result
{
  "id":64,
  "jsonrpc": "2.0",
  "result": "0x00000000000000001001"
}

sym_gasPrice

Returns the current price per gas in hug.

Parameters

none

Returns

QUANTITY - integer of the current gas price in hug.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_gasPrice","params":[],"id":73}'

// Result
{
  "id":73,
  "jsonrpc": "2.0",
  "result": "0x5d21dba00" // 25000000000
}

sym_accounts

Returns a list of addresses owned by client.

Parameters

none

Returns

Array of DATA, 10 Bytes - addresses owned by the client.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_accounts","params":[],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": ["0x00000000000000000901"]
}

sym_blockNumber

Returns the number of most recent block.

Parameters

none

Returns

QUANTITY - integer of the current block number the client is on.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_blockNumber","params":[],"id":1}'

// Result
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0xc94" // 1207
}

sym_getBalance

Returns the balance of the account of given address.

Parameters

  1. DATA, 10 Bytes - address to check for balance.

  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

params: ["0x00000000000000001001", "latest"];

Returns

QUANTITY - integer of the current balance in hug.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getBalance","params":["0x00000000000000001001", "latest"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x0234c8a3397aab58" // 158972490234375000
}

sym_getTransactionCount

Returns the number of transactions sent from an address.

Parameters

  1. DATA, 10 Bytes - address.

  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

params: [
  "0x00000000000000001001",
  "latest", // state at the latest block
];

Returns

QUANTITY - integer of the number of transactions sent from this address.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getTransactionCount","params":["0x00000000000000001001","pending"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x1" // 1
}

sym_getBlockTransactionCountByHash

Returns the number of transactions in a block from a block matching the given block hash.

Parameters

  1. DATA, 32 Bytes - hash of a block.

params: ["0x442839b4c7d6ae3bfe52e02e5f1ecca75946b02fe6b721277ab3b5ef64d459db"];

Returns

QUANTITY - integer of the number of transactions in this block.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getBlockTransactionCountByHash","params":["0x442839b4c7d6ae3bfe52e02e5f1ecca75946b02fe6b721277ab3b5ef64d459db"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xc" // 11
}

sym_getBlockTransactionCountByNumber

Returns the number of transactions in a block matching the given block number.

Parameters

  1. QUANTITY|TAG - integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.

params: [
  "0xe8", // 232
];

Returns

QUANTITY - integer of the number of transactions in this block.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getBlockTransactionCountByNumber","params":["0xe8"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xa" // 10
}

sym_getCode

Returns code at a given address.

Parameters

  1. DATA, 10 Bytes - address.

  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter.

params: [
  "0x00000000000000000901",
  "0x2", // 2
];

Returns

DATA - the code from the given address.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getCode","params":["0x00000000000000000901", "0x2"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x"
}

sym_sign

The sign method calculates an Symverse specific signature with: sign(sha256("\x19Symverse Signed Message:\n" + len(message) + message))).

By adding a prefix to the message makes the calculated signature recognisable as an Symverse specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.

Note the address to sign with must be unlocked.

Parameters

  1. DATA, 10 Bytes - address.

  2. DATA, N Bytes - message to sign.

Returns

DATA: Signature

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_sign","params":["0x00000000000000000901", "0xdeadbeaf"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x55e5413cd051640f16b8a8c9659aef7357af5590ebcd51cdf10d3c866fd2ae3c14d9a9aa083f65e8d9a156f1dbea8e3dda72ee8736a4b810b9910c99875a03061c"
}

sym_sendTransaction

Creates new message call transaction or a contract creation, if the data field contains code.

Parameters

  1. Object - The transaction object

  • from: DATA, 10 Bytes - the address the transaction is send from.

  • to: DATA, 10 Bytes - (optional when creating new contract) the address the transaction is directed to.

  • gas: QUANTITY - (optional, default: 90000) integer of the gas provided for the transaction execution. It will return unused gas.

  • gasPrice: QUANTITY - (optional, default: To-Be-Determined) integer of the gasPrice used for each paid gas.

  • value: QUANTITY - (optional) integer of the value sent with this transaction.

  • type:QUANTITY - (optional, default: 0) type of the transaction(0: original, 1: sct, 2: deposit)

  • input: DATA - the compiled code of a contract OR the hash of the invoked method signature and encoded Parameters.

  • nonce: QUANTITY - (optional) integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.

  • workNodes: Array - selected work node's SymID to send this transaction. (min: 1, max: 3)

params: [
  {
    from: "0x00000000000000000101",
    to: "0x00000000000000000901",
    value: "0x9184e72a",
  },
];

Returns

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Use sym_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_sendTransaction","params":[{see above}],"id":100}'

// Result
{
  "id":100,
  "jsonrpc": "2.0",
  "result": "0x97719876eb686bcd5bd92f41d9646686c4240796c660f04a8d33f88bf6d26424"
}

sym_sendRawTransaction

Creates new message call transaction or a contract creation for signed transactions.

Parameters

  1. DATA, The signed transaction data.

params: [
  "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
];

Returns

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Use sym_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_sendRawTransaction","params":[{see above}],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

sym_call

Executes a new message call immediately without creating a transaction on the block chain.

Parameters

  1. Object - The transaction call object

  • from: DATA, 10 Bytes - The address the transaction is sent from.

  • to: DATA, 10 Bytes - The address the transaction is directed to.

  • gas: QUANTITY - (optional) Integer of the gas provided for the transaction execution. sym_call consumes zero gas, but this parameter may be needed by some executions.

  • gasPrice: QUANTITY - (optional) Integer of the gasPrice used for each paid gas

  • value: QUANTITY - (optional) Integer of the value sent with this transaction

  • data: DATA - (optional) Hash of the method signature and encoded parameters.

  • type:QUANTITY - (optional, default: 0) type of the transaction(0: original, 1: sct, 2: deposit)

  1. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Returns

DATA - the return value of executed contract.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_call","params":[{see above}],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x0"
}

sym_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

Parameters

See sym_call parameters, expect that all properties are optional. If no gas limit is specified gsym uses the block gas limit from the pending block as an upper bound. As a result the returned estimate might not be enough to executed the call/transaction when the amount of gas is higher than the pending block gas limit.

Returns

QUANTITY - the amount of gas used.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_estimateGas","params":[{see above}],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x5208" // 21000
}

sym_getBlockByHash

Returns information about a main block, specified by the hash.

Parameters

  1. DATA, 32 Bytes - Hash of a block.

  2. Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.

params: [
  "0xbc26bf7324c622b934da753d016768373032b8bbf5488f8be9ad5bbfafd2bd12",
  true,
];

Returns

Object - A block object, or null when no block was found:

  • activeWbNum : QUANTITY – warrant block number which is used for creating the block.

  • cbHash : DATA , 32 Bytes - hash of a citizen block which is created with the main block. null when it’s not created.

  • cbNum : QUANTITY - latest citizen block number which is created with the main block.

  • extraData: DATA - the "extra data" field of this block.

  • gasLimit: QUANTITY - the maximum gas allowed in this block.

  • gasUsed: QUANTITY - the total used gas by all transactions in this block.

  • hash: DATA, 32 Bytes - hash of the block. null when its pending block.

  • logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.

  • number: QUANTITY - the block number. null when its pending block.

  • parentHash: DATA, 32 Bytes - hash of the parent block.

  • primary : DATA ,10 Bytes – address of the primary node.

  • receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.

  • rewards: Array - array of reward information which created this time.

  • sctRoot: DATA, 32 Bytes - the root of the final SCT's state trie of the block.

  • signInfo : Object –

    • mbNum : a main block's number targeted to sign.

    • sign : a aggregate signature of a block by primary and warrants which in the validatorInfos.

    • extraData: DATA - the "extra data" related with signature.

  • size: QUANTITY - integer the size of this block in bytes.

  • stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.

  • tickStamp: QUANTITY - a number which is related with block generate epoch.

  • timestamp: QUANTITY - the unix timestamp for when the block was collated.

  • transactions: Array - array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.

  • transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.

  • validatorInfos : Array - array of SymIDs which agree with make current block.

  • wbhash : DATA , 32 Bytes - hash of the warrant block which is created with the main block. null when it’s not created.

  • wbnum : QUANTITY - the warrant block number which is created with the main block. null when it’s not created.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getBlockByHash","params":["0xb592cb08492f8cd797af67c720b0da34939917abe6f0cf71894e3d6c3d6c792d", true],"id":100}'

// Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": {
        "activeCbNum": "0x0",
        "activeObNum": "0x0",
        "activeWbNum": "0x193",
        "cbHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "cbNum": "0x0",
        "extraData": "0xd508846773796d88676f312e31302e34856c696e7578",
        "gasLimit": "0xb3c36a0",
        "gasUsed": "0x0",
        "hash": "0x9d6c699063bb896cd646220db0bd1d30bf609d8d1cf1fd28a100cd59d0d8cea8",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "number": "0x1f89",
        "obHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "obNum": "0x0",
        "parentHash": "0xa893358d4d335e6dda1c22ce7b70b7faa4860e15cf7599410906055c5c15da53",
        "primary": "0x00000000000000000401",
        "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "rewardRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "rewards": [],
        "sctRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "signInfo": {
            "mbNum": "0x1f89",
            "sign": "0x3c6ddf6922780f1cd941b557422c7564822426df4db4fa6143e6bbc4ed85d359331dc207dbdb470c82a80a26816a3e741ddfb4880666371305f2429d2285f55b",
            "extraData": "0x"
        },
        "size": "0x309",
        "stateRoot": "0xb8fd81babf4f075dd08bffd56d3f07530b7b52e2f780c80c843695f1f5e7a6c9",
        "tickStamp": "0x1f89",
        "timeStamp": "0x5d9afa71",
        "transactions": [],
        "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "validatorInfos": [
            "0x00000000000000000601",
            "0x00000000000000000101",
            "0x00000000000000000501",
            "0x00000000000000000201",
            "0x00000000000000000701",
            "0x00000000000000000301"
        ],
        "wbHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "wbNum": "0x193"
    }
}

sym_getBlockByNumber

Returns information about a block by block number.

Parameters

  1. QUANTITY|TAG - Integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.

  2. Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.

params: [
  "0x1", // 1
  true,
];

Returns

See sym_getBlockByHash

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getBlockByNumber","params":["0x1", true],"id":100}'

Result see sym_getBlockByHash


sym_getTransactionByHash

Returns information regarding transaction requested by transaction hash.

Parameters

  1. DATA, 32 Bytes - Hash of a transaction

params: ["0x623ecfee09d2614630966768df9403806ac566f5d2c1bfb809123cd688e0f580"];

Returns

Object - A transaction object, or null when no transaction was found:

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending.

  • blockNumber: QUANTITY - block number where this transaction was in. null when its pending.

  • from: DATA, 10 Bytes - address of the sender.

  • gas: QUANTITY - gas provided by the sender.

  • gasPrice: QUANTITY - gas price provided by the sender in Hug.

  • hash: DATA, 32 Bytes - hash of the transaction.

  • input: DATA - the data send along with the transaction.

  • nonce: QUANTITY - the number of transactions made by the sender prior to this one.

  • to: DATA, 10 Bytes - address of the receiver. null when its a contract creation transaction.

  • transactionIndex: QUANTITY - integer of the transaction's index position in the block. null when its pending.

  • type:QUANTITY - type of the transaction (0: original, 1: sct, 2: deposit)

  • workNodes: Array - Array of selected work nodes via SymID when sending transactions . (min: 1, max: 3)

  • value: QUANTITY - value transferred in Hug.

  • extraData: DATA - the "extra data" field of this transaction.

  • v: QUANTITY - ECDSA recovery id

  • r: DATA, 32 Bytes - ECDSA signature r

  • s: DATA, 32 Bytes - ECDSA signature s

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getTransactionByHash","params":["0x623ecfee09d2614630966768df9403806ac566f5d2c1bfb809123cd688e0f580"],"id":100}'

// Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": {
        "blockHash": "0xfca1fb9d1f0d88ca95e2e2a6d183de81927db868284a9547cafc54f727c7e177",
        "blockNumber": "0x1a",
        "from": "0x00000000000000000301",
        "gas": "0x15f90",
        "gasPrice": "0x5d21dba00",
        "hash": "0x623ecfee09d2614630966768df9403806ac566f5d2c1bfb809123cd688e0f580",
        "input": "0x",
        "nonce": "0x0",
        "to": "0x00000000000000001301",
        "transactionIndex": "0x0",
        "type": "0x0",
        "workNodes": [
            "0x00000000000000000301"
        ],
        "value": "0xe8d4a51000000000000000000",
        "extraData": "0x",
        "v": "0x1",
        "r": "0x9e5d14ac9abe55a032427bae4b146bd9e141454d156429a56b255070592c3344",
        "s": "0x22ce1ffd30d080ade57c613c85fb68c3a147917588fa8527818945cc27258b6b"
    }
}

sym_getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position.

Parameters

  1. DATA, 32 Bytes - hash of a block.

  2. QUANTITY - integer of the transaction index position.

params: [
  "0x2d01dcb69ea3b02d441b6214da5d68a9a0c6c548ac3c17ec388ea7d2b0ff8279",
  "0x2", // 0
];

Returns

See sym_getTransactionByHash

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getTransactionByBlockHashAndIndex","params":["0x2d01dcb69ea3b02d441b6214da5d68a9a0c6c548ac3c17ec388ea7d2b0ff8279", "0x2"],"id":1}'

Result see sym_getTransactionByHash


sym_getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position.

Parameters

  1. QUANTITY|TAG - a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.

  2. QUANTITY - the transaction index position.

params: [
  "0xd65a", // 54874
  "0x2", // 2
];

Returns

See sym_getTransactionByHash

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getTransactionByBlockNumberAndIndex","params":["0xd65a", "0x2"],"id":1}'

Result see sym_getTransactionByHash


sym_getTransactionReceipt

Returns the receipt of a transaction by transaction hash.

Note That the receipt is not available for pending transactions.

Parameters

  1. DATA, 32 Bytes - hash of a transaction

params: ["0x77c684a89b85adc04fdf1908347e11705b45d2ad1b4e6237f65e6332b9a08ac4"];

Returns

Object - A transaction receipt object, or null when no receipt was found:

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in.

  • blockNumber: QUANTITY - block number where this transaction was in.

  • contractAddress: DATA, 10 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.

  • cumulativeGasUsed: QUANTITY - The total amount of gas used when this transaction was executed in the block.

  • from: DATA, 10 Bytes - address of the sender.

  • gasUsed: QUANTITY - The amount of gas used by this specific transaction alone.

  • logs: Array - Array of log objects, which this transaction generated.

  • logsBloom: DATA, 256 Bytes - Bloom filter for light clients to quickly retrieve related logs.

  • status: QUANTITY either 1 (success) or 0 (failure)

  • to: DATA, 10 Bytes - address of the receiver. null when it's a contract creation transaction.

  • transactionHash: DATA, 32 Bytes - hash of the transaction.

  • transactionIndex: QUANTITY - integer of the transaction's index position in the block.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getTransactionReceipt","params":["0x77c684a89b85adc04fdf1908347e11705b45d2ad1b4e6237f65e6332b9a08ac4"],"id":100}'

// Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": {
        "blockHash": "0x2d01dcb69ea3b02d441b6214da5d68a9a0c6c548ac3c17ec388ea7d2b0ff8279",
        "blockNumber": "0xd65a",
        "contractAddress": null,
        "cumulativeGasUsed": "0xf618",
        "from": "0x00000000000000001001",
        "gasUsed": "0x5208",
        "logs": [],
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "status": "0x1",
        "to": "0x00000000000000000901",
        "transactionHash": "0x77c684a89b85adc04fdf1908347e11705b45d2ad1b4e6237f65e6332b9a08ac4",
        "transactionIndex": "0x2"
    }
}

sym_getReward

Returns the reward by reward hash.

Parameters

  1. DATA, 32 Bytes - hash of a reward

params: ['0x77c684a89b85adc04fdf1908347e11705b45d2ad1b4e6237f65e6332b9a08ac4']

Returns

Object - A reward object, or null when no reward was found:

  • blockHash: DATA, 32 Bytes - hash of the block where this reward was in.

  • blockNumber: QUANTITY - block number where this reward was in.

  • extra: DATA 10 Bytes - reward delegation account for that warrant node.

  • rewardHash : DATA, 32 Bytes - hash of the reward.

  • rewardIndex: QUANTITY - integer of the reward's index position in the block.

  • symId: DATA, 10 Bytes - address of the warrant node.

  • type: QUANTITY, - device type. (wallet : 0, work : 1, warrant :2, ca : 3, oraclizer : 4)

  • value: QUANTITY - reward amount in Hug.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getReward","params":["0x77c684a89b85adc04fdf1908347e11705b45d2ad1b4e6237f65e6332b9a08ac4"],"id":100}'

// Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": {
        "blockHash": "0x020d2d8e4a59dcb53a3187d615960e6b59e246328fea5880ead7032b442171d6",
        "blockNumber": 43895200,
        "extra": "0x0002aea7a09991500002",
        "hash": "0x6fbebf239ffba49e3caf4086485ad7ac61dbbcb80838c278fb8ba2551966ff7c",
        "rewardIndex": 0,
        "symId": "0x0002282119120b040002",
        "type": 2,
        "value": 514285714285714285714
    }
}

sym_getDeposit

Returns the deposit related information of the account of given address.

Parameters

  1. DATA, 10 Bytes - address to check for deposit related information

Returns

Object - A deposit related information object:

  • account: DATA, 10 Bytes - address to check for balance.

  • balance: QUANTITY - integer of the current balance in hug.

  • deposit: QUANTITY - integer of the allocated deposit in hug.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_getDeposit","params":["0x00000000000000000401"],"id":100}'

// Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": {
        "account": "0x00000000000000000401",
        "balance": "0xc097ce7bc8f202c96816a6724359b7",
        "deposit": "0x152d02c7e14af6800000"
    }
}

sym_setDeposit

Returns the transaction hash of set deposit result.

Parameters

  1. DATA, 10 Bytes - address to check for deposit related information

  2. QUANTITY - integer of the value want to assign as deposit.

Returns

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Note the address to set deposit must be unlocked.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_setDeposit","params":["0x00000000000000000401","0x10000000000000"],"id":100}'

// Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": "0xebbe46ee6157c0c43d64988d4595fc794202587adf016a78e9b930a4deb9e379"
}

sym_restoreDeposit

Returns the transaction hash of restored deposit result.

Parameters

  1. DATA, 10 Bytes - address which restore the deposit.

Returns

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Note the address to set restore must be unlocked.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"sym_restoreDeposit","params":["0x00000000000000000401"],"id":100}'

// Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": "0xf24d14f4acbf343d512e277897044070924ee0a5a0b21ea3c0d9b443739e2d8a"
}

warrant_blockNumber

Returns the current warrant block number.

Parameters

None

Returns

QUANTITY - Integer of the current warrant block number the client is on.

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{ "jsonrpc":"2.0", "method":"warrant_blockNumber", "params":[], "id":100}' http://127.0.0.1:8545

//Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": "0x97" //151
}

warrant_getWarrantsByBlockHash

Returns information about warrant nodes by the block hash.

Parameters

  1. DATA, 32 Bytes - Hash of a warrant block.

Returns

Array of Object , N Bytes - Array of the existing warrant nodes in the designated block or null when failed.

  • symId:DATA, 10 Bytes - the warrant node's identity.

  • bKeyPub: DATA, 128 Bytes - public key of the warrant node.

  • bKeyPubSigned: DATA, 65 Bytes - sign of block public key made with account key.

  • group: QUANTITY - integer denoting for the group type of warrant node. (0: group A, 1: group B)

  • elected: QUANTITY - main block number when the warrant elected as a warrant.

  • finished: QUANTITY - main block number when the warrant finished its term.

  • extraData: DATA, 100 Bytes - extra information for the warrant.

  • hash: DATA, 32 Bytes - hash of the warrant node.

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{ "jsonrpc":"2.0", "method":"warrant_getWarrantsByBlockHash", "params":["0x4018ae70b6aa9f603dcee234d52f08e1039fb0ca2ccdcd254bf11159f7711f8e"], "id":100 }' http://127.0.0.1:8545

//Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": [
        {
            "symId": "0x00000000000000000101",
            "bKeyPub": "0x0eba8ced17621964dcd19457711749a62242de60cc8dacc300c627875c11aa88874e1cd0a483e605166fb22cf66e63c9c2433a03608afdf2343413d951a37f550a1600904f745e8133deae615b40b4c37f4b8f3fa0d7de052078fa96025dfeab84b5de720273ecbbee3db6758071bb160b40b8c2465110d0bf99c858bbfe640a",
            "bKeyPubSigned": "0x9e2abc6bfb2751af5368022717d31978c8feb0dc8263ee03fc4ce469529c57c20577dab31527a918f0410c03e7e7876091ce9e92052696706c5be95ac023ad2901",
            "group": "0x1",
            "elected": "0x1",
            "finished": "0x50",
            "extraData": "0x",
            "hash": "0xfeea462f903c109ef7cc15ca646b553371f256cb1b01a05a48bf4499286e217f"
        },
        {
            "symId": "0x00000000000000000201",
            "bKeyPub": "0x1e52c8421d8b0edd52ea4a3eb7e0c028958cb1463e05bce78b662e46f5aff1f98ea1d76334283f6ddc3e0f81b7abcfc7ad46e5769fa8891d6e26a30577cce6f1365275a96418d0e065c435ee30101d5a09e6a04ffc86246302f2217f5325b99c0f1dd95035621cc8ace596b82fcbf592183f3472acb71569b121edde13ef59fb",
            "bKeyPubSigned": "0xfdbe28e70516f8dca8b2f82e2c4eccbee075a1dd4b696a91cfc6e258131f9b7818543791d7300f758820099e01d5030b3c568fc8dd08765c4577c5ba8d5e7bf301",
            "group": "0x1",
            "elected": "0x1",
            "finished": "0x50",
            "extraData": "0x",
            "hash": "0x4ae192986aec09e75eb308fcfd3e928a556d1d50ef2b7985e42831dab3021c51"
        },
        {
            "symId": "0x00000000000000000301",
            "bKeyPub": "0x246c1ab9913ebe51726ca3c1ce0a99305a03cb090e446a685197c29793f5e95724016209259830027d046c04127c09bb0289d2c802ea99f794293b270ec77b02258a559f243a7fdf5d0e6d8befcfd5b4d3b77f5936da3a9a88cabf256e0601fc1cca3dc4aba8a09192c6c66846413cd09fbdd97044521850afde40c46d62e89c",
            "bKeyPubSigned": "0xbf3d83975d9e1d4274e7d754beb620ff61c9dfa69ec3ccf07a60bf68017e59ec1ac84b07075d55bba5e8d2f85fc8cf98b5a87b873493a591cd0c948d8fd72ff401",
            "group": "0x1",
            "elected": "0x1",
            "finished": "0x50",
            "extraData": "0x",
            "hash": "0xe9e5c9c10ef4ff567ea022668f0206330d99d912e404b682e4a6bf226e58b91f"
        },
        {
            "symId": "0x00000000000000000401",
            "bKeyPub": "0x84da52e3189de4a1a268b955d6331c36aef5e436d5bd13c441ff2a5da4b598b91f6ea50d290a79545a0ebcdcfd6daf6ad11bee200eceb6b310c9205b9be4dc6e86c7c70ba617edfa90fd4904478375254f0aaf23dd85bddb0ec43409cda3228715c430b317676a29394dc2c503b5dd23f75f7fbbdcc33f724b820a9043492c9f",
            "bKeyPubSigned": "0x89124bf7c4fd6cc013bd58202c0d6ac189c3eaae72fce5b99d4faaf04895089c3e5febaf6fdb99539fe4a6f3ad04f76344893caccf953346b6369fbc48f3fb3e01",
            "group": "0x1",
            "elected": "0x1",
            "finished": "0x50",
            "extraData": "0x",
            "hash": "0xd511e514a73a4b009a5ef4cb2439bb6a78b783c42968099cb94e887b7330f207"
        }
    ]
}

warrant_getWarrantsByBlockNumber

Returns information about warrant nodes specified by the block number.

Parameters

  1. QUANTITY - Integer of a block number.

Returns

See warrant_getWarrantsByBlockHash

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{"jsonrpc":"2.0", "method":"warrant_getWarrantsByBlockNumber", "params":["0x0"], "id":100}' http://127.0.0.1:8545

//Result
see warrant_getWarrantsByBlockHash

warrant_getBlockByHash

Returns information about warrant nodes specified by the block hash.

Parameters

  1. DATA, 32 Bytes - Hash of a warrant block.

  2. Boolean - If true it returns the full warrant Information objects, if false only the hashes of the warrants.

Returns

Object - A warrant block object, or null when no warrant block was found:

  • beginMbNum : QUANTITY - beginning number of the period.

  • endMbNum : QUANTITY - ending number of the period.

  • hash: DATA, 32 Bytes - hash of the block. null when its pending block.

  • number: QUANTITY - the block number. null when its pending block.

  • parentHash: DATA, 32 Bytes - hash of the parent block.

  • relatedMbNum: QUANTITY - main block number when this warrant block was created. null when its pending block.

  • size: QUANTITY - integer the size of this block in bytes.

  • warrants : Array – Information of warrant nodes in the designated block, or 32 Bytes warrant information’s hashes depending on the last given parameter.

  • warrantsRoot: DATA, 32 Bytes - the root of the warrant node's Informations trie of the block.

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{ "jsonrpc":"2.0", "method":"warrant_getBlockByHash", "params":["0x2b440afed4852f577ea9607b514eaaf0e62f1b5f1c601a89fb1918161f32cd87",true], "id":100 }' http://127.0.0.1:8545


//Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": {
        "beginMbNum": "0xd71",
        "endMbNum": "0xd84",
        "hash": "0x2b440afed4852f577ea9607b514eaaf0e62f1b5f1c601a89fb1918161f32cd87",
        "number": "0xac",
        "parentHash": "0xdd5316e4d78e90976d487f031277a720236b91ddb68eeaa85f4626cd15ba45a5",
        "relatedMbNum": "0xd6b",
        "size": "0x90a",
        "warrants":  [{...},{...}],
        "warrantsRoot": "0x1c2554ed414944ebd1c1bd1a8ae82b906da14285c619fe47ab92dc2a640128b0"
    }
}

warrant_getBlockByNumber

Returns information about a warrant block specified by the block number.

Parameters

  1. QUANTITY|TAG - Integer of a block number, or the string "earliest","pending" or "latest"

  2. Boolean - If true it returns the full warrant Information objects, if false only the hashes of the warrants.

Returns

See warrant_getBlockByHash

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{"jsonrpc":"2.0",  "method":"warrant_getBlockByNumber", "params":["0x0",true], "id":100}' http://127.0.0.1:8545

//Result
see warrant_getblockByHash

warrant_GetRewardAddr

Returns information about the reward delegation account for that warrant node based on the block hash or number and the warrant node account.

Parameters

  1. symId:DATA, 10 Bytes - the warrant node's identity.

  2. DATA, 32 Bytes - Hash of a warrant block or QUANTITY|TAG - Integer of a block number, or the string "earliest","pending" or "latest"

Returns

symId:DATA, 10 Bytes - Reward delegation account for that warrant node.

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{ "jsonrpc":"2.0", "method":"warrant_getRewardAddr", "params":["0x0002fdf5eee7e0d80002","latest"], "id":100 }' <http://127.0.0.1:8545>
// or
// curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{ "jsonrpc":"2.0", "method":"warrant_getRewardAddr", "params":["0x0002fdf5eee7e0d80002",762], "id":100 }' <http://127.0.0.1:8545>
// or
// curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{ "jsonrpc":"2.0", "method":"warrant_getRewardAddr", "params":["0x0002fdf5eee7e0d80002","0xeafdd6c6d79a2e3cb41064bcbee9ee8416c4bf97987d859eaab9ef34e9223073"], "id":100 }' <http://127.0.0.1:8545>
//Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": "0x0002aea7a09991500002"
}

citizen_sendCitizen

The message call in order to create new citizen or change citizen information.

Parameters

  1. Object - the Symverse identifier & account properties.

  • from : DATA , 10 Bytes - the address of the CA server that creates SymID.

  • to : DATA , 10 Bytes - (optional) the address creation transaction is directed to.

  • symId : DATA , 10 Bytes - hexadecimal SymID identifying an account.

  • aKeyPubH : DATA , 20 Bytes - lower bytes of hashed public key.

  • vFlag : DATA , 1 Byte - (optional ,default:0) verification strength of an account represented by bits.

  • country : DATA , 1 Byte - (optional, default:0) country code.

  • status : DATA , 1 Byte - (optional, default:1, active) account status of an account. (0x1: Active, 0x2: Locked, 0x3: Marked, 0x4: Revoked)

  • credit : DATA , 1 Byte - (optional, default:0) credit rating of an account (0~15)

  • role : DATA , 2 Bytes - (optional, default: 0x1) account role (0x1: general, 0xf0f0: Master CA, 0xf0f1: CA, 0xf0f2: Oracle)

  • refCode : DATA , 4 Bytes - (optional) issuer's reference code.

  • nonce : QUANTITY - (optional) integer of a nonce.

    Note : See Symverse identifier & account properties in detail.

params:[{
    "from": "0x00000000000000000901",
    "to": "0x00000000000000000000",
    "vFlag":"0x0",
    "symId":"0x00010000000000010003",
    "aKeyPubH":"0x484E0b5D12913CeC0B4e942828F6168E9F464A09",
    "country": "0x0",
    "status": "0x1",
    "credit": "0xf",
    "role": "0x1"
}]

Returns

DATA, 32 Bytes - hash of a citizen.

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{"jsonrpc":"2.0","method":"citizen_sendCitizen","params":[{see above}],"id":100}' http://127.0.0.1:8545

//Result
{"jsonrpc":"2.0","id":100,"result":"0x4841852ea5d07be83b6ffc087619664b4609405c286c7fe325492c16ca53f2c5"}

citizen_sendRawCitizen

The message call in order to create new citizen or change citizen information for signed citizen.

Parameters

  1. Object - signed citizen, RLP encoded value of signed citizen.

Returns

DATA, 32 Bytes - hash of a citizen.

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{"jsonrpc":"2.0","method":"citizen_sendRawCitizen","params": "0x20ba02f3659983a51a761ccf7e4d2e4a62610a3e20ba02f3659983a51a761ccf7e4d2e4a62610a3e","id":100}' http://127.0.0.1:8545

//Result
{"jsonrpc":"2.0","id":100,"result":"0x09e67b2f1bd21f6043368f97ebff4f4a2b238111c5a5767b75abde08845bda6e"

citizen_getCitizenByHash

Returns information about a citizen publication requested by the citizen hash.

Parameters

  1. DATA, 32 Bytes - hash of a citizen.

Returns

Object - A block object, or null when it was failed:

  • blockHash: DATA, 32 Bytes - hash of block.

  • blockNumber: QUANTITY - number of block.

  • citizenIndex: QUANTITY - integer of the citizen's index position in the block. null when its pending.

  • from : DATA , 10 Bytes - the address of the CA server that creates SymID.

  • to : DATA , 10 Bytes - the address creation transaction is directed to.

  • nonce : QUANTITY - integer of a nonce.

  • symId : DATA , 10 Bytes - hexadecimal SymID identifying an account.

  • aKeyPubH : DATA , 20 Bytes - lower bytes of hashed public key.

  • vFlag : DATA , 1 Byte - verification strength of an account represented by bits.

  • country : DATA , 1 Byte - country code.

  • status : DATA , 1 Byte - account status of an account. (0x1: Active, 0x2: Locked, 0x3: Marked, 0x4: Revoked)

  • credit : DATA , 1 Byte - credit rating of an account (0~15)

  • role : DATA , 2 Bytes - account role (0x1: general, 0xf0f0: Master CA, 0xf0f1: CA)

  • refCode : DATA , 4 Bytes - issuer's reference code.

  • writeTime : QUANTITY - the unix timestamp for the citizen requested time.

  • hash : DATA , Bytes - citizen hash.

  • v: QUANTITY - ECDSA recovery id

  • r: DATA, 32 Bytes - ECDSA signature r

  • s: DATA, 32 Bytes - ECDSA signature s

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{"jsonrpc":"2.0","method":"citizen_getCitizenByHash","params":["0x289a9abcf00a5959ee7fe11bc157cd3a5882b7ae2f86f4ce338bbe00d07c98a1"],"id":100}' http://127.0.0.1:8545

//Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": {
        "blockHash": "0x486dda2c8470ca2a885cd4cef5a96a4a561cb0f78fa1faad23a60be7d9797acd",
        "blockNumber": "0x1",
        "citizenIndex": "0x0",
        "from": "0x00000000000000000901",
        "to": "0x00000000000000000901",
        "nonce": "0x0",
        "symId": "0x00000000000000002001",
        "aKeyPubH": "0x0000000000000000000000000000000000000000",
        "vFlag": "0x0",
        "country": "0x0",
        "status": "0x1",
        "credit": "0x0",
        "role": "0x1",
        "refCode": "0x0",
        "writeTime": "0x5d9bf803",
        "hash": "0x289a9abcf00a5959ee7fe11bc157cd3a5882b7ae2f86f4ce338bbe00d07c98a1",
        "v": "0x0",
        "r": "0xe2ad882dfce94e0b04b8239d8ccdd61c43fe309daa980d6226380fc7f2787fd1",
        "s": "0x762c3710daff628557aa91e12e36618c9071a99a7c7cd7e9b90e9eb7cd548276"
    }
}

citizen_getRawCitizenByHash

Returns an RLP encoded value of a signed citizen specified by the hash.

Parameters

  1. DATA, 32 Bytes - hash of a citizen.

Returns

DATA - RLP encoded value of a signed citizen.

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{"jsonrpc":"2.0","method":"citizen_getRawCitizenByHash","params":["0x7496b0869fce231bbdc2f68f48dfe3929bdfd1e52c9c87d41716cd83f18cc2d1"],"id":100}' http://127.0.0.1:8545

//Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": "0xf8828a000000000000000009018a00000000000000001101808a0000000000000000011194484e0b5d12913cec0b4e942828f6168e9f464a098080010f0180808080a03fae1c96dc82545c966e3601141d30edf5ef8abfebf368d7c434de9c9f993253a05bddfcba41de55066e62b96d0248b3620aa791e2c8b9597549d62ec08a8bc90b"
}

citizen_getCitizenBySymID

Returns the information of a citizen by the SymID.

Parameters

  1. DATA, 10Bytes - SymID.

  2. QUANTITY|TAG - Integer of a block number, or the string "earliest" or "latest"

Returns

Object , N Bytes - For existing citizen information or null when it was failed

  • ca: DATA, 10 Bytes - the issuer's SymID of the citizen.

  • nonce: QUANTITY - integer of a nonce.

  • aKeyPubH : DATA, 20 Bytes - lower bytes of hashed public key.

  • vFlag : DATA , 1 Byte - verification strength of an account represented by bits.

  • country: DATA, 1 Byte - country code.

  • status : DATA , 1 Byte - account status of an account. (0x1: Active, 0x2: Locked, 0x3: Marked, 0x4: Revoked)

  • credit : DATA, 1 Byte - account credit rating(0~15)

  • role : DATA , 2 Bytes - account role (0x1: general, 0xf0f0: Master CA, 0xf0f1: CA, 0xf0f2: Oracle)

  • refCode: DATA, 4 Bytes - issuer's reference code.

  • writeTime : QUANTITY - the unix timestamp for the citizen requested time.

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{"jsonrpc":"2.0","method":"citizen_getCitizenBySymID", "params":["0x00000000000000001001","latest"],"id":100}' http://127.0.0.1:8545

//Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": {
        "ca": "0x00000000000000000801",
        "aKeyPubH": "0xf6231e6649cdf3aa13002b659026dba31156036f",
        "nonce": "0x0",
        "vFlag": "0x0",
        "country": "0x0",
        "status": "0x1",
        "credit": "0x0",
        "role": "0xf0f1",
        "refCode": "0x0",
        "writeTime": "0x0"
    }
}

citizen_getRawCitizenBySymID

Returns the RLP encoded value of a signed citizen specified by SymID.

Parameters

  1. DATA, 10Bytes - SymID.

  2. QUANTITY|TAG - Integer of a block number, or the string "earliest" or "latest"

Returns

DATA - RLP encoded value of signed citizen.

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{"jsonrpc":"2.0","method":"citizen_getRawCitizenBySymID","params":["0x00000000000000001001","latest"],"id":100}' http://127.0.0.1:8545

//Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": "0xe98a000000000000000008018094cb670a6d98a5dfa7963ebba66ece1001a5e87c2a8080010f82f0f280"
}

citizen_getCitizensByBlockNumber

Returns all citizens at the designated citizen block number.

Parameters

1.QUANTITY|TAG - Integer of a block number, or the string "earliest" or "latest"

Returns

Array of Object , N Bytes - For existing citizen information or null when it was failed or none.

  • blockHash: DATA, 32 Bytes - hash of block.

  • blockNumber: QUANTITY - number of block.

  • citizenIndex: QUANTITY - integer of the citizen's index position in the block. null when its pending.

  • from: DATA, 10 Bytes - the address the CA who creates this SymID.

  • to: DATA, 10 Bytes - the address is directed to.

  • nonce: QUANTITY - integer of a nonce.

  • symId : DATA, 10 Bytes - created SymID.

  • aKeyPubH : DATA, 20 Bytes - lower bytes of hashed public key.

  • vFlag: DATA, 1 Byte - each bit means verification strength of this SymID.

  • country: DATA, 1 Byte - country code.

  • status : DATA, 1 Byte - account status (0x1: Active, 0x2: Locked, 0x3: Marked, 0x4: Revoked).

  • credit : DATA, 1 Byte - account credit rating(0~15)

  • role: DATA, 2 Bytes - account role (0x1: general, 0xf0f0: Master CA, 0xf0f1: CA)

  • refCode: DATA, 4 Bytes - issuer's reference code.

  • writeTime : QUANTITY - the unix timestamp for the citizen requested time.

  • hash : DATA , 32 Bytes - citizen hash.

  • v: QUANTITY - ECDSA recovery id

  • r: DATA, 32 Bytes - ECDSA signature r

  • s: DATA, 32 Bytes - ECDSA signature s

Example

//Request
curl -X POST -H "Content-Type: application/json; charset=utf-8" --data '{"jsonrpc":"2.0","method":"citizen_getCitizensByBlockNumber","params":["latest"],"id":100}' http://127.0.0.1:8545}

//Result
{
    "jsonrpc": "2.0",
    "id": 100,
    "result": [
         {
            "blockHash": "0xd3bb1c3e121f790502a22fb64f0d806efae11f7d1de3a5e227380787637f2baa",
            "blockNumber": "0x0",
            "citizenIndex": "0x0",
            "from": "0x00000000000000000901",
            "to": "0x00000000000000000000",
            "nonce": "0x0",
            "symId": "0x00000000000000000101",
            "aKeyPubH": "0x18c4fdb750cf3cf60e58fdac3a67419cd5e05836",
            "vFlag": "0x0",
            "country": "0x0",
            "status": "0x1",
            "credit": "0x0",
            "role": "0x1",
            "refCode": "0x0",
            "writeTime": "0x0",
            "hash": "0x32c636492df42933bf55082c38efdab4a9b68de23843043ca617b6772ff4443e",
            "v": "0x0",
            "r": "0x0",
            "s": "0x0"
        },
        {
            "blockHash": "0xd3bb1c3e121f790502a22fb64f0d806efae11f7d1de3a5e227380787637f2baa",
            "blockNumber": "0x0",
            "citizenIndex": "0x1",
            "from": "0x00000000000000000901",
            "to": "0x00000000000000000000",
            "nonce": "0x0",
            "symId": "0x00000000000000000201",
            "aKeyPubH": "0x03c223f461d55d0f098261a1a51b01f396807d2d",
            "vFlag": "0x0",
            "country": "0x0",
            "status": "0x1",
            "credit": "0x0",
            "role": "0x1",
            "refCode": "0x0",
            "writeTime": "0x0",
            "hash": "0xfa24f8a6fb071f26c860eeb8330df97dabf33dbc7d19db0b4a9a8596f4d7bbff",
            "v": "0x0",
            "r": "0x0",
            "s": "0x0"
        }
    ]
}

citizen_getCitizenCount

Returns the number of citizens sent from an address.

Parameters

  1. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Returns

QUANTITY - integer of the number of citizens in current state

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"citizen_getCitizenCount","params":["latest"],"id":1}'

// Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0x1" // 1
}

citizen_pendingCitizens

Returns citizen objects in the pool which the entity is currently on.

Parameters

none

Returns

Array of Object , N Bytes - For existing citizen information or null when it was failed or none.

  • blockHash: DATA, 32 Bytes - hash of block.

  • blockNumber: QUANTITY - number of block.

  • citizenIndex: QUANTITY - integer of the citizen's index position in the block. null when its pending.

  • from: DATA, 10 Bytes - the address the CA who creates this SymID.

  • to: DATA, 10 Bytes - the address is directed to.

  • nonce: QUANTITY - integer of a nonce.

  • symId : DATA, 10 Bytes - created SymID.

  • aKeyPubH : DATA, 20 Bytes - lower bytes of hashed public key.

  • vFlag: DATA, 1 Byte - each bit means verification strength of this SymID.

  • country: DATA, 1 Byte - country code.

  • status : DATA, 1 Byte - account status (0x1: Active, 0x2: Locked, 0x3: Marked, 0x4: Revoked).

  • credit : DATA, 1 Byte - account credit rating(0~15)

  • role: DATA, 2 Bytes - account role (0x1: general, 0xf0f0: Master CA, 0xf0f1: CA)

  • refCode: DATA, 4 Bytes - issuer's reference code.

  • writeTime : QUANTITY - the unix timestamp for the citizen requested time.

  • hash : DATA , 32 Bytes - citizen hash.

  • v: QUANTITY - ECDSA recovery id

  • r: DATA, 32 Bytes - ECDSA signature r

  • s: DATA, 3