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

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.

JSON-RPC methods

Doc (eth.wiki)

Doc (infura.io/docs)

Implemented?

eth_protocolVersion

​https://eth.wiki/json-rpc/API#eth_protocolversion​

​https://infura.io/docs/ethereum/json-rpc/eth-protocolVersion​

βœ…

eth_syncing

​https://eth.wiki/json-rpc/API#eth_syncing​

​https://infura.io/docs/ethereum/json-rpc/eth-syncing​

βœ…

eth_coinbase

​https://eth.wiki/json-rpc/API#eth_coinbase​

​

βœ… (returns 0)

eth_mining

​https://eth.wiki/json-rpc/API#eth_mining​

​https://infura.io/docs/ethereum/json-rpc/eth-mining​

❌

eth_hashrate

​https://eth.wiki/json-rpc/API#eth_hashrate​

​https://infura.io/docs/ethereum/json-rpc/eth-hashrate​

❌

eth_gasPrice

​https://eth.wiki/json-rpc/API#eth_gasprice​

​https://infura.io/docs/ethereum/json-rpc/eth-gasPrice​

βœ… (returns 0)

eth_accounts

​https://eth.wiki/json-rpc/API#eth_accounts​

​https://infura.io/docs/ethereum/json-rpc/eth-accounts​

βœ…

eth_blockNumber

​https://eth.wiki/json-rpc/API#eth_blocknumber​

​https://infura.io/docs/ethereum/json-rpc/eth-blockNumber​

βœ…

eth_getBalance

​https://eth.wiki/json-rpc/API#eth_getbalance​

​https://infura.io/docs/ethereum/json-rpc/eth-getBalance​

βœ… ❌pending

eth_getStorageAt

​https://eth.wiki/json-rpc/API#eth_getstorageat​

​https://infura.io/docs/ethereum/json-rpc/eth-getStorageAt​

βœ… ❌pending

eth_getTransactionCount

​https://eth.wiki/json-rpc/API#eth_gettransactioncount​

​https://infura.io/docs/ethereum/json-rpc/eth-getTransactionCount​

βœ… ❌pending

eth_getBlockTransactionCountByHash

​https://eth.wiki/json-rpc/API#eth_getblocktransactioncountbyhash​

​https://infura.io/docs/ethereum/json-rpc/eth-getBlockTransactionCountByHash​

βœ…

eth_getBlockTransactionCountByNumber

​https://eth.wiki/json-rpc/API#eth_getblocktransactioncountbynumber​

​https://infura.io/docs/ethereum/json-rpc/eth-getBlockTransactionCountByNumber​

βœ… ❌pending

eth_getUncleCountByBlockHash

​https://eth.wiki/json-rpc/API#eth_getunclecountbyblockhash​

​https://infura.io/docs/ethereum/json-rpc/eth-getUncleCountByBlockHash​

❌

eth_getUncleCountByBlockNumber

​https://eth.wiki/json-rpc/API#eth_getunclecountbyblocknumber​

​https://infura.io/docs/ethereum/json-rpc/eth-getUncleCountByBlockNumber​

❌

eth_getCode

​https://eth.wiki/json-rpc/API#eth_getcode​

​https://infura.io/docs/ethereum/json-rpc/eth-getCode​

βœ… ❌pending

eth_sign

​https://eth.wiki/json-rpc/API#eth_sign​

​

❌

eth_signTransaction

​https://eth.wiki/json-rpc/API#eth_signtransaction​

​

❌

eth_sendTransaction

​https://eth.wiki/json-rpc/API#eth_sendtransaction​

​

βœ…

eth_sendRawTransaction

​https://eth.wiki/json-rpc/API#eth_sendrawtransaction​

​https://infura.io/docs/ethereum/json-rpc/eth-sendRawTransaction​

βœ…

eth_call

​https://eth.wiki/json-rpc/API#eth_call​

​https://infura.io/docs/ethereum/json-rpc/eth-call​

βœ… ❌pending

eth_estimateGas

​https://eth.wiki/json-rpc/API#eth_estimategas​

​https://infura.io/docs/ethereum/json-rpc/eth-estimateGas​

βœ…

eth_getBlockByHash

​https://eth.wiki/json-rpc/API#eth_getblockbyhash​

​https://infura.io/docs/ethereum/json-rpc/eth-getBlockByHash​

βœ…

eth_getBlockByNumber

​https://eth.wiki/json-rpc/API#eth_getblockbynumber​

​https://infura.io/docs/ethereum/json-rpc/eth-getBlockByNumber​

βœ… ❌pending

eth_getTransactionByHash

​https://eth.wiki/json-rpc/API#eth_gettransactionbyhash​

​https://infura.io/docs/ethereum/json-rpc/eth-getTransactionByHash​

βœ…

eth_getTransactionByBlockHashAndIndex

​https://eth.wiki/json-rpc/API#eth_gettransactionbyblockhashandindex​

​https://infura.io/docs/ethereum/json-rpc/eth-getTransactionByBlockHashAndIndex​

βœ…

eth_getTransactionByBlockNumberAndIndex

​https://eth.wiki/json-rpc/API#eth_gettransactionbyblocknumberandindex​

​https://infura.io/docs/ethereum/json-rpc/eth-getTransactionByBlockNumberAndIndex​

βœ… ❌pending

eth_getTransactionReceipt

​https://eth.wiki/json-rpc/API#eth_gettransactionreceipt​

​https://infura.io/docs/ethereum/json-rpc/eth-getTransactionReceipt​

βœ…

eth_getUncleByBlockHashAndIndex

​https://eth.wiki/json-rpc/API#eth_getunclebyblockhashandindex​

​https://infura.io/docs/ethereum/json-rpc/eth-getUncleByBlockHashAndIndex​

❌

eth_getUncleByBlockNumberAndIndex

​https://eth.wiki/json-rpc/API#eth_getunclebyblocknumberandindex​

​https://infura.io/docs/ethereum/json-rpc/eth-getUncleByBlockNumberAndIndex​

❌

eth_getCompiles

​https://eth.wiki/json-rpc/API#eth_getcompilers​

​

❌

eth_compileLLL

​https://eth.wiki/json-rpc/API#eth_compilelll​

​

❌

eth_compileSolidity

​https://eth.wiki/json-rpc/API#eth_compilesolidity​

​

❌

eth_compileSerpent

​https://eth.wiki/json-rpc/API#eth_compileserpent​

​

❌

eth_newFilter

​https://eth.wiki/json-rpc/API#eth_newfilter​

​https://infura.io/docs/ethereum/json-rpc/eth-newFilter​

βœ… ❌pending

eth_newBlockFilter

​https://eth.wiki/json-rpc/API#eth_newblockfilter​

​https://infura.io/docs/ethereum/json-rpc/eth-newBlockFilter​

βœ…

eth_newPendingTransactionFilter

​https://eth.wiki/json-rpc/API#eth_newpendingtransactionfilter​

​

βœ…

eth_uninstallFilter

​https://eth.wiki/json-rpc/API#eth_uninstallfilter​

​https://infura.io/docs/ethereum/json-rpc/eth-uninstallFilter​

βœ…

eth_getFilterChanges

​https://eth.wiki/json-rpc/API#eth_getfilterchanges​

​https://infura.io/docs/ethereum/json-rpc/eth-getFilterChanges​

βœ…

eth_getFilterLogs

​https://eth.wiki/json-rpc/API#eth_getfilterlogs​

​

βœ…

eth_getLogs

​https://eth.wiki/json-rpc/API#eth_getlogs​

​https://infura.io/docs/ethereum/json-rpc/eth-getLogs​

βœ… ❌pending

eth_getWork

​https://eth.wiki/json-rpc/API#eth_getwork​

​https://infura.io/docs/ethereum/json-rpc/eth-getWork​

❌

eth_submitWork

​https://eth.wiki/json-rpc/API#eth_submitwork​

​https://infura.io/docs/ethereum/json-rpc/eth-submitWork​

❌

eth_submitHashrate

​https://eth.wiki/json-rpc/API#eth_submithashrate​

​https://infura.io/docs/ethereum/json-rpc/eth-hashrate​

❌

eth_chainId

​

​https://infura.io/docs/ethereum/json-rpc/eth-chainId​

βœ…

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

Returns the information about Tendermint node.

Parameters: No

Retrns:

Object

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_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. DATA, 20 Bytes - from address

  2. QUANTITY - integer, start number

  3. QUANTITY - integer, end number

  4. QUANTITY - 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. DATA, 20 Bytes - to address

  2. QUANTITY|TAG - integer of start number, or string "latest" for the last mined block

  3. QUANTITY|TAG - integer of end number, or string "latest" for the last mined block

  4. QUANTITY - 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_queryTxByAddr

Returns the information about transactions requested by address (sender or recipient) and block range.

Parameters:

  1. DATA, 20 Bytes - from or to address

  2. QUANTITY|TAG - integer of start number, or string "latest" for the last mined block

  3. QUANTITY|TAG - integer of end number, or string "latest" for the last mined block

  4. QUANTITY - 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_queryLogs

Query logs by address, topics and block range. It is different from eth_getLogs 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. DATA, 20 Bytes - contract address

  2. Array of DATA, topics

  3. QUANTITY|TAG - integer of start number, or string "latest" for the last mined block

  4. QUANTITY|TAG - integer of end number, or string "latest" for the last mined block

  5. QUANTITY - 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.

Returns:

Array - array of log objects, see eth_getLogs​

sbch_getTxListByHeight

Get tx list by height.

Parameters:

  1. QUANTITY|TAG - integer of start number, or string "latest" for the last mined block

Returns:

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. String, kind of the query, could be "from", "to", or "both"

  2. DATA, 20 Bytes - EOA or contract address

Returns:

QUANTITY - 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. String, kind of the query, could be "from", "to", or "both"

  2. DATA, 20 Bytes - SEP20 contract address

  3. DATA, 20 Bytes - EOA or contract address

Returns:

QUANTITY - integer of count