JSON-RPC Endpoints
JSON-RPC smartBCH
Here is a list of all the supported RPC endpoints of smartBCH, sorted by the prefixes. The endpoints with “sbch” prefix are smartBCH-specific, which are used by the BasicBrowser. The endpoints with “web3”, “net” and “eth” prefixes have the same function as infura, except for some features which are described below.
Web3
JSON-RPC methods | Doc (eth.wiki) | Doc (infura.io/docs) | Implemented? |
---|---|---|---|
web3_clientVersion | https://eth.wiki/json-rpc/API#web3_clientVersion | https://infura.io/docs/ethereum/json-rpc/web3-clientVersion | ✅ |
web3_sha3 | https://eth.wiki/json-rpc/API#web3_sha3 | ✅ |
Net
JSON-RPC methods | Doc (eth.wiki) | Doc (infura.io/docs) | Implemented? |
---|---|---|---|
net_version | https://eth.wiki/json-rpc/API#net_version | https://infura.io/docs/ethereum/json-rpc/net-version | ✅ |
net_peerCount | https://eth.wiki/json-rpc/API#net_peercount | https://infura.io/docs/ethereum/json-rpc/net-peerCount | ❌ |
net_listening | https://eth.wiki/json-rpc/API#net_listening | https://infura.io/docs/ethereum/json-rpc/net-listening | ❌ |
ETH
⚠️the ‘pending’ block number parameter is not supported, because the mempool of smartbchd is invisable now.
The throughput of smartBCH is very high, and no transactions will be waiting in the mempool for a long time, so there is no need to check whether a transaction is accepted by mempool.Txpool (non-standard)
JSON-RPC methods | Doc | Implemented?) |
---|---|---|
txpool_content | https://geth.ethereum.org/docs/rpc/ ns-txpool#txpool_content |
✅ (returns empty data) |
txpool_status | https://geth.ethereum.org/docs/ rpc/ns-txpool#txpool_status |
✅ (returns empty data) |
txpool_inspect | https://geth.ethereum.org/docs/ rpc/ns-txpool#txpool_inspect |
✅ (returns empty data) |
TM
JSON-RPC methods | Doc (eth.wiki) | Doc (infura.io/docs) | Implemented? |
---|---|---|---|
tm_nodeInfo | N/A | N/A | ✅ |
tm_nodeInfo
Parameters: No
Retrns:
[direction]Object[/direction]
SBCH
JSON-RPC methods | Doc (eth.wiki) | Doc (infura.io/docs) | Implemented?) |
---|---|---|---|
sbch_queryTxBySrc | N/A | N/A | ✅ |
sbch_queryTxByDst | N/A | N/A | ✅ |
sbch_queryTxByAddr | N/A | N/A | ✅ |
sbch_queryLogs | N/A | N/A | ✅ |
sbch_getTxListByHeight | N/A | N/A | ✅ |
sbch_getTxListByHeightWithRange | N/A | N/A | ✅ |
sbch_getAddressCount | N/A | N/A | ✅ |
sbch_getSep20AddressCount | N/A | N/A | ✅ |
sbch_queryTxBySrc
Returns the information about transactions requested by sender address and block range.
Parameters:
1. [direction]DATA,[/direction] 20 Bytes – from address
2. [direction]QUANTITY [/direction]- integer, start number
3. [direction]QUANTITY [/direction]- integer, end number
4. [direction]QUANTITY [/direction]- integer, the maximal number of txs to return, 0 stands for default limit
Note: the start number can be greater than the end number, if so, the results will be sorted by block height in descending order.
Retrns:
Array – array of transaction objects, see eth_getTransactionByHash
sbch_queryTxByDst
Returns the information about transactions requested by recipient address and block range.
Parameters:
1. [direction]DATA,[/direction] 20 Bytes – to address
2. [direction]QUANTITY|TAG [/direction]- integer of start number, or string [direction]”latest”[/direction] for the last mined block 3. [direction]QUANTITY|TAG [/direction]- integer of end number, or string [direction]”latest”[/direction] for the last mined block
4. [direction]QUANTITY [/direction]- integer, the maximal number of txs to return, [/direction]0[direction] stands for default limit
Note: the start number can be greater than the end number, if so, the results will be sorted by block height in descending order.
Retrns:
Array – array of transaction objects, see eth_getTransactionByHash
sbch_queryTxByAddr
Returns the information about transactions requested by address (sender or recipient) and block range.
Parameters:
1. [direction]DATA,[/direction] 20 Bytes – from or to address
2. [direction]QUANTITY|TAG [/direction]- integer of start number, or string [direction]”latest”[/direction] for the last mined block
3. [direction]QUANTITY|TAG [/direction]- integer of end number, or string [direction]”latest”[/direction] for the last mined block
4. [direction]QUANTITY [/direction]- integer, the maximal number of txs to return, [/direction]0[direction] stands for default limit
Note: the start number can be greater than the end number, if so, the results will be sorted by block height in descending order.
Retrns:
Array – array of transaction objects, see eth_getTransactionByHash
sbch_queryLogs
Query logs by address, topics and block range. It is different from [direction]eth_getLogs[/direction] in:
1. the contract address is required, not optional;
2. the topics are position-independent, which means as long as a log has the specified topics in any position, it will be included in the returned result.
Parameters:
1. [direction]DATA,[/direction] 20 Bytes – contract address
2. [direction]Array of DATA,[/direction] topics
3. [direction]QUANTITY [/direction]- integer of start number, or string [direction]”latest”[/direction] stands for default limit
4. [direction]QUANTITY [/direction]- integer of start number, or string [direction]0[/direction] stands for default limit
Note: the start number can be greater than the end number, if so, the results will be sorted by block height in descending order.
Retrns:
Array – array of transaction objects, see eth_getLogs
sbch_getTxListByHeight
Get tx list by height.
Parameters:
1. [direction]QUANTITY|TAG [/direction]- integer of start number, or string [direction]”latest”[/direction] for the last mined block
Retrns:
[direction]Array [/direction]- array of transaction objects, see eth_getTransactionReceipt
sbch_getTxListByHeightWithRange
Get tx list by height and tx index range.
Parameters:
1. [direction]QUANTITY|TAG [/direction]- integer of start number, or string [direction]”latest”[/direction] for the last mined block
2. [direction]QUANTITY|TAG [/direction]- integer of start tx index
3. [direction]QUANTITY [/direction]- integer of end tx index, or “0x0” which stands for “the largest tx index”
Retrns:
Array – array of transaction objects, see eth_getTransactionReceipt
sbch_getAddressCount
Returns the times addr acts as a to-address or from-address of a transaction.
Parameters:
1. [direction]String[/direction] , kind of the query, could be [direction]”from”,[/direction] [direction]”to”,[/direction] or [direction]”both”[/direction]
2. [direction]DATA,[/direction]- 20 Bytes – EOA or contract address
Retrns:
[direction]QUANTITY -[/direction] integer of count
sbch_getSep20AddressCount
Returns the times addr acts as a to-address or from-address of a SEP20 Transfer event at some contract.
Parameters:
1. [direction]String[/direction] , kind of the query, could be [direction]”from”,[/direction] [direction]”to”,[/direction] or [direction]”both”[/direction]
2. [direction]DATA,[/direction]- 20 Bytes – EOA or contract address
Retrns: [direction]QUANTITY -[/direction] integer of count