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:
You can start the HTTP JSON-RPC with the --rpc
flag
change the default port (8545) and listing address (localhost) with:
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:
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 numberString "earliest"
- for the earliest/genesis blockString "latest"
- for the latest mined blockString "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 ServicecostNodeA
:uint
- Reference A group warrant node cost per monthcostNodeB"
:uint
- Reference B group warrant node cost per monthcostNodeCA
:uint
- Reference CA node cost per monthcostNodeOra
:uint
- Reference Oraclizer node cost per monthnumNodeA
:uint
- Number of Reference A group warrant nodenumNodeB
:uint
- Number of Reference B group warrant nodenumNodeCA
:uint
- Number of Reference CA nodenumNodeOra
:uint
- Number of Reference Oraclizer nodequalDappGas
:int
- Minimum collateral for gas discountqualNodeA
:int
- Minimum collateral for A group warrant nodequalNodeB
:int
- Minimum collateral for B group warrant nodequalNodeCA
:int
- Minimum collateral for CA nodequalNodeOraclizer
:int
- Minimum collateral for Oraclizer nodequalRewardGas
:int
- Minimum account balance for rewardnumRewardGas
:uint
- Number of reward receivers who'd used gas one more per day = MtotalSupply
:uint
- Total supply amount of new coin after genesisdegreeOfFreedom
:float
- Factor of changing supply amountminTxContribution
:uint
- Minimum transaction count for rewardmaxGasDiscountRate
:float
- Maximum discount rate using at gas discount functionnormPrice
: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
web3_sha3
Returns the standardized SHA3-256 of the given data.
Parameters
DATA
- the data to convert into a SHA3 hash.
Returns
DATA
- The SHA3 result of the given string.
Example
net_version
Returns the current network id.
Parameters
none
Returns
String
- The current network id.
"1"
: Symverse Mainnet"2"
: Testnet
Example
net_listening
Returns true
if client is actively listening for network connections.
Parameters
none
Returns
Boolean
- true
when listening, otherwise false
.
Example
net_peerCount
Returns number of peers currently connected to the client.
Parameters
none
Returns
QUANTITY
- integer of the number of connected peers.
Example
sym_protocolVersion
Returns the current symverse protocol version.
Parameters
none
Returns
String
- The current symverse protocol version.
Example
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_blockNumberstartingBlock
:QUANTITY
- The block at which the import started (will only be reset, after the sync reached his head)highestBlock
:QUANTITY
- The estimated highest blockpulledStates
:QUANTITY
- Number of state trie entries already downloadedknownStates
:QUANTITY
- Total number of state trie entries known about
Example
sym_symbase
Returns the client coinbase address.
Parameters
none
Returns
DATA
, 10 bytes - the current coinbase address.
Example
sym_gasPrice
Returns the current price per gas in hug.
Parameters
none
Returns
QUANTITY
- integer of the current gas price in hug.
Example
sym_accounts
Returns a list of addresses owned by client.
Parameters
none
Returns
Array of DATA
, 10 Bytes - addresses owned by the client.
Example
sym_blockNumber
Returns the number of most recent block.
Parameters
none
Returns
QUANTITY
- integer of the current block number the client is on.
Example
sym_getBalance
Returns the balance of the account of given address.
Parameters
DATA
, 10 Bytes - address to check for balance.QUANTITY|TAG
- integer block number, or the string"latest"
,"earliest"
or"pending"
, see the default block parameter
Returns
QUANTITY
- integer of the current balance in hug.
Example
sym_getTransactionCount
Returns the number of transactions sent from an address.
Parameters
DATA
, 10 Bytes - address.QUANTITY|TAG
- integer block number, or the string"latest"
,"earliest"
or"pending"
, see the default block parameter
Returns
QUANTITY
- integer of the number of transactions sent from this address.
Example
sym_getBlockTransactionCountByHash
Returns the number of transactions in a block from a block matching the given block hash.
Parameters
DATA
, 32 Bytes - hash of a block.
Returns
QUANTITY
- integer of the number of transactions in this block.
Example
sym_getBlockTransactionCountByNumber
Returns the number of transactions in a block matching the given block number.
Parameters
QUANTITY|TAG
- integer of a block number, or the string"earliest"
,"latest"
or"pending"
, as in the default block parameter.
Returns
QUANTITY
- integer of the number of transactions in this block.
Example
sym_getCode
Returns code at a given address.
Parameters
DATA
, 10 Bytes - address.QUANTITY|TAG
- integer block number, or the string"latest"
,"earliest"
or"pending"
, see the default block parameter.
Returns
DATA
- the code from the given address.
Example
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
DATA
, 10 Bytes - address.DATA
, N Bytes - message to sign.
Returns
DATA
: Signature
Example
sym_sendTransaction
Creates new message call transaction or a contract creation, if the data field contains code.
Parameters
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)
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
sym_sendRawTransaction
Creates new message call transaction or a contract creation for signed transactions.
Parameters
DATA
, The signed transaction data.
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
sym_call
Executes a new message call immediately without creating a transaction on the block chain.
Parameters
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 gasvalue
:QUANTITY
- (optional) Integer of the value sent with this transactiondata
: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)
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
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
sym_getBlockByHash
Returns information about a main block, specified by the hash.
Parameters
DATA
, 32 Bytes - Hash of a block.Boolean
- Iftrue
it returns the full transaction objects, iffalse
only the hashes of the transactions.
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 thevalidatorInfos
.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
sym_getBlockByNumber
Returns information about a block by block number.
Parameters
QUANTITY|TAG
- Integer of a block number, or the string"earliest"
,"latest"
or"pending"
, as in the default block parameter.Boolean
- Iftrue
it returns the full transaction objects, iffalse
only the hashes of the transactions.
Returns
See sym_getBlockByHash
Example
Result see sym_getBlockByHash
sym_getTransactionByHash
Returns information regarding transaction requested by transaction hash.
Parameters
DATA
, 32 Bytes - Hash of a transaction
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 idr
:DATA
, 32 Bytes - ECDSA signature rs
:DATA
, 32 Bytes - ECDSA signature s
Example
sym_getTransactionByBlockHashAndIndex
Returns information about a transaction by block hash and transaction index position.
Parameters
DATA
, 32 Bytes - hash of a block.QUANTITY
- integer of the transaction index position.
Returns
See sym_getTransactionByHash
Example
Result see sym_getTransactionByHash
sym_getTransactionByBlockNumberAndIndex
Returns information about a transaction by block number and transaction index position.
Parameters
QUANTITY|TAG
- a block number, or the string"earliest"
,"latest"
or"pending"
, as in the default block parameter.QUANTITY
- the transaction index position.
Returns
See sym_getTransactionByHash
Example
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
DATA
, 32 Bytes - hash of a transaction
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, otherwisenull
.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
either1
(success) or0
(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
sym_getDeposit
Returns the deposit related information of the account of given address.
Parameters
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
sym_setDeposit
Returns the transaction hash of set deposit result.
Parameters
DATA
, 10 Bytes - address to check for deposit related informationQUANTITY
- 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
sym_restoreDeposit
Returns the transaction hash of restored deposit result.
Parameters
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
warrant_blockNumber
Returns the current warrant block number.
Parameters
None
Returns
QUANTITY
- Integer of the current warrant block number the client is on.
Example
warrant_getWarrantsByBlockHash
Returns information about warrant nodes by the block hash.
Parameters
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
warrant_getWarrantsByBlockNumber
Returns information about warrant nodes specified by the block number.
Parameters
QUANTITY
- Integer of a block number.
Returns
See warrant_getWarrantsByBlockHash
Example
warrant_getBlockByHash
Returns information about warrant nodes specified by the block hash.
Parameters
DATA
, 32 Bytes - Hash of a warrant block.Boolean
- Iftrue
it returns the full warrant Information objects, iffalse
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
warrant_getBlockByNumber
Returns information about a warrant block specified by the block number.
Parameters
QUANTITY|TAG
- Integer of a block number, or the string"earliest"
,"pending"
or"latest"
Boolean
- Iftrue
it returns the full warrant Information objects, iffalse
only the hashes of the warrants.
Returns
See warrant_getBlockByHash
Example
citizen_sendCitizen
The message call in order to create new citizen or change citizen information.
Parameters
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.
Returns
DATA
, 32 Bytes - hash of a citizen.
Example
citizen_sendRawCitizen
The message call in order to create new citizen or change citizen information for signed citizen.
Parameters
Object
- signed citizen, RLP encoded value of signed citizen.
Returns
DATA
, 32 Bytes - hash of a citizen.
Example
citizen_getCitizenByHash
Returns information about a citizen publication requested by the citizen hash.
Parameters
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 idr
:DATA
, 32 Bytes - ECDSA signature rs
:DATA
, 32 Bytes - ECDSA signature s
Example
citizen_getRawCitizenByHash
Returns an RLP encoded value of a signed citizen specified by the hash.
Parameters
DATA
, 32 Bytes - hash of a citizen.
Returns
DATA
- RLP encoded value of a signed citizen.
Example
citizen_getCitizenBySymID
Returns the information of a citizen by the SymID.
Parameters
DATA
, 10Bytes - SymID.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
citizen_getRawCitizenBySymID
Returns the RLP encoded value of a signed citizen specified by SymID.
Parameters
DATA
, 10Bytes - SymID.QUANTITY|TAG
- Integer of a block number, or the string"earliest"
or"latest"
Returns
DATA
- RLP encoded value of signed citizen.
Example
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 idr
:DATA
, 32 Bytes - ECDSA signature rs
:DATA
, 32 Bytes - ECDSA signature s
Example
citizen_getCitizenCount
Returns the number of citizens sent from an address.
Parameters
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
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 idr
:DATA
, 32 Bytes - ECDSA signature rs
:DATA
, 32 Bytes - ECDSA signature s
Example
citizen_blockNumber
Returns the number of the most recent citizen block.
Parameters
none
Returns
QUANTITY
- integer of the current citizen block number the client is on.
Example
citizen_getBlockByHash
Returns information about a citizen block, specified by the hash.
Parameters
DATA
, 32 Bytes - Hash of a citizen block.Boolean
- Iftrue
it returns the full citizen objects, iffalse
only the hashes of the citizens.
Returns
Object
- A citizen block object, or null
when no citizen block was found:
citizens
:Array
- citizens in this block, or 32 Bytes citizen hashes depending on the last given parameter.citizensRoot
:DATA
, 32 Bytes - the root of the citizen trie of the block.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 citizen block was created.null
when its pending block.stateRoot
:DATA
, 32 Bytes - the root of the final state trie of the block.
Example
citizen_getBlockByNumber
Returns information about a citizen block, specified by the citizen block number.
Parameters
QUANTITY|TAG
- Integer of a block number, or the string"earliest"
,"pending"
or"latest"
Boolean
- Iftrue
it returns the full citizen objects, iffalse
only the hashes of the citizens.
Returns
See citizen_getBlockByHash
Example
citizen_getBlockCitizenCountByHash
Returns the number of citizens in a block from a block matched with the given block hash.
Parameters
DATA
, 32 Bytes - hash of a block.
Returns
QUANTITY
- integer of the number of citizens in this block.
Example
citizen_getBlockCitizenCountByNumber
Returns the number of citizens in a block from a block matched with the given block number.
Parameters
QUANTITY|TAG
- integer of a block number, or the string"earliest"
,"latest"
or"pending"
, as in the default block parameter.
Returns
QUANTITY
- integer of the number of citizens in this block.
Example
oracle_sendOracle
The message call in order to create new oracle.
Parameters
Object
- the oracle.
from
:DATA
, 10 Bytes - the address of the CA server that creates SymID.nonce
:QUANTITY
- (optional) integer of a nonce.data
:DATA
, N Bytes - JSON encoded Oracle parameters, see the Oracle Parameters
Returns
DATA
, 32 Bytes - hash of a oracle.
Example
oracle_sendRawOracle
The message call in order to create new oracle.
Parameters
Object
- signed oracle, RLP encoded value of signed oracle.
Returns
DATA
, 32 Bytes - hash of a oracle.
Example
oracle_sendOracleJSON
The message call in order to create new oracle with JSON formatted oracle parameters. This method calls oracle_sendOracle after making "data" of sendOracle with second parameter.
Returns the hash of oracle message sent from the address.
Parameters
DATA
, 10 Bytes - address.STRING
- JSON formatted oracle parameters, see the Oracle Parameters
Returns
DATA
, 32 Bytes - hash of a oracle.
Example
oracle_getOracleByHash
Returns an RLP encoded value of a signed oracle specified by the hash.
Parameters
DATA
, 32 Bytes - hash of a oracle.
Returns
DATA
- RLP encoded value of a signed oracle.
Example
oracle_getRawOracleByHash
Returns an RLP encoded value of a signed oracle specified by the hash.
Parameters
DATA
, 32 Bytes - hash of a oracle.
Returns
DATA
- RLP encoded value of a signed oracle.
Example
oracle_getOracleCount
Returns the number of oracles sent from an address.
Parameters
DATA
, 10 Bytes - address.QUANTITY|TAG
- integer block number, or the string"latest"
,"earliest"
or"pending"
, see the default block parameter
Returns
QUANTITY
- integer of the number of oracles in current state
Example
oracle_pendingOracles
Returns oracle objects in the pool which the entity is currently on.
Parameters
none
Returns
Array of Object
, N Bytes - For existing oracle information or null
when it was failed or none.
blockHash
:DATA
, 32 Bytes - hash of block.blockNumber
:QUANTITY
- number of block.oracleIndex
:QUANTITY
- integer of the oracles 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.data
:DATA
, ? Bytes - //////extra
:DATA
, ? Bytes - //hash
:DATA
, 32 Bytes - citizen hash.v
:QUANTITY
- ECDSA recovery idr
:DATA
, 32 Bytes - ECDSA signature rs
:DATA
, 32 Bytes - ECDSA signature s
Example
oracle_blockNumber
Returns the number of the most recent oracle block.
Parameters
none
Returns
QUANTITY
- integer of the current oracle block number the client is on.
Example
oracle_getBlockByHash
Returns information about a oracle block, specified by the hash.
Parameters
DATA
, 32 Bytes - Hash of a oracle block.Boolean
- Iftrue
it returns the full oracle objects, iffalse
only the hashes of the oracles.
Returns
Object
- A citizen block object, or null
when no oracle block was found:
hash
:DATA
, 32 Bytes - hash of the block.null
when its pending block.number
:QUANTITY
- the block number.null
when its pending block.oracles
:Array
- oracless in this block, or 32 Bytes oracle hashes depending on the last given parameter.oraclesRoot
:DATA
, 32 Bytes - the root of the oracle trie of the block.parentHash
:DATA
, 32 Bytes - hash of the parent block.relatedMbNum
:QUANTITY
- main block number when this oracle block was created.null
when its pending block.size
:QUANTITY
- size of the block.stateRoot
:DATA
, 32 Bytes - the root of the final state trie of the block.
Example
oracle_getBlockByNumber
Returns information about a oracle block, specified by the oracle block number.
Parameters
QUANTITY|TAG
- Integer of a block number, or the string"earliest"
,"pending"
or"latest"
Boolean
- Iftrue
it returns the full oracle objects, iffalse
only the hashes of the oracles.
Returns
See oracle_getBlockByHash
Example
sct_getContract
Return information about created contract by a transaction of SCT type.
Parameters
DATA
, 10 Bytes - SCT contract address.
Returns
Object
- information about the contract.
name
:DATA
- SCT name.symbol
:DATA
, 3 Bytes - SCT symbol.total
:DATA
- total Supply.type
:DATA
- SCT type.creator
:DATA
, 10 Bytes - contract creator's address.owner
:DATA
, 10 Bytes - contract owner's address.
It also returns if it is SCT40:
cpoint
:QUANTITY
- amount of coupon point.
Example
sct_getContractItem
Return information about coupon item in created contract by a transaction of SCT type.
Parameters
DATA
, 10 Bytes - SCT contract address.QUANTITY
- integer of the index position.
Returns
Object
-information about the contract item in that position.
state
:QUANTITY
- Item state(0:active 1: lock)type
:DATA
- Item type.name
:DATA
- Item name.value|usepoint
:QUANTITY
- value of item if SCT40, use amount of point.property
:DATA
- item property(unique)category
:DATA
, 10 Bytes - Item categorydescription
:DATA
, 10 Bytes - Item description
Example
sct_getContractAccount
Retrun balance or index of item depends on the contract type.
Parameters
DATA
, 10 Bytes - SCT contract address.DATA
, 10 Bytes - SymID.
Returns
QUANTITY
- either balance or index of item(It depends on the SCT type)
Example
sct_getAllowance
Retrun balance or index of item depends on the contract type.
Parameters
DATA
, 10 Bytes - SCT contract address.DATA
, 10 Bytes - owner SymID.DATA
, 10 Bytes - spender SymID.
Returns
QUANTITY
- either balance or index of item(It depends on the SCT type)
Example
sct_getContractItemsByCategory
Returns Item list which is created by SCT30 or 40.
Parameters
DATA
, 10 Bytes - SCT contract address.QUANTITY
- category or group number.
Returns
Array of Object
, N Bytes - Array of Item list
state
:QUANTITY
- state of item(0:active 1: lock)type
:DATA
- item type.name
:DATA
- item name(alias)value|usepoint
:QUANTITY
- value of item if SCT40, use amount of point.Index
:DATA
- unique key of internal item.couponNo
:DATA
- unique key of external item.groupNo
:DATA
- category of item.etc
:DATA
- extra description of item.
Example
sct_getVoteContract
sct_getVoteContract
returns given SCT50 Vote Contract's Information.
Parameters
VoteContractAddress
:DATA
- SCT50 Vote Contract AddressBlockNumber
:QUANTITY
- Last block number
Returns
party
:STRING
- Party Nameowner
:DATA
- Owner SymIdcreator
-DATA
- Creator SymIdtoken
:DATA
- SCT20 Token AddresspollCreators
:ARRAY
- registered poll creators listpolls
:ARRAY
- created polls list
Example
sct_getPollContract
sct_getPollContract
returns givens SCT51 Poll Contract's Information.
Parameters
PollContractAddress
:DATA
- SCT51 Poll Contract AddressBlockNumber
:QUANTITY
- Last block number
Returns
pollNumber
-QUANTITY
- Poll numbercategory
-QUANTITY
- Category for Agendaagenda
-STRING
- Adenda namedescription
-STRING
- Agenda descriptionstart
-QUANTITY
- Start UNIX timeend
-QUANTITY
- End UNIX timestate
-STRING
- Poll StatevotingPaper
-ARRAY
- Voting paper lists.VotingPaper
- {voter
,stake
,votes
,decision
}voteResult
-VoteResult
- Vote result.VoteResult
: {result
,resultCode
,agrees
,disagrees
,totalVoters
,votingRate
}voteContract
-ADDRESS
- SCT50 Vote Contract address.secretOption
-STRING
- secret optionstakeOption
-STRING
- stake optiontotalVoters
-QUANTITY
- the number of total votersquorum
-QUANTITY
- minimum rate of participants for the pollpassRate
-QUANTITY
- minimum rate of agree for the pollowner
-ADDRESS
- Owner SymIdcreator
-ADDRESS
- Creator SymId
Example
sct_getVoteResult
sct_getVoteResult
returns given SCT51 Poll Contract's vote result.
Parameters
PollContractAddress
:DATA
- SCT51 Poll Contract AddressBlockNumber
:QUANTITY
- Last block number
Returns
result
-QUANTITY
- final result code for the given pollcode
-QUANTITY
- extra result code for the given pollagrees
-QUANTITY
- total agrees for the given polldisagrees
-QUANTITY
- total disagrees for the given pollnullities
-QUANTITY
- total nullities for the given polltotalVoters
-QUANTITY
- total voters for the given pollvotingRate
-QUANTITY
- voting rate for the given poll
Example
sct_getVotingPaper
sct_getVotingPaper
returns given user's vote information in poll.
Parameters
PollContractAddress
:DATA
- SCT51 Poll Contract AddressSymId
:DATA
- SymId to request.BlockNumber
:QUANTITY
- Last block number
Returns
stake
:QUANTITY
- Staked balance in pollvotes
:QUANTITY
- Used stake for votingdecision
:STRING
- decision about poll
Example
Last updated