Links

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. 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. 1.
    DATA, 10 Bytes - address to check for balance.
  2. 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. 1.
    DATA, 10 Bytes - address.
  2. 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. 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. 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. 1.
    DATA, 10 Bytes - address.
  2. 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. 1.
    DATA, 10 Bytes - address.
  2. 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. 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. 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. 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. 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. 1.
    DATA, 32 Bytes - Hash of a block.
  2. 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. 1.
    QUANTITY|TAG - Integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.
  2. 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. 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. 1.
    DATA, 32 Bytes - hash of a block.
  2. 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. 1.
    QUANTITY|TAG - a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.
  2. 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. 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_getDeposit
Returns the deposit related information of the account of given address.
Parameters
  1. 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. 1.
    DATA, 10 Bytes - address to check for deposit related information
  2. 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. 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.