JSON RPC - Second-Earth/setchain GitHub Wiki
RPC interface
-
RPC HTTP default endpoint: http://localhost:8545
-
RPC interface list:
-
account
- account_accountIsExist
- account_getAccountByName
- account_getAccountExByName
- account_getAccountByID
- account_getAccountExByID
- account_getCode
- account_getNonce
- account_getAssetInfoByName
- account_getAssetInfoByID
- account_getAccountBalanceByID
- account_getAccountBalanceByTime
- account_getAssetAmountByTime
- account_getSnapshotLast
- account_getSnapshotTime
-
set
- set_sendRawTransaction
- set_getTransactionByHash
- set_getInternalTxByHash
- set_getTransactionReceipt
- set_getTxsByAccount
- set_getInternalTxByAccount
- set_getTxsByBloom
- set_getInternalTxByBloom
- set_getTransactions
- set_getCurrentBlock
- set_getBlockByHash
- set_getBlockByNumber
- set_getBlockAndResultByNumber
- set_getBadBlocks
- set_gasPrice
- set_call
- set_estimateGas
- set_getChainConfig
- set_newFilter
- set_getFilterChanges
- set_newPendingTransactionFilter
- set_newBlockFilter
- set_uninstallFilter
-
dpos
- dpos_info
- dpos_irreversible
- dpos_epoch
- dpos_prevEpoch
- dpos_nextEpoch
- dpos_votersByCandidate
- dpos_votersByVoter
- dpos_candidate
- dpos_candidates
- dpos_candidatesSize
- dpos_availableStake
- dpos_validCandidates
- dpos_nextValidCandidates
- dpos_getActivedCandidateSize
- dpos_getActivedCandidate
- dpos_snapShotTime
- dpos_snapShotStake
-
fee
-
account_accountIsExist
Returns whether the account exists.
Parameters
String- Name of the account.
Response
Boolean-truewhen exist, otherwisefalse.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_accountIsExist","params":["set.admin"],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
account_getAccountByName
Get account information by name.
Parameters
String- Name of the account.
Response
Object- A account object,oraccount not existif not found.accountName-Stringname of the account.founder-Stringfounder of the account.accountID- id of the account.number-Quantityblock number where this account was created.nonce-Quantityinteger of the number of transactions send from this account.code-Stringthe contract code from the given account.codeHash-Stringhash of the contract code,or0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470if not found.codeSize-Quantitysize of the contract.threshold-Quantitythreshold for account transfer transaction permissions.updateAuthorThreshold-Quantitythreshold for account update author transaction permissions.authorVersion-Quantitycurrent account author version.balances-Arrayall asset balances under the account.assetID-Quantityid of asset.balance-Quantitybalance of asset.
authors-Arrayall authors under the account.owner-Stringpublic key of owner.weight-Stringweight of owner.
suicide-Booleantruewhen account contract suicide, otherwisefalse.destroy-Booleantruewhen account destroy, otherwisefalse.description-Stringdescription of the account.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_getAccountByName","params":["set.admin"],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accountName": "set.admin",
"founder": "set.admin",
"accountID": 4098,
"number": 0,
"nonce": 0,
"code": "",
"codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"codeSize": 0,
"threshold": 1,
"updateAuthorThreshold": 1,
"authorVersion": "0xcef3cd8eb9a2c3253a5a21abd3991f19b9deb8eda8ac38ed0951a74d5318c652",
"balances": [
{
"assetID": 0,
"balance": 1e+29
}
],
"authors": [
{
"owner": "0x047db227d7094ce215c3a0f57e1bcc732551fe351f94249471934567e0f5dc1bf795962b8cccb87a2eb56b29fbe37d614e2f4c3c45b789ae4f1f51f4cb21972ffd",
"weight": 1
}
],
"suicide": false,
"destroy": false,
"description": ""
}
}
account_getAccountExByName
Get account information by name,but returns assets with a balance of zero.
Parameters
See account_getAccountByName parameters
Response
See account_getAccountByName response
Example
Does return assets with a balance of zero.
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"account_getAccountExByName","params":["qqqqqqqqqqq1"],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accountName": "qqqqqqqqqqq1",
"founder": "testtransfer",
"accountID": 4851,
"number": 2240000,
"nonce": 1,
"code": "",
"codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"codeSize": 0,
"threshold": 1,
"updateAuthorThreshold": 1,
"authorVersion": "0x3474dc77996a79b35fb54369417fc67fd5cd166149e215aeb55d11d8439717ea",
"balances": [
{
"assetID": 0,
"balance": 99976000000000
},
{
"assetID": 1,
"balance": 0 // balance of 0
}
],
"authors": [
{
"owner": "0x04ec2b0a4d34661ab1466a451f9f57d49a6f8befe86d70f333229e16ee1760bb6b1c7401cd1d5a50f2b73794fc89dbfab4468fd767bd69382ef603255f0fb4f429",
"weight": 1
}
],
"suicide": false,
"destroy": false,
"description": ""
}
}
account_getAccountByID
Get account information by ID.
Parameters
Quantity- ID of the account.
Response
See account_getAccountByName response.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"account_getAccountExByID","params":[4851],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accountName": "qqqqqqqqqqq1",
"founder": "testtransfer",
"accountID": 4851,
"number": 2240000,
"nonce": 1,
"code": "",
"codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"codeSize": 0,
"threshold": 1,
"updateAuthorThreshold": 1,
"authorVersion": "0x3474dc77996a79b35fb54369417fc67fd5cd166149e215aeb55d11d8439717ea",
"balances": [
{
"assetID": 0,
"balance": 99976000000000
}
],
"authors": [
{
"owner": "0x04ec2b0a4d34661ab1466a451f9f57d49a6f8befe86d70f333229e16ee1760bb6b1c7401cd1d5a50f2b73794fc89dbfab4468fd767bd69382ef603255f0fb4f429",
"weight": 1
}
],
"suicide": false,
"destroy": false,
"description": ""
}
}
account_getAccountExByID
Get account information by ID,but returns assets with a balance of zero.
Parameters
See account_getAccountByID parameters
Response
See account_getAccountByName response
Example
Does return assets with a balance of zero.
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"account_getAccountByID","params":[4851],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accountName": "qqqqqqqqqqq1",
"founder": "testtransfer",
"accountID": 4851,
"number": 2240000,
"nonce": 1,
"code": "",
"codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"codeSize": 0,
"threshold": 1,
"updateAuthorThreshold": 1,
"authorVersion": "0x3474dc77996a79b35fb54369417fc67fd5cd166149e215aeb55d11d8439717ea",
"balances": [
{
"assetID": 0,
"balance": 99976000000000
},
{
"assetID": 1,
"balance": 0 // balance of 0
}
],
"authors": [
{
"owner": "0x04ec2b0a4d34661ab1466a451f9f57d49a6f8befe86d70f333229e16ee1760bb6b1c7401cd1d5a50f2b73794fc89dbfab4468fd767bd69382ef603255f0fb4f429",
"weight": 1
}
],
"suicide": false,
"destroy": false,
"description": ""
}
}
account_getCode
Returns contract code by account name
Parameters
String- Name of the account.
Response
String- the code from the given address,orcode is emptyif not found.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_getCode","params":["tcontract1"],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x900463ffff......"
}
account_getNonce
Returns nonce by account name
Parameters
String- Name of the account.
Response
Quantity- integer of the number of transactions send from this account.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_getNonce","params":["testtransfer"],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 598
}
account_getAssetInfoByName
Get asset information by asset name.
Parameters
String- name of the asset.
Response
Object- A asset object,asset not existif not foundassetId-Quantityid of the asset.number-Quantityblock number where this asset was created.stats-Quantitynumber of holders。assetName-Stringname of the asset.symbol-Stringsymbol of asset.amount-Quantitytotal currency amount of asset.decimals-Quantityminimum unit of asset.founder-Stringwho created the asset.owner-Stringwho owns all permissions to the asset.addIssue-Quantitytotal amount of issuance.upperLimit-Quantitymaximum number of additional issues.contract-Stringagreement asset contract.description-Stringdescription of the asset.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_getAssetInfoByName","params":["settoken"],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"assetId": 0,
"number": 0,
"stats": 591,
"assetName": "settoken",
"symbol": "set",
"amount": 10000000000000000000000000000,
"decimals": 18,
"founder": "set.founder",
"owner": "set.founder",
"addIssue": 10000000000000000000000000000,
"upperLimit": 10000000000000000000000000000,
"contract": "",
"description": ""
}
}
account_getAssetInfoByID
Get asset information by asset ID.
Parameters
Quantity- id of the asset.
Response
See account_getAssetInfoByName reponse.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_getAssetInfoByID","params":[0],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"assetId": 0,
"number": 0,
"stats": 591,
"assetName": "settoken",
"symbol": "set",
"amount": 10000000000000000000000000000,
"decimals": 18,
"founder": "set.founder",
"owner": "set.founder",
"addIssue": 10000000000000000000000000000,
"upperLimit": 10000000000000000000000000000,
"contract": "",
"description": ""
}
}
account_getAccountBalanceByID
Get account balance by account name and asset id.
Parameters
String- Name of the account.Quantity- id of the asset.Quantity-0calculate parent assets, or1calculate parent and child assets.
Response
Quantity- account current balance.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_getAccountBalanceByID","params":["qqqqqqqqqqq1", 0, 1],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 99976000000000
}
account_getAccountBalanceByTime
Get balance by account name and snapshot time.
Parameters
String- name of the account.Quantity- id of the asset.Quantity-0calculate parent assets, or1calculate parent and child assets.Quantity- snapshot timestamp.
Response
Quantity- account current balance.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_getAccountBalanceByTime","params":["ftsystemio", 0, 0, 1546054908000000000],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 1566550800000000000
}
account_getAssetAmountByTime
Get the total currency amount of a asset.
Parameters
Quantity- id of the asset.Quantity- snapshot timestamp.
Response
Quantity- account current currency amount.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_getAssetAmountByTime","params":[1,1552977600000000000],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 59285719
}
account_getSnapshotLast
Get the last SnapshotLast.
Parameters
No args
Response
Quantity- snapshot timestamp.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"account_getSnapshotLast","params":[],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 1566550800000000000
}
account_getSnapshotTime
Get previous or next snapshot timestamp by current timestamp.
Parameters
Quantity-0returns the last snapshot timestamp,1returns the previous snapshot timestamp,or2returns the next snapshot timestamp.Quantity- timestamp
Response
Quantity- snapshot timestamp.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"account_getSnapshotTime","params":[1,1546054910000000000],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 1566550800000000000
}
set_sendRawTransaction
Creates new message call transaction for signed transactions.
Parameters
String- The signed transaction data.
Response
String- the transaction hash, or the zero hash if the transaction is not yet available.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_sendRawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],"id":1}' http://localhost:8545
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
set_getTransactionByHash
Returns the information about a transaction requested by transaction hash.
Parameters
String- hash of the transaction
Response
ObjectA transaction object, ornullwhen no transaction was found.blockHash-Stringhash of the block where this transaction was in.nullwhen its pending.blockNumber-Quantityblock number where this transaction was in.0when its pending.txHash-Stringhash of the transaction.transactionIndex-Quantityinteger of the transaction's index position in the block.0when its pending.actions-Arraylist of action.type-Quantitytype of action.nonce-Quantitythe number of actions made by the sender prior to this one.from-Stringaccount name of the sender.to-Stringaccount name of the sender.assetID-Quantitywhich asset to transfer.gas-Quantitygas provided by the sender.value-Quantityvalue transferred.remark-Stringthe data of extra context.payload-Stringthe data send along with the action.actionHash-Stringhash of the action.actionIndex-Quantityinteger of the action's index position in the transaction.
gasAssetID-Quantitywhich asset to pay gas.gasPrice-Quantitygas price provided by the sender.gasCost-Quantitythe number of transaction gas cost.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"set_getTransactionByHash","params":["0xeb701c7159e270f3ae9f209951ded94896ced101a0bb9c6b40729e3d57d1067b"],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x8f0964a37ca83d9bb69fb2a6f4ad0c394d75d045dbd954435cea2ba645d679bd",
"blockNumber": 2349339,
"txHash": "0xeb701c7159e270f3ae9f209951ded94896ced101a0bb9c6b40729e3d57d1067b",
"transactionIndex": 1,
"actions": [
{
"type": 517,
"nonce": 1617077,
"from": "alexander",
"to": "nicholas",
"assetID": 0,
"gas": 1100000,
"value": 1000000000000000,
"remark": "0x68656c6c6f206e6963686f6c6173207e",
"payload": "0x",
"actionHash": "0x1bb321a0afe65eed2ed7698ffd94bfd2c559a9c4494ebce4c648bdc379750d7c",
"actionIndex": 0
}
],
"gasAssetID": 0,
"gasPrice": 1000000000,
"gasCost": 1100000000000000
}
}
set_getInternalTxByHash
Returns the information about a internal transaction requested by transaction hash.
Note: That the internal transaction is available for use flag --contractlog=true.
Parameters
String- hash of the transaction
Response
Object- A internal transaction object, ornullwhen no internal transaction was found.txHash-Stringhash of the transaction.actions-Arraylist of action.internalActions-Arraylist of internal action.action-Objecta internal action object,ornullwhen no internal action was found.type-Quantitytype of action.nonce-Quantitythe number of actions made by the sender prior to this one.from-Stringaccount name of the sender.to-Stringaccount name of the sender.assetID-Quantitywhich asset to transfer.gas-Quantitygas provided by the sender.value-Quantityvalue transferred.remark-Stringthe data of extra context.payload-Stringthe data send along with the action.actionHash-Stringhash of the action.actionIndex-Quantityinteger of the action's index position in the transaction.
actionType-Quantitytype of internal action.gasAssetID-Quantitywhich asset to pay gas.gasPrice-Quantitygas price provided by the sender.error-Quantityerror of internal action.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getInternalTxByHash","params":["0x3b8d4a177058d16fe2324cd3c442da723470fff1889c563a27555c9cb5f14adb"],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"txhash": "0x3b8d4a177058d16fe2324cd3c442da723470fff1889c563a27555c9cb5f14adb",
"actions": [
{
"internalActions": [
{
"action": {
"type": 0,
"nonce": 0,
"from": "tcontract5",
"to": "tcontract5",
"assetID": 0,
"gas": 0,
"value": 100000000000000,
"remark": "0x",
"payload": "0x",
"actionHash": "0x95057f1c7cdd23eb1a9cef122f6cdd90d87527469d7417212784fd10b3790e95",
"actionIndex": 0
},
"actionType": "transferex",
"gasUsed": 0,
"gasLimit": 0,
"depth": 1,
"error": ""
}
]
}
]
}
}
set_getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
Note: That the receipt is not available for pending transactions.
Parameters
String- hash of the transaction
Response
Object-A receipt object, ornullwhen no receipt was found.blockHash-Stringhash of the block where this transaction was in.blockNumber-Quantityblock number where this transaction was in.txHash-Stringhash of the transaction.transactionIndex-Quantityinteger of the transaction's index position in the block.postState-Stringpost transaction state root.actionResults-Arrayresults of action.actionType-Quantitytype of action.status-Quantityeither 1 (success) or 0 (failure).index-Quantityinteger of the action's index position in the transaction.gasUsed-Quantitythe amount of gas used by this specific action alone.gasAllot-Arrayinformation of gas allot.name-Stringname of account.gas-Quantityinteger of gas reward.typeId-Quantity0transfer fee ,1contract ,2block reward.
error-Stringerror of action.
cumulativeGasUsed-Quantitythe total amount of gas used when this transaction was executed in the block.totalGasUsed-Quantitythe amount of gas used by this specific transaction alone.logsBloom-Stringbloom filter for light clients to quickly retrieve related logs.logs-Arrayarray of log objects, which this transaction generated,name-Stringname from which this log originated.topics-Arraydata of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event.)data-Stringcontains the non-indexed arguments of the log.blockNumber-Quantityblock number where this log was in.blockHash-Stringhash of the block where this log was in.transactionHash-Stringhash of the transaction where this log was in.logIndex-Quantityinteger of the log's index position in the action.actionIndex-Quantityinteger of the action's index position in the transaction.transactionIndex-Quantityinteger of the transaction's index position in the block.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"set_getTransactionReceipt","params":["0x01c746c5a181088c14e7e6f43739d0dc3db423f6b2cfa102d4549f338514a804"],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc":"2.0",
"id":1,
"result":{
"blockHash":"0x5b033934948e94221cb14700107031d033a55797d24397d62edf04a35e43273e",
"blockNumber":512352,
"txHash":"0x01c746c5a181088c14e7e6f43739d0dc3db423f6b2cfa102d4549f338514a804",
"transactionIndex":30,
"postState":"0xecd76a303d72ab65ca8d6708e4c473d02b41d4315ef487780ff79424c4cd40be",
"actionResults":[
{
"actionType":0,
"status":1,
"index":0,
"gasUsed":342999,
"gasAllot":[
{
"name":"testtesttest41",
"gas":171562,
"typeId":1
},
{
"name":"testtesttest1001",
"gas":88437,
"typeId":1
},
{
"name":"testtesttest13",
"gas":68600,
"typeId":2
},
{
"name":"testtesttest45:a1744",
"gas":14400,
"typeId":0
}
],
"error":""
}
],
"cumulativeGasUsed":10632969,
"totalGasUsed":342999,
"logsBloom":"0x00000000000080000000000000000000000200000000100000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs":[
{
"name":"testtesttest1001",
"topics":[
"0xe4ea926e8921624f76e136a0feb603b4cf0fa652df5b3752c00cc24f711b3f57"
],
"data":"0x00000000000000000000000000000000000000000000000015bb067628b1600000000000000000000000000000000000000000000000000000000000000006d60000000000000000000000000000000000000000000000056bc75e2d6310000000000000000000000000000000000000000000000000043116cf411ae8ea569000000000000000000000000000000000000000001ffd168b615cf58e2c000000",
"blockNumber":512352,
"blockHash":"0x5b033934948e94221cb14700107031d033a55797d24397d62edf04a35e43273e",
"transactionHash":"0x01c746c5a181088c14e7e6f43739d0dc3db423f6b2cfa102d4549f338514a804",
"logIndex":30,
"actionIndex":0,
"transactionIndex":30
}
]
}
}
set_getTxsByAccount
Returns an array of transaction hashes matching a given account in range of blocks.
Parameters
String- name of the account.Quantity- integer of the block start search.Quantity- integer of backward blocks.
Response
Object-A hashes object.tx-Arraylist of transaction hash.hash-Stringhash of transaction.height-Quantityblock number where this transaction was in.
irreversibleBlockHeight-Quantitydpos irreversible block number.endHeight-Quantityend block number.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getTxsByAccount","params":["walletservice.u9","2351865",1048],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"txs": [
{
"hash": "0x33983ebaf2387850fd26637198a1cb29462a82853f42c045e24d86b09e67a293",
"height": 2351865
}
],
"irreversibleBlockHeight": 2356865,
"endHeight": 2351993
}
}
set_getInternalTxByAccount
Returns an array of internal transaction matching a given account in range of blocks.
Note: That the internal transaction is available for use flag --contractlog=true.
Parameters
String- name of the account.Quantity- integer of the block start search.Quantity- integer of forward blocks.
Response
-
Array- array of internal actions- see set_getInternalTxByHash response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getInternalTxByAccount","params":["tcontract5",14563,10],"id":1}' http://localhost:8545
// Result
{
"jsonrpc":"2.0",
"id":1,
"result":[
{
"txhash":"0x3b8d4a177058d16fe2324cd3c442da723470fff1889c563a27555c9cb5f14adb",
"actions":[
{
"internalActions":[
{
"action":{
"type":0,
"nonce":0,
"from":"tcontract5",
"to":"tcontract5",
"assetID":0,
"gas":0,
"value":100000000000000,
"remark":"0x",
"payload":"0x",
"actionHash":"0x95057f1c7cdd23eb1a9cef122f6cdd90d87527469d7417212784fd10b3790e95",
"actionIndex":0
},
"actionType":"transferex",
"gasUsed":0,
"gasLimit":0,
"depth":1,
"error":""
}
]
}
]
}
]
}
set_getTxsByBloom
Returns an array of transaction hashes matching a given bloom in range of blocks.
Parameters
String- bloom hex string.Quantity- integer of the block start search.Quantity- integer of backward blocks.
Response
See set_getTxsByAccount parameters
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getTxsByBloom","params":["0x013...",14563,10],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"txs": [
{
"hash": "0x33983ebaf2387850fd26637198a1cb29462a82853f42c045e24d86b09e67a293",
"height": 2351865
}
],
"irreversibleBlockHeight": 2356865,
"endHeight": 2351993
}
}
set_getInternalTxByBloom
Returns an array of internal transaction matching a given bloom in range of blocks.
Note: That the internal transaction is available for use flag --contractlog=true.
Parameters
String- bloom hex string.Quantity- integer of the block start search.Quantity- integer of forward blocks.
Response
-
Array- array of internal actions- see set_getInternalTxByHash response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getInternalTxByBloom","params":["0x013...",10,5],"id":1}' http://localhost:8545
// Result
{
"jsonrpc":"2.0",
"id":1,
"result":[
{
"txhash":"0x3b8d4a177058d16fe2324cd3c442da723470fff1889c563a27555c9cb5f14adb",
"actions":[
{
"internalActions":[
{
"action":{
"type":0,
"nonce":0,
"from":"tcontract5",
"to":"tcontract5",
"assetID":0,
"gas":0,
"value":100000000000000,
"remark":"0x",
"payload":"0x",
"actionHash":"0x95057f1c7cdd23eb1a9cef122f6cdd90d87527469d7417212784fd10b3790e95",
"actionIndex":0
},
"actionType":"transferex",
"gasUsed":0,
"gasLimit":0,
"depth":1,
"error":""
}
]
}
]
}
]
}
set_getTransactions
Returns transactions by hashes.
Parameters
Array- list of transaction hash,maximum 2048.
Response
Array- list of transaction
Example
// Request
curl -X POST -H "Content-Type: application/json" -d `{"jsonrpc":"2.0","method":"set_getTransactions","params":[["0x068f322f62edf4686c65060ce2d7c78d1404f391950e4ea93588d9d4cf4f8724",
"0x82f7482c529e05909792911911656cd9b52ccc35d1a2d3d93130fac960dd2b48"]],"id":1}` http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"blockHash": "0x8826a262034ea5adcdc07b802999d759e80c64d4fcfa465ecc3cb5cd36b46cc3",
"blockNumber": 2359076,
"txHash": "0x068f322f62edf4686c65060ce2d7c78d1404f391950e4ea93588d9d4cf4f8724",
"transactionIndex": 0,
"actions": [
{
"type": 517,
"nonce": 1626507,
"from": "nicholas",
"to": "alexander",
"assetID": 0,
"gas": 1100000,
"value": 1000000000000000,
"remark": "0x68656c6c6f20616c6578616e646572207e",
"payload": "0x",
"actionHash": "0xa10ee0ddd109c9e9f779642028c7e0d46d152d7868dacb9872941f871f03954a",
"actionIndex": 0
}
],
"gasAssetID": 0,
"gasPrice": 1000000000,
"gasCost": 1100000000000000
},
{
"blockHash": "0x8826a262034ea5adcdc07b802999d759e80c64d4fcfa465ecc3cb5cd36b46cc3",
"blockNumber": 2359076,
"txHash": "0x82f7482c529e05909792911911656cd9b52ccc35d1a2d3d93130fac960dd2b48",
"transactionIndex": 1,
"actions": [
{
"type": 517,
"nonce": 1625267,
"from": "alexander",
"to": "nicholas",
"assetID": 0,
"gas": 1100000,
"value": 1000000000000000,
"remark": "0x68656c6c6f206e6963686f6c6173207e",
"payload": "0x",
"actionHash": "0xe3295a7ffaa3812c2445ea9bbce71a4d1d84593aba2edeae8c0d8de5a2d73b97",
"actionIndex": 0
}
],
"gasAssetID": 0,
"gasPrice": 1000000000,
"gasCost": 1100000000000000
}
]
}
set_getCurrentBlock
Returns information about the last block.
Parameters
Boolean- Iftrueit returns the full transaction objects, iffalseonly the hashes of the transactions.
Response
ObjectA block object.difficulty-Quantityinteger of the difficulty for this block.extraData-Stringtheextra datafield of this block.forkID-Objecta fock object.cur-Quantitycurrent fork id.next-Quantitynext
gasLimit-Quantitythe maximum gas allowed in this block.gasUsed-Quantitythe total used gas by all transactions in this block.hash-Stringhash of block.logsBloom-Stringthe bloom filter for the logs of the block.miner-Stringthe name of the beneficiary to whom the mining rewards were given.number-Quantitythe block number.parentHash-Stringhash of the parent block.proposedIrreversible-Quantityirreversible block number.receiptsRoot-Stringthe root of the receipts trie of the block.size-Quantityinteger the size of this block in bytes.stateRoot-Stringthe root of the transaction trie of the block.timestamp-Quantitythe unix timestamp for when the block was collated.totalDifficulty-Quantityinteger of the total difficulty of the chain until this block.transactions-ArrayArray of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.transactionsRoot-Stringthe root of the transaction trie of the block.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getCurrentBlock","params":[true],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": 2399545,
"extraData": "0x73797374656d6ae7eb673de85c31d44fd4c50ae05baa453ac33207f07067442097fc068c37e554d1a42e5765eadae4a6070e8685ccbe9be21391eb388475487112219419991800",
"forkID": {
"cur": 3,
"next": 3
},
"gasLimit": 30000000,
"gasUsed": 202244,
"hash": "0x8826a262034ea5adcdc07b802999d759e80c64d4fcfa465ecc3cb5cd36b46cc3",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "vanessaconnie",
"number": 2359076,
"parentHash": "0x149ac9d8ca31671243cc471ee1830a59ad9bb0a8c5090fca4aba073cea98ee03",
"proposedIrreversible": 2358991,
"receiptsRoot": "0xb8468af0562104b0fa7f64ea3bfe0e195fe8f538efe4610d16e6e77cfd8c7e2d",
"size": 813,
"stateRoot": "0x83da82455c0cf63b3ac815a708efc5b6cb0d2af8ba6acbfd0494b6714ca42ac7",
"timestamp": 1566819432000000000,
"totalDifficulty": 2872716285712,
"transactions": [
"0x068f322f62edf4686c65060ce2d7c78d1404f391950e4ea93588d9d4cf4f8724",
"0x82f7482c529e05909792911911656cd9b52ccc35d1a2d3d93130fac960dd2b48"
],
"transactionsRoot": "0xc2a6e70010fedf16349719f0e246365ba41b951f7a8ee0218d9fa050434c4573"
}
}
set_getBlockByHash
Returns information about a block by hash.
Parameters
-
String- hash of the block. -
Boolean- Iftrueit returns the full transaction objects, iffalseonly the hashes of the transactions.
Response
See set_getCurrentBlock response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getBlockByHash","params":["0x8826a262034ea5adcdc07b802999d759e80c64d4fcfa465ecc3cb5cd36b46cc3", true],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": 2399545,
"extraData": "0x73797374656d6ae7eb673de85c31d44fd4c50ae05baa453ac33207f07067442097fc068c37e554d1a42e5765eadae4a6070e8685ccbe9be21391eb388475487112219419991800",
"forkID": {
"cur": 3,
"next": 3
},
"gasLimit": 30000000,
"gasUsed": 202244,
"hash": "0x8826a262034ea5adcdc07b802999d759e80c64d4fcfa465ecc3cb5cd36b46cc3",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "vanessaconnie",
"number": 2359076,
"parentHash": "0x149ac9d8ca31671243cc471ee1830a59ad9bb0a8c5090fca4aba073cea98ee03",
"proposedIrreversible": 2358991,
"receiptsRoot": "0xb8468af0562104b0fa7f64ea3bfe0e195fe8f538efe4610d16e6e77cfd8c7e2d",
"size": 813,
"stateRoot": "0x83da82455c0cf63b3ac815a708efc5b6cb0d2af8ba6acbfd0494b6714ca42ac7",
"timestamp": 1566819432000000000,
"totalDifficulty": 2872716285712,
"transactions": [
"0x068f322f62edf4686c65060ce2d7c78d1404f391950e4ea93588d9d4cf4f8724",
"0x82f7482c529e05909792911911656cd9b52ccc35d1a2d3d93130fac960dd2b48"
],
"transactionsRoot": "0xc2a6e70010fedf16349719f0e246365ba41b951f7a8ee0218d9fa050434c4573"
}
}
set_getBlockByNumber
Returns information about a block by number.
Parameters
-
Quantity- number of the block. -
Boolean- Iftrueit returns the full transaction objects, iffalseonly the hashes of the transactions.
Response
See set_getCurrentBlock response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getBlockByNumber","params":[2359076, false],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": 2399545,
"extraData": "0x73797374656d6ae7eb673de85c31d44fd4c50ae05baa453ac33207f07067442097fc068c37e554d1a42e5765eadae4a6070e8685ccbe9be21391eb388475487112219419991800",
"forkID": {
"cur": 3,
"next": 3
},
"gasLimit": 30000000,
"gasUsed": 202244,
"hash": "0x8826a262034ea5adcdc07b802999d759e80c64d4fcfa465ecc3cb5cd36b46cc3",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "vanessaconnie",
"number": 2359076,
"parentHash": "0x149ac9d8ca31671243cc471ee1830a59ad9bb0a8c5090fca4aba073cea98ee03",
"proposedIrreversible": 2358991,
"receiptsRoot": "0xb8468af0562104b0fa7f64ea3bfe0e195fe8f538efe4610d16e6e77cfd8c7e2d",
"size": 813,
"stateRoot": "0x83da82455c0cf63b3ac815a708efc5b6cb0d2af8ba6acbfd0494b6714ca42ac7",
"timestamp": 1566819432000000000,
"totalDifficulty": 2872716285712,
"transactions": [
"0x068f322f62edf4686c65060ce2d7c78d1404f391950e4ea93588d9d4cf4f8724",
"0x82f7482c529e05909792911911656cd9b52ccc35d1a2d3d93130fac960dd2b48"
],
"transactionsRoot": "0xc2a6e70010fedf16349719f0e246365ba41b951f7a8ee0218d9fa050434c4573"
}
}
set_getBlockAndResultByNumber
Returns information about a block and receipts and internal transaction by number.
Parameters
Quantity- number of the block.
Response
Object- a object contain block, transaction, receipts,internal transaction.blocksee set_getCurrentBlock responsetransactionsee set_getTransactionByHash responsereceiptssee set_getTransactionReceipt responseinternal transactionsee set_getInternalTxByHash response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"set_getBlockAndResultByNumber","params":["14563"],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"block": {
"difficulty": 51848,
"extraData": "0x73797374656d92b346a6fe5253d666ef8813b5a8e7991c46cfc8c29fe50d2b81416f03718d6443665ae174855a7a5966668b608db4389d8b07600b3b09411e6fc78805e166f900",
"forkID": {
"cur": 0,
"next": 0
},
"gasLimit": 30000000,
"gasUsed": 211180,
"hash": "0x4529b9c8faf0723e3889a3bfabfc0e86c5365ab076283286ba192b814f826ef6",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "set.founder",
"number": 14563,
"parentHash": "0x4a920a85cb113474edab5b06246c3dda6f3311309636239861f782bfae597e5a",
"proposedIrreversible": 14562,
"receiptsRoot": "0xdcdb947919c79275673912d2f37f74b851aa79ef646d40b15865b3767ce37d2a",
"size": 742,
"stateRoot": "0x102f61ad25684178fcca6a63f91ab130d5656fba6d46471f1e0b7f573cd08743",
"timestamp": 1559776341000000000,
"totalDifficulty": 649029222,
"transactions": [
{
"blockHash": "0x4529b9c8faf0723e3889a3bfabfc0e86c5365ab076283286ba192b814f826ef6",
"blockNumber": 14563,
"txHash": "0x3b8d4a177058d16fe2324cd3c442da723470fff1889c563a27555c9cb5f14adb",
"transactionIndex": 0,
"actions": [
{
"type": 0,
"nonce": 69,
"from": "tcontract5",
"to": "tcontract5",
"assetID": 0,
"gas": 20000000,
"value": 0,
"remark": "0x",
"payload": "0x68669bc8000000000000000000000000000000000000000000000000000000000000103e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005af3107a4000",
"actionHash": "0x37db3c063984b5dc8ece446b1a74ea328099a66901124abd45ffada61b27b9f4",
"actionIndex": 0
}
],
"gasAssetID": 0,
"gasPrice": 10000000000,
"gasCost": 200000000000000000
}
],
"transactionsRoot": "0xf3dbde4ef4f96e3befd7c1fbbb31c19db0d0680f746bfc187f29d60247feadff"
},
"receipts": [
{
"PostState": "EC9hrSVoQXj8ympj+RqxMNVlb7ptRkcfHgt/VzzQh0M=",
"ActionResults": [
{
"Status": 1,
"Index": 0,
"GasUsed": 211180,
"GasAllot": [
{
"name": "settoken",
"gas": 7200,
"typeId": 0
},
{
"name": "tcontract5",
"gas": 161743,
"typeId": 1
},
{
"name": "set.founder",
"gas": 42237,
"typeId": 2
}
],
"Error": ""
}
],
"CumulativeGasUsed": 211180,
"Bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"Logs": [],
"TxHash": "0x3b8d4a177058d16fe2324cd3c442da723470fff1889c563a27555c9cb5f14adb",
"TotalGasUsed": 211180
}
],
"detailTxs": [
{
"txhash": "0x3b8d4a177058d16fe2324cd3c442da723470fff1889c563a27555c9cb5f14adb",
"actions": [
{
"internalActions": [
{
"action": {
"type": 0,
"nonce": 0,
"from": "tcontract5",
"to": "tcontract5",
"assetID": 0,
"gas": 0,
"value": 100000000000000,
"remark": "0x",
"payload": "0x",
"actionHash": "0x95057f1c7cdd23eb1a9cef122f6cdd90d87527469d7417212784fd10b3790e95",
"actionIndex": 0
},
"actionType": "transferex",
"gasUsed": 0,
"gasLimit": 0,
"depth": 1,
"error": ""
}
]
}
]
}
]
}
}
set_getBadBlocks
Returns dose not insert blockchain blocks.
Parameters
Boolean- Iftrueit returns the full transaction objects, iffalseonly the hashes of the transactions.
Response
Array- list of blocks, ornullif not found.block- see set_getCurrentBlock response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"set_getBadBlocks","params":[true],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"difficulty": 51970,
"extraData": "0x73797374656daa789d465a5b636c6d0bb4707f18ab98c31f6e578d25d118c8311a739daa8f9e0a45192161542118a6a35f0983a9716678d0a33a7c29ac027800f17ecec1b2dd00",
"forkID": {
"cur": 0,
"next": 0
},
"gasLimit": 30000000,
"gasUsed": 0,
"hash": "0x162e2d1d9fc5a2bf31955712aa7f6e7d9054b85dd8e75ee72a6ce798f98845b4",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "set.founder",
"number": 14685,
"parentHash": "0x83587a8469365c9de64c74e46a2588bc323c58a83ad7021c3a5743610e06150e",
"proposedIrreversible": 14684,
"receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"size": 514,
"stateRoot": "0xd54de90b55e5b3f628dc32843a502e93489701edb166a09b8415e7142de61acd",
"timestamp": 1559776707000000000,
"totalDifficulty": 655362181,
"transactions": [],
"transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
]
}
set_gasPrice
Returns the current price per gas.
Parameters None
Response
Quantity - integer of the current gas price.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"set_gasPrice","params":[],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 1011103930
}
set_call
Executes a new message call immediately without creating a transaction on the block chain.
Parameters
Object- The transaction call objectactionType-Quantitytype of transaction.from-Stringname of sender account.to-Stringname of receipt account.assetId-Quantityid of used asset.gas-Quantityinteger of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.gasPrice-Quantityinteger of the gasPrice used for each paid gas.value-Quantityinteger of the value sent with this transaction.data-Stringhash of the method signature and encoded parameters.remark-Stringextra data with this transaction. -Quantity- height of the block, or string valuelatestorearliest.
Response
String - the return value of executed contract.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"2.0","method":"set_call","params":[{"actionType":0,"from":"testtest3","to":"testtest1","assetId":0,"gas":2000000,"gasPrice":1,"value":0,"data":"0x51c8c3f100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000001009"},"latest"]}' http://localhost:8545
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0x"
}
set_estimateGas
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
Parameters
See set_call parameters
Response
Quantity- the amount of gas used.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d `{"jsonrpc":"2.0","method":"set_estimateGas","params":[{"from":"tcontract5","to":"tcontract5","data":"","assetId":1,"actionType":517,"gas":20000000,"gasPrice":1,"value":0,"remark":"0x46620e39"}],"id":1}` http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": "20000000"
}
set_getChainConfig
Returns information of blockchain config.
Parameters
None
Response
Object- A blockchain config object.
See chain config
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getChainConfig","params":[],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"bootnodes": [
"fnode://7f06dd5bf47453e153272ff32e45c110c050ae43481e0b684cb7aac240bfeb80c92592b3afc133fcdb37a16356cb5d0ded5ff973fbb0dc8d6dda9962da1ba861@boot.t.set.com:30000",
"fnode://cb49ad1ea7fd8e351603404394eb568a0c163195be4faf5730d609bf939fefb2105dec9e54828ade3623a92614c9d8a14a98030d2d2b7edd63896b36c6a42a5f@boot.t.set.com:30001"
],
"chainId": 100,
"chainName": "set",
"chainUrl": "https://scan.setcoin.net",
"accountParams": {
"level": 3,
"alllength": 31,
"mainminlength": 7,
"mainmaxlength": 16,
"subminLength": 2,
"submaxLength": 16
},
"assetParams": {
"level": 3,
"alllength": 31,
"mainminlength": 2,
"mainmaxlength": 16,
"subminLength": 1,
"submaxLength": 8
},
"chargeParams": {
"assetRatio": 80,
"contractRatio": 80
},
"upgradeParams": {
"blockCnt": 10000,
"upgradeRatio": 80
},
"dposParams": {
"maxURLLen": 512,
"unitStake": 1,
"candidateAvailableMinQuantity": 3000000,
"candidateMinQuantity": 500000,
"voterMinQuantity": 1,
"activatedMinCandidate": 28,
"activatedMinQuantity": 1350000000,
"blockInterval": 3000,
"blockFrequency": 6,
"candidateScheduleSize": 21,
"backupScheduleSize": 7,
"epochInterval": 604800000,
"freezeEpochSize": 2,
"extraBlockReward": 0,
"blockReward": 0
},
"systemName": "set.founder",
"accountName": "set.account",
"assetName": "set.asset",
"dposName": "set.dpos",
"snapshotInterval": 3600000,
"feeName": "set.fee",
"systemToken": "settoken",
"sysTokenID": 0,
"sysTokenDecimal": 18,
"referenceTime": 1559620800000000000
}
}
set_newFilter
Creates a filter - Object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call set_getFilterChanges
A note on specifying topic filters:
Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters:
[]"anything"[A]"A in first position (and anything after)"[null, B]"anything in first position AND B in second position (and anything after)"[A, B]"A in first position AND B in second position (and anything after)"[A, B], [A, B](/Second-Earth/setchain/wiki/A,-B],-[A,-B)"(A OR B) in first position AND (A OR B) in second position (and anything after)"
Parameters
accounts:Data|Array, account name - (optional) Contract name or a list of accounts from which logs should originate.topics:Array of Data, - (optional) Array of 32 BytesDATAtopics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options.
Response
Quantity- A filter id
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_newFilter","params":[{"accounts":["set.founder"],"topics":["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"]}],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xfce5a886e3550604059a5f3e404f8767"
}
set_getFilterChanges
Polling method for a filter, which returns an array of logs or hashes which occurred since last poll
A note on specifying topic filters:
Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters:
[]"anything"[A]"A in first position (and anything after)"[null, B]"anything in first position AND B in second position (and anything after)"[A, B]"A in first position AND B in second position (and anything after)"[A, B], [A, B](/Second-Earth/setchain/wiki/A,-B],-[A,-B)"(A OR B) in first position AND (A OR B) in second position (and anything after)"
Parameters
Quantity- A filter id
Response
- For filters created with
set_newBlockFilterthe return are block hashes (DATA, 32 Bytes), e.g.["0x3454645634534..."]. - For filters created with
set_newPendingTransactionFilterthe return are transaction hashes (DATA, 32 Bytes), e.g.["0x6345343454645..."]. - For filters created with
set_newFilterlogs are -Objects with following params:index:Quantity- integer of the log index position in the block.txIndex:Quantity- integer of the transactions index position log was created from.actionIndex:Quantity- integer of the action index position log was created from.txHash:DATA, 32 Bytes - hash of the transactions this log was created from.blockHash:DATA, 32 Bytes - hash of the block where this log was in.nullwhen its pending.blockNumber:Quantity- the block number where this log was in.nullwhen its pending.name:DATA, account - account from which this log originated.data:DATA- contains the non-indexed arguments of the log.topics:Array of DATA- Array of 0 to 4 32 BytesDATAof indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g.Deposit(address,bytes32,uint256)), except you declared the event with theanonymousspecifier.)
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_getFilterChanges","params":["0xfce5a886e3550604059a5f3e404f8767"],"id":1}' http://localhost:8545
// Result
{
"jsonrpc":"2.0",
"id":1,
"result":[
{
"name":"contracta4",
"topics":[
"0x6f72646572416d6f756e74202d2d000000000000000000000000000000000000"
],
"data":"0x0000000000000000000000000000000000000000000000000000000000000001",
"blockNumber":122,
"blockHash":"0xc1812526374103893728e8810809260d83ee0fbdaf4cfdf474929ecacb1773bd",
"transactionHash":"0xefb0e9553cc9d6ef8ba28464cf30b31116ecd0dab876158ca1d61782ea04efdc",
"logIndex":0,
"actionIndex":0,
"transactionIndex":0
}
]
}
set_newPendingTransactionFilter
Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call set_getFilterChanges
Parameters
None
Response
Quantity- A filter id
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_newPendingTransactionFilter","params":[],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x50dbd6380389d414e254ce64f736b97c"
}
set_newBlockFilter
Creates a filter in the node, to notify when new block arrive. To check if the state has changed, call set_getFilterChanges
Parameters
None
Response
Quantity- A filter id
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_newBlockFilter","params":[],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5aeb8e569931053fb6a9b9422c701a93"
}
set_uninstallFilter
Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren't requested with set_getFilterChanges for a period of time.
Parameters
Quantity- The filter id
Response
Boolean-trueif the filter was successfully uninstalled, otherwisefalse
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"set_uninstallFilter","params":["0xfce5a886e3550604059a5f3e404f8767"],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
dpos_info
Returns information for dpos configuration.
Parameters
None
Response
Object- A dpos consensus config object.maxURLLen-Quantityinteger of the maximum URL len.unitStake-Quantityproportion of token exchange.candidateMinQuantity-Quantityinteger of the user registration candidate minimum mortgage quantity.candidateAvailableMinQuantity-Quantityinteger of the candidate minimum available quantity.If lower than this quantity, candidate cannot be voted.voterMinQuantity-Quantityinteger of the voter minimum votes quantity for once.activatedMinCandidate-Quantitythe minimum number of candidates required to activate the dpos consensus. Only when this number is reached will the dpos consensus be initiated.activatedMinQuantity-Quantitythe minimum total number of votes for activating dpos consensus.blockInterval-Quantitygenerate block interval.blockFrequency-Quantitythe number of consecutive blocks per node.candidateScheduleSize-Quantitythe total number of nodes required per cycle.backupScheduleSize-Quantitythe number of backup nodes.epochInterval-Quantitythe length of a block cycle, in millisecondsfreezeEpochSize-Quantityafter candidate logout,the epoch for recovering the mortgage amount.accountName-Stringname of account.systemName-Stringname of system account.systemURL-Stringsystem URL.extraBlockReward-Quantityinteger of extra block reward.blockReward-Quantityinteger of block reward.decimals-Quantityminimum unit of asset.assetID-Quantitysystem asset ID.referenceTime-Quantitygenesis block timestamp.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"dpos_info","params":[], "id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"maxURLLen": 512,
"unitStake": 1,
"candidateMinQuantity": 500000,
"candidateAvailableMinQuantity": 1000000,
"voterMinQuantity": 1,
"activatedMinCandidate": 28,
"activatedMinQuantity": 1350000000,
"blockInterval": 3000,
"blockFrequency": 6,
"candidateScheduleSize": 21,
"backupScheduleSize": 7,
"epochInterval": 604800000,
"freezeEpochSize": 2,
"accountName": "set.dpos",
"systemName": "set.founder",
"systemURL": "https://scan.setcoin.net",
"extraBlockReward": 0,
"blockReward": 0,
"decimals": 18,
"assetID": 0,
"referenceTime": 1559620800000000000
}
}
dpos_irreversible
Returns irreversible number.
Parameters
None
Response
bftIrreversible-Quantitynumber of dpos-bft consensus irreversible block.proposedIrreversible-Quantitynumber of proposed irreversible block.reversible-Quantitynumber of block.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_irreversible","params":[],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"bftIrreversible": 2385137,
"proposedIrreversible": 2385221,
"reversible": 2385304
}
}
dpos_epoch
Returns epoch number by block number.
Parameters
Quantity- block number.
Response
Quantity- a number represents epoch.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_epoch","params":[19000],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 1
}
dpos_prevEpoch
Returns previous epoch by given epoch.
Parameters
Quantity- epoch of the mining cycles,current data will be returned if 0 is passed.
Response
Quantity- a number represents epoch.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_prevEpoch","params":[10],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 9
}
dpos_nextEpoch
Returns next epoch by given epoch
Parameters
Quantity- epoch of the mining cycles,current data will be returned if 0 is passed
Response
Quantity- a number represents epoch.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_nextEpoch","params":[10],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 11
}
dpos_votersByCandidate
Returns voters information by candidate name.
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.String- the name of the candidate.Boolean-truereturn information,orfalseonly the name of the voter is returned.
Response
Array- list of voter info.epoch-Quantitydops-bft epoch.name-Stringname of voter account.candidate-Stringname of candidate account.quantity-Quantityinteger of the voter votes quantity.number-Quantityblock number of vote.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"dpos_votersByCandidate","params":[11,"account4test",true],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"epoch": 11,
"name": "account4test",
"candidate": "account4test",
"quantity": 4490000,
"number": 2036910
}
]
}
dpos_votersByVoter
Returns voters information by voter name.
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.String- the name of the voter.Boolean-truereturn information,orfalseonly the name of the voter is returned.
Response
See dpos_votersByCandidate response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"dpos_votersByVoter","params":[10,"account4test",true],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"epoch": 10,
"name": "account4test",
"candidate": "account4test",
"quantity": 4490000,
"number": 1818306
}
]
}
dpos_candidate
Returns candidate information by name.
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.String- the name of the candidate
Response
Object- a candidate object.epoch-Quantityepoch of the mining cycles.name-Stringname of candidate.url-Stringcandidate URL.quantity-Quantitycandidate mortgage votes quantity.totalQuantity-Quantityinteger of votes candidate got.number-Quantitythe number of the block where the last update is located.shouldCounter-Quantityinteger of blocks should be.actualCounter-Quantityactual number of blocks.type-Stringstatus of candidate.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"dpos_candidate","params":[10,"account4test"],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"epoch": 10,
"name": "account4test",
"url": "",
"quantity": 500000,
"totalQuantity": 4990000,
"number": 1342949,
"shouldCounter": 19200,
"actualCounter": 19172,
"type": "normal"
}
}
dpos_candidates
Returns candidates information by a specific epoch
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.Boolean-truereturn information,orfalseonly the name of the voter is returned.
Response
Array- list of candidate info.- see dpos_candidate response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_candidates","params":[10,true],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"epoch": 10,
"name": "olivelawrence",
"url": "https://scan.setcoin.net",
"quantity": 500000,
"totalQuantity": 5000001,
"number": 1150824,
"shouldCounter": 38358,
"actualCounter": 38352,
"type": "normal"
},
{
"epoch": 10,
"name": "account4test",
"url": "",
"quantity": 500000,
"totalQuantity": 4990000,
"number": 1342949,
"shouldCounter": 19200,
"actualCounter": 19172,
"type": "normal"
}
]
}
dpos_candidatesSize
Returns number of candidates
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.
Response
Quantity- represents size of candidates
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_candidatesSize","params":[10],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 39
}
dpos_availableStake
Returns current available stake of a voter.
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.String- the name of the voter.
Response
Quantity- number of the available stake
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"dpos_availableStake","params":[10,"account4test"],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 9909000000000000000000
}
dpos_validCandidates
Returns valid candidates by epoch。
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.
Response
Object- a valid candidates object.epoch-Quantityepoch of the mining cycles.preEpoch-Quantityprevious epoch of the mining cycles.activatedCandidateSchedule-Arraynames of activated candidates.activatedTotalQuantity-Quantityinteger of activated total votes.badCandidateIndexSchedule-Arraybad index of candidate schedule.usingCandidateIndexSchedule-Arrayusing index of candidate schedule.totalQuantity-Quantitycurrent total votes.takeOver-Booleanwhether system node take over.dpos-Booleanwhether to start dpos。number-Quantitythe number of the first block of this epoch.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_validCandidates","params":[100],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"epoch": 12,
"preEpoch": 11,
"activatedCandidateSchedule": [
"angelahenrietta",
"servicexou",
"earthameredith",
"ms2wzservice",
"adolpheuphemia",
"fansyfs",
"evangelinebecky",
"btcetheos",
"careybloomer",
"account4test",
"gillmasefield",
"leifmarcellus",
"dennisbeerbohm",
"donotfishing",
"clarencespencer",
"bitchoicetest",
"support",
"xaviermackintosh",
"vanessaconnie",
"webbedgeworth",
"theobaldgarden",
"susanricardo",
"sebastiannorth",
"salomechrist",
"richardfrederick",
"olivelawrence",
"nicolaspender",
"lambertorlando"
],
"activatedTotalQuantity": 109560449,
"badCandidateIndexSchedule": [
5
],
"usingCandidateIndexSchedule": [
0,
1,
2,
3,
4,
21,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
],
"totalQuantity": 146060460,
"takeOver": false,
"dpos": true,
"number": 2177896
}
}
dpos_nextValidCandidates
Returns valid candidates of next epoch
Parameters
None
Response
See dpos_validCandidates response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_nextValidCandidates","params":[],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"epoch": 13,
"preEpoch": 12,
"activatedCandidateSchedule": [
"ms2wzservice",
"ft2moon",
"bitchoicetest",
"support",
"leifmarcellus",
"candidate",
"fansyfs",
"servicexou",
"xaviermackintosh",
"webbedgeworth",
"vanessaconnie",
"theobaldgarden",
"susanricardo",
"sebastiannorth",
"salomechrist",
"richardfrederick",
"olivelawrence",
"nicolaspender",
"lambertorlando",
"kristinlloyd",
"kennethmarcus",
"kennedysilas",
"jeremybarnard",
"isidoreleacock",
"hilaryreynolds",
"haleygresham",
"gwendolyndickey",
"gillmasefield"
],
"activatedTotalQuantity": 23000992,
"badCandidateIndexSchedule": [],
"usingCandidateIndexSchedule": [],
"totalQuantity": 30000999,
"takeOver": false,
"dpos": true,
"number": 2378683
}
}
dpos_getActivedCandidate
Returns actived candidate information by index
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.Quantity- index of the actived candidate.
Response
Object- actived candidate information.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_getActivedCandidate","params":[0,0],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"actualCount": 1602,
"bad": false,
"candidate": "angelahenrietta",
"delegatedStake": 500000000000000000000000,
"epoch": 13,
"replaceIndex": 0,
"shouldCount": 1602,
"votedStake": 5300001000000000000000000
}
}
dpos_getActivedCandidateSize
Returns size of actived candidates.
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.
Response
Quantity- size of candidates
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_getActivedCandidateSize","params":[10],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 28
}
dpos_snapShotTime
Returns snapshort timestamp and epoch.
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.
Response
Object- a snapshort timestamp object.epoch-Quantitynumber of epoch.time-StringUTC time of cycle started。timestamp-Quantitysnapshort timestamp.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"dpos_snapShotTime","params":[100],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"epoch": 10,
"time": "2019-08-06T12:00:00+08:00",
"timestamp": 1565064000000000000
}
}
dpos_snapShotStake
Returns snapshort stake of account name
Parameters
Quantity- epoch of the mining cycles,current data will be returned if0is passed.String- name of account.
Response
Quantity- integer of account snapshort stake.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"dpos_snapShotStake","params":[10,"account4test"],"id": 1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": 4499909996880600000000000
}
fee_getObjectFeeByName
Returns fee detail by account's name
Parameters
String- name of the account (asset name, contract name or miner's name)Quantity- type of the (Asset Type(0),Contract Type(1),Coinbase Type(2))
Response
Object- a fee detail ornullif not found.objectFeeID-Quantityfee id.objectType-Quantitytype of fee.objectName-Stringname of fee account.assetFees-ObjectassetID-Quantityfee asset Id.totalFee-Quantitytotal fees received so far.remainFee-Quantityno handling fees have been drawn so far.
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"fee_getObjectFeeByName","params":["account4test",2],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"objectFeeID": 427,
"objectType": 2,
"objectName": "account4test",
"assetFees": [
{
"assetID": 0,
"totalFee": 4574852809410122731,
"remainFee": 4574852809410122731
}
]
}
fee_getObjectFeeResult
Returns fee result from a specific objectFeeID within count number at a given timestamp.
Parameters None
Quantity- the start object fee ID (start from 1).Quantity- the count of results(max 1000).Quantity- snapshot timestamp.
Response
Array- list of fee detail. see fee_getObjectFeeByName response
Example
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"fee_getObjectFeeResult","params":[1,2,1565064000000000000],"id":1}' http://localhost:8545
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"continue": true,
"objectFees": [
{
"objectFeeID": 1,
"objectType": 1,
"objectName": "set.account",
"assetFees": [
{
"assetID": 0,
"totalFee": 8316000569129297073,
"remainFee": 8316000569129297073
}
]
},
{
"objectFeeID": 2,
"objectType": 2,
"objectName": "set.founder",
"assetFees": [
{
"assetID": 0,
"totalFee": 1034054730430338100850,
"remainFee": 1034054730430338100850
}
]
}
]
}
}