JSON-RPC API Methods

1. Web3 Namespace

web3_clientVersion

  • Description: Returns the current client version.
  • Parameters: None
  • Returns: String - Client version
  • Example:
    Response:

web3_sha3

  • Description: Returns the Keccak-256 (SHA3) of the given data.
  • Parameters: String - Data to be hashed
  • Returns: Data - Keccak-256 hash of the input data
  • Example:
    Response:

2. Net Namespace

net_version

  • Description: Returns the current network ID.
  • Parameters: None
  • Returns: String - Network ID
  • Example:
    Response:

net_peerCount

  • Description: Returns the number of peers currently connected to the client.
  • Parameters: None
  • Returns: Quantity - Number of connected peers
  • Example:
    Response:

net_listening

  • Description: Returns true if the client is actively listening for network connections.
  • Parameters: None
  • Returns: Boolean - Listening status
  • Example:
    Response:

3. Eth Namespace

eth_protocolVersion

  • Description: Returns the current Ethereum protocol version.
  • Parameters: None
  • Returns: String - Protocol version
  • Example:
    Response:

eth_syncing

  • Description: Returns an object with data about the sync status or false.
  • Parameters: None
  • Returns: Boolean or Object - Sync status
  • Example:
    Response:

eth_gasPrice

  • Description: Returns the current price per gas in wei.
  • Parameters: None
  • Returns: Quantity - Gas price in wei
  • Example:
    Response:

eth_blockNumber

  • Description: Returns the number of the most recent block.
  • Parameters: None
  • Returns: Quantity - Block number
  • Example:
    Response:

eth_getBlockByNumber

  • Description: Returns information about a block by block number.
  • Parameters:
    • String - Block number or one of the string tags latest, earliest, pending
    • Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions
  • Returns: Object - Block information
  • Example:
    Response:

eth_getTransactionByHash

  • Description: Retrieves detailed information about a transaction specified by its hash.
  • Parameters:
    • Hash (String): The transaction hash to retrieve, represented as a hexadecimal string.
  • Returns:
    • Object: An object containing the following fields about the transaction:
      • blockHash (String): The hash of the block where the transaction is included.
      • blockNumber (String): The number of the block where the transaction is included.
      • from (String): The address of the sender of the transaction.
      • gas (String): The amount of gas used by the transaction.
      • gasPrice (String): The gas price in wei used for each unit of gas.
      • hash (String): The transaction hash.
      • input (String): The input data of the transaction, typically used for invoking smart contracts.
      • nonce (String): The nonce of the sender’s account.
      • to (String): The address of the receiver of the transaction. It is empty if the transaction is a contract creation.
      • transactionIndex (String): The index of the transaction within the block.
      • value (String): The amount of Ether transferred in the transaction, represented in wei.
  • Example:
Request:
Response: