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
-true
when 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 exist
if not found.accountName
-String
name of the account.founder
-String
founder of the account.accountID
- id of the account.number
-Quantity
block number where this account was created.nonce
-Quantity
integer of the number of transactions send from this account.code
-String
the contract code from the given account.codeHash
-String
hash of the contract code,or0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
if not found.codeSize
-Quantity
size of the contract.threshold
-Quantity
threshold for account transfer transaction permissions.updateAuthorThreshold
-Quantity
threshold for account update author transaction permissions.authorVersion
-Quantity
current account author version.balances
-Array
all asset balances under the account.assetID
-Quantity
id of asset.balance
-Quantity
balance of asset.
authors
-Array
all authors under the account.owner
-String
public key of owner.weight
-String
weight of owner.
suicide
-Boolean
true
when account contract suicide, otherwisefalse
.destroy
-Boolean
true
when account destroy, otherwisefalse
.description
-String
description 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 empty
if 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 exist
if not foundassetId
-Quantity
id of the asset.number
-Quantity
block number where this asset was created.stats
-Quantity
number of holders。assetName
-String
name of the asset.symbol
-String
symbol of asset.amount
-Quantity
total currency amount of asset.decimals
-Quantity
minimum unit of asset.founder
-String
who created the asset.owner
-String
who owns all permissions to the asset.addIssue
-Quantity
total amount of issuance.upperLimit
-Quantity
maximum number of additional issues.contract
-String
agreement asset contract.description
-String
description 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
-0
calculate parent assets, or1
calculate 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
-0
calculate parent assets, or1
calculate 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
-0
returns the last snapshot timestamp,1
returns the previous snapshot timestamp,or2
returns 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
Object
A transaction object, ornull
when no transaction was found.blockHash
-String
hash of the block where this transaction was in.null
when its pending.blockNumber
-Quantity
block number where this transaction was in.0
when its pending.txHash
-String
hash of the transaction.transactionIndex
-Quantity
integer of the transaction's index position in the block.0
when its pending.actions
-Array
list of action.type
-Quantity
type of action.nonce
-Quantity
the number of actions made by the sender prior to this one.from
-String
account name of the sender.to
-String
account name of the sender.assetID
-Quantity
which asset to transfer.gas
-Quantity
gas provided by the sender.value
-Quantity
value transferred.remark
-String
the data of extra context.payload
-String
the data send along with the action.actionHash
-String
hash of the action.actionIndex
-Quantity
integer of the action's index position in the transaction.
gasAssetID
-Quantity
which asset to pay gas.gasPrice
-Quantity
gas price provided by the sender.gasCost
-Quantity
the 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, ornull
when no internal transaction was found.txHash
-String
hash of the transaction.actions
-Array
list of action.internalActions
-Array
list of internal action.action
-Object
a internal action object,ornull
when no internal action was found.type
-Quantity
type of action.nonce
-Quantity
the number of actions made by the sender prior to this one.from
-String
account name of the sender.to
-String
account name of the sender.assetID
-Quantity
which asset to transfer.gas
-Quantity
gas provided by the sender.value
-Quantity
value transferred.remark
-String
the data of extra context.payload
-String
the data send along with the action.actionHash
-String
hash of the action.actionIndex
-Quantity
integer of the action's index position in the transaction.
actionType
-Quantity
type of internal action.gasAssetID
-Quantity
which asset to pay gas.gasPrice
-Quantity
gas price provided by the sender.error
-Quantity
error 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, ornull
when no receipt was found.blockHash
-String
hash of the block where this transaction was in.blockNumber
-Quantity
block number where this transaction was in.txHash
-String
hash of the transaction.transactionIndex
-Quantity
integer of the transaction's index position in the block.postState
-String
post transaction state root.actionResults
-Array
results of action.actionType
-Quantity
type of action.status
-Quantity
either 1 (success) or 0 (failure).index
-Quantity
integer of the action's index position in the transaction.gasUsed
-Quantity
the amount of gas used by this specific action alone.gasAllot
-Array
information of gas allot.name
-String
name of account.gas
-Quantity
integer of gas reward.typeId
-Quantity
0
transfer fee ,1
contract ,2
block reward.
error
-String
error of action.
cumulativeGasUsed
-Quantity
the total amount of gas used when this transaction was executed in the block.totalGasUsed
-Quantity
the amount of gas used by this specific transaction alone.logsBloom
-String
bloom filter for light clients to quickly retrieve related logs.logs
-Array
array of log objects, which this transaction generated,name
-String
name from which this log originated.topics
-Array
data of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event.)data
-String
contains the non-indexed arguments of the log.blockNumber
-Quantity
block number where this log was in.blockHash
-String
hash of the block where this log was in.transactionHash
-String
hash of the transaction where this log was in.logIndex
-Quantity
integer of the log's index position in the action.actionIndex
-Quantity
integer of the action's index position in the transaction.transactionIndex
-Quantity
integer 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
-Array
list of transaction hash.hash
-String
hash of transaction.height
-Quantity
block number where this transaction was in.
irreversibleBlockHeight
-Quantity
dpos irreversible block number.endHeight
-Quantity
end 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
- Iftrue
it returns the full transaction objects, iffalse
only the hashes of the transactions.
Response
Object
A block object.difficulty
-Quantity
integer of the difficulty for this block.extraData
-String
theextra data
field of this block.forkID
-Object
a fock object.cur
-Quantity
current fork id.next
-Quantity
next
gasLimit
-Quantity
the maximum gas allowed in this block.gasUsed
-Quantity
the total used gas by all transactions in this block.hash
-String
hash of block.logsBloom
-String
the bloom filter for the logs of the block.miner
-String
the name of the beneficiary to whom the mining rewards were given.number
-Quantity
the block number.parentHash
-String
hash of the parent block.proposedIrreversible
-Quantity
irreversible block number.receiptsRoot
-String
the root of the receipts trie of the block.size
-Quantity
integer the size of this block in bytes.stateRoot
-String
the root of the transaction trie of the block.timestamp
-Quantity
the unix timestamp for when the block was collated.totalDifficulty
-Quantity
integer of the total difficulty of the chain until this block.transactions
-Array
Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.transactionsRoot
-String
the 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
- Iftrue
it returns the full transaction objects, iffalse
only 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
- Iftrue
it returns the full transaction objects, iffalse
only 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.block
see set_getCurrentBlock responsetransaction
see set_getTransactionByHash responsereceipts
see set_getTransactionReceipt responseinternal transaction
see 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
- Iftrue
it returns the full transaction objects, iffalse
only the hashes of the transactions.
Response
Array
- list of blocks, ornull
if 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
-Quantity
type of transaction.from
-String
name of sender account.to
-String
name of receipt account.assetId
-Quantity
id of used asset.gas
-Quantity
integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.gasPrice
-Quantity
integer of the gasPrice used for each paid gas.value
-Quantity
integer of the value sent with this transaction.data
-String
hash of the method signature and encoded parameters.remark
-String
extra data with this transaction. -Quantity
- height of the block, or string valuelatest
orearliest
.
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 BytesDATA
topics. 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_newBlockFilter
the return are block hashes (DATA
, 32 Bytes), e.g.["0x3454645634534..."]
. - For filters created with
set_newPendingTransactionFilter
the return are transaction hashes (DATA
, 32 Bytes), e.g.["0x6345343454645..."]
. - For filters created with
set_newFilter
logs are -Object
s 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.null
when its pending.blockNumber
:Quantity
- the block number where this log was in.null
when 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 BytesDATA
of 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 theanonymous
specifier.)
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
-true
if 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
-Quantity
integer of the maximum URL len.unitStake
-Quantity
proportion of token exchange.candidateMinQuantity
-Quantity
integer of the user registration candidate minimum mortgage quantity.candidateAvailableMinQuantity
-Quantity
integer of the candidate minimum available quantity.If lower than this quantity, candidate cannot be voted.voterMinQuantity
-Quantity
integer of the voter minimum votes quantity for once.activatedMinCandidate
-Quantity
the minimum number of candidates required to activate the dpos consensus. Only when this number is reached will the dpos consensus be initiated.activatedMinQuantity
-Quantity
the minimum total number of votes for activating dpos consensus.blockInterval
-Quantity
generate block interval.blockFrequency
-Quantity
the number of consecutive blocks per node.candidateScheduleSize
-Quantity
the total number of nodes required per cycle.backupScheduleSize
-Quantity
the number of backup nodes.epochInterval
-Quantity
the length of a block cycle, in millisecondsfreezeEpochSize
-Quantity
after candidate logout,the epoch for recovering the mortgage amount.accountName
-String
name of account.systemName
-String
name of system account.systemURL
-String
system URL.extraBlockReward
-Quantity
integer of extra block reward.blockReward
-Quantity
integer of block reward.decimals
-Quantity
minimum unit of asset.assetID
-Quantity
system asset ID.referenceTime
-Quantity
genesis 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
-Quantity
number of dpos-bft consensus irreversible block.proposedIrreversible
-Quantity
number of proposed irreversible block.reversible
-Quantity
number 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 if0
is passed.String
- the name of the candidate.Boolean
-true
return information,orfalse
only the name of the voter is returned.
Response
Array
- list of voter info.epoch
-Quantity
dops-bft epoch.name
-String
name of voter account.candidate
-String
name of candidate account.quantity
-Quantity
integer of the voter votes quantity.number
-Quantity
block 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 if0
is passed.String
- the name of the voter.Boolean
-true
return information,orfalse
only 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 if0
is passed.String
- the name of the candidate
Response
Object
- a candidate object.epoch
-Quantity
epoch of the mining cycles.name
-String
name of candidate.url
-String
candidate URL.quantity
-Quantity
candidate mortgage votes quantity.totalQuantity
-Quantity
integer of votes candidate got.number
-Quantity
the number of the block where the last update is located.shouldCounter
-Quantity
integer of blocks should be.actualCounter
-Quantity
actual number of blocks.type
-String
status 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 if0
is passed.Boolean
-true
return information,orfalse
only 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 if0
is 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 if0
is 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 if0
is passed.
Response
Object
- a valid candidates object.epoch
-Quantity
epoch of the mining cycles.preEpoch
-Quantity
previous epoch of the mining cycles.activatedCandidateSchedule
-Array
names of activated candidates.activatedTotalQuantity
-Quantity
integer of activated total votes.badCandidateIndexSchedule
-Array
bad index of candidate schedule.usingCandidateIndexSchedule
-Array
using index of candidate schedule.totalQuantity
-Quantity
current total votes.takeOver
-Boolean
whether system node take over.dpos
-Boolean
whether to start dpos。number
-Quantity
the 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 if0
is 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 if0
is 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 if0
is passed.
Response
Object
- a snapshort timestamp object.epoch
-Quantity
number of epoch.time
-String
UTC time of cycle started。timestamp
-Quantity
snapshort 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 if0
is 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 ornull
if not found.objectFeeID
-Quantity
fee id.objectType
-Quantity
type of fee.objectName
-String
name of fee account.assetFees
-Object
assetID
-Quantity
fee asset Id.totalFee
-Quantity
total fees received so far.remainFee
-Quantity
no 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
}
]
}
]
}
}