JSON-RPC Endpoints
Last updated
Was this helpful?
Last updated
Was this helpful?
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 . The endpoints with "web3", "net" and "eth" prefixes have the same function as infura, except for some features which are described below.
web3_clientVersion
✅
web3_sha3
✅
net_version
✅
net_peerCount
❌
net_listening
❌
⚠️the 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.
eth_protocolVersion
✅
eth_syncing
✅
eth_coinbase
✅ (returns 0)
eth_mining
❌
eth_hashrate
❌
eth_gasPrice
✅ (returns 0)
eth_accounts
✅
eth_blockNumber
✅
eth_getBalance
✅ ❌pending
eth_getStorageAt
✅ ❌pending
eth_getTransactionCount
✅ ❌pending
eth_getBlockTransactionCountByHash
✅
eth_getBlockTransactionCountByNumber
✅ ❌pending
eth_getUncleCountByBlockHash
❌
eth_getUncleCountByBlockNumber
❌
eth_getCode
✅ ❌pending
eth_sign
❌
eth_signTransaction
❌
eth_sendTransaction
✅
eth_sendRawTransaction
✅
eth_call
✅ ❌pending
eth_estimateGas
✅
eth_getBlockByHash
✅
eth_getBlockByNumber
✅ ❌pending
eth_getTransactionByHash
✅
eth_getTransactionByBlockHashAndIndex
✅
eth_getTransactionByBlockNumberAndIndex
✅ ❌pending
eth_getTransactionReceipt
✅
eth_getUncleByBlockHashAndIndex
❌
eth_getUncleByBlockNumberAndIndex
❌
eth_getCompiles
❌
eth_compileLLL
❌
eth_compileSolidity
❌
eth_compileSerpent
❌
eth_newFilter
✅ ❌pending
eth_newBlockFilter
✅
eth_newPendingTransactionFilter
✅
eth_uninstallFilter
✅
eth_getFilterChanges
✅
eth_getFilterLogs
✅
eth_getLogs
✅ ❌pending
eth_getWork
❌
eth_submitWork
❌
eth_submitHashrate
❌
eth_chainId
✅
eth_subscribe
https://infura.io/docs/ethereum/wss/eth-subscribe
eth_unsubscribe
https://infura.io/docs/ethereum/wss/eth-unsubscribe
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)
N/A
N/A
v0.1.0
N/A
N/A
v0.1.0
N/A
N/A
v0.1.0
N/A
N/A
v0.1.0
N/A
N/A
v0.1.0
N/A
N/A
v0.1.0
N/A
N/A
v0.1.0
N/A
N/A
v0.2.0
N/A
N/A
v0.4.0
N/A
N/A
V0.4.1
Returns the information about transactions requested by sender address and block range.
Parameters:
DATA
, 20 Bytes - from address
QUANTITY
- integer, start number
QUANTITY
- integer, end number
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:
Returns the information about transactions requested by recipient address and block range.
Parameters:
DATA
, 20 Bytes - to address
QUANTITY|TAG
- integer of start number, or string "latest"
for the last mined block
QUANTITY|TAG
- integer of end number, or string "latest"
for the last mined block
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:
Returns the information about transactions requested by address (sender or recipient) and block range.
Parameters:
DATA
, 20 Bytes - from or to address
QUANTITY|TAG
- integer of start number, or string "latest"
for the last mined block
QUANTITY|TAG
- integer of end number, or string "latest"
for the last mined block
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:
Query logs by address, topics and block range. It is different from eth_getLogs
in:
the contract address is required, not optional;
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:
DATA
, 20 Bytes - contract address
Array of DATA
, topics
QUANTITY|TAG
- integer of start number, or string "latest"
for the last mined block
QUANTITY|TAG
- integer of end number, or string "latest"
for the last mined block
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:
Get tx list by height.
Parameters:
QUANTITY|TAG
- integer of start number, or string "latest"
for the last mined block
Returns:
Get tx list by height and tx index range.
Parameters:
QUANTITY|TAG
- integer of start number, or string "latest"
for the last mined block
QUANTITY
- integer of start tx index
QUANTITY
- integer of end tx index, or "0x0" which stands for "the largest tx index"
Returns:
Returns the times addr acts as a to-address or from-address of a transaction.
Parameters:
String
, kind of the query, could be "from"
, "to"
, or "both"
DATA
, 20 Bytes - EOA or contract address
Returns:
QUANTITY
- integer of count
Returns the times addr acts as a to-address or from-address of a SEP20 Transfer event at some contract.
Parameters:
String
, kind of the query, could be "from"
, "to"
, or "both"
DATA
, 20 Bytes - SEP20 contract address
DATA
, 20 Bytes - EOA or contract address
Returns:
QUANTITY
- integer of count
Each object in internalTransactions array contains the following fields:
callPath
: string
- a string representation of call type, depth and index of internal transaction (e.g. staticcall_0_1_1).
from
: DATA
, 20 Bytes - address of the sender.
to
: DATA
, 20 Bytes - address of the receiver.
gas
: QUANTITY
- gas provided by the sender.
value
: QUANTITY
- value transferred in Wei.
input
: DATA
- the data send along with the internal transaction.
status
: QUANTITY
- either 1
(success) or 0
(failure).
gasUsed
: QUANTITY
- the amount of gas used by this internal transaction.
output
: DATA
- the data returned by the internal transaction.
contractAddress
: DATA
, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null
.
Returns the validators info.
Parameters: N/A
Returns: a validator info object:
genesisMainnetBlockHeight: QUANTITY
- The BCH mainnet height when smartbch chain mint genesis block.
currEpochNum: QUANTITY
- The epoch number of current epoch.
validators: Array
- Array of validator object, which mean validators created by call stakingContract.createValidator
method.
validatorsUpdate: Array
- Array of validator object, which mean validators whose voting power updated when epoch switch.
pendingRewards: Array
- Array of pending rewards object, which mean validator pending rewards.
minGasPrice: QUANTITY
- The minimum gas price decided in current block.
lastMinGasPrice: QUANTITY
- The minimum gas price used in current block.
currValidators: Array
- Array of validator object, which mean validators who on duty in current epoch.
And the validator
object has fields:
address: DATA
, 20 Bytes - Address of the validator.
pubkey: DATA
, 32 Bytes - Consensus pubkey of the validator.
reward_to: DATA
, 20 Bytes - Address to receive block mint rewards.
voting_power: QUANTITY
- The minimum gas price decided in current block.
introduction: String
- The introduction of validator.
staked_coins DATA
, 32 Bytes - Staked coins of the validator.
is_retiring: Boolean
- Indicate whether validator is retired.
Array
- array of transaction objects, see
Array
- array of transaction objects, see
Array
- array of transaction objects, see
Array
- array of log objects, see
Array
- array of transaction objects, see
Array
- array of transaction objects, see
Enhanced version of , the returned array of objects contain additional information about internal transactions.
Parameters: same as
Returns: array of objects sepcified by plus one more field of type Array: internalTransactions
.