Pharos Docs
  • Introduction
    • About Pharos Network
    • Vision & Mision
    • Why Pharos Network
    • Concepts
      • Degree of Parallelism (DP)
  • Architecture
    • Pharos Modular Stack
    • Node Architecture
      • About Pharos Nodes
  • Core Technologies
    • Pharos Consensus
    • Pharos Execution
      • Why A New Blockchain Compute Model
      • Pharos VM
    • Pharos Pipelining
    • Pharos Store
      • Why We Need a Blockchain-Native Store
    • Pharos SPNs
  • Network Overview
    • Pharos Networks
      • Pharos Testnet Information
    • Pharos Gas Model
    • FAQ
  • Node & Validator Guide
    • Validator Requirements
    • Validator Node Deployment
      • Using Docker (Devnet)
      • Using Docker (Testnet)
    • Node Management
    • Rapid Node Initialization
      • Rapid Node Initialization(Testnet)
      • Rapid Node Initialization(Devnet)
    • Pharos Network Snapshots
    • Node Debugging & Configuration
  • Pharos Node Monitoring
  • Developer Guide
    • Foundry
      • Write Your First dApp
      • Write Your First Token
      • Write Your First NFT
      • Write Your First Uniswap Contract
    • Hardhat
      • Write Your First dApp
      • Write Your First Token
      • Write Your First NFT
      • Write Your First Uniswap Contract
    • Rust
    • Interoperability
      • Call EVM From WASM
  • API & SDK
    • JSON-RPC API Methods
  • Resources
    • EVM
    • Solidity
Powered by GitBook
On this page
  • Pharos RPC Methods
  • ETH Methods
  • Ethereum Subscription Methods
  • Network (NET) Methods
  • Web3 Methods
  • Debug Methods
Export as PDF
  1. API & SDK

JSON-RPC API Methods

PreviousCall EVM From WASMNextEVM

Last updated 21 days ago

Pharos Network is a fully EVM-equivalent Layer 1 blockchain, supporting a interface for seamless blockchain interactions. This RPC API is fully compatible with existing while also providing richer semantics and enhanced services.

Pharos RPC Methods

ETH Methods

eth_protocolVersion

Returns the current protocol version.

Input: None

Output: String - The protocol version

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_protocolVersion",
  "params": [],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x41"
}

eth_gasPrice

Returns the current gas price in Wei.

Input: None

Output: String - Gas price in Wei

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_gasPrice",
  "params": [],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x09184e72a000"
}

eth_blockNumber

Returns the number of the most recent block.

Input: None

Output: String - Block number in hexadecimal

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_blockNumber",
  "params": [],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x10d4f"
}

eth_getBlockTransactionCountByHash

Returns the number of transactions in a block specified by its hash.

Input:

  • String - Block hash

Output:

  • String - Number of transactions in the block (hexadecimal format)

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByHash",
  "params": ["0x5c3d...a7f5"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x10"
}

eth_getBlockTransactionCountByNumber

Returns the number of transactions in a block specified by its number.

Input:

  • String - Block number (hexadecimal format)

Output:

  • String - Number of transactions in the block (hexadecimal format)

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByNumber",
  "params": ["0xa"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x8"
}

eth_getBlockByHash

Returns information about a block specified by its hash.

Input:

  • String - Block hash

  • Boolean - Whether to include full transaction objects

Output:

  • Object - Block details

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByHash",
  "params": ["0x5c3d...a7f5", true],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "number": "0xa",
    "hash": "0x5c3d...a7f5",
    "transactions": [...]
  }
}

eth_getBlockReceipts

Returns the receipts of all transactions in a block.

Input:

  • String - Block number (hexadecimal format)

Output:

  • Array - List of transaction receipts

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockReceipts",
  "params": ["0x54f"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    { "transactionHash": "0xabc...123", "status": "0x1" },
    { "transactionHash": "0xdef...456", "status": "0x1" }
  ]
}

eth_getBlockByNumber

Returns information about a block specified by its number.

Input:

  • String - Block number (hexadecimal format)

  • Boolean - Whether to include full transaction objects

Output:

  • Object - Block details

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": ["0xa", true],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "number": "0xa",
    "hash": "0x5c3d...a7f5",
    "transactions": [...]
  }
}

eth_getTransactionByHash

Returns information about a transaction by its hash.

Input:

  • String - Transaction hash

Output:

  • Object - Transaction details

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByHash",
  "params": ["0xabc...123"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "hash": "0xabc...123",
    "blockNumber": "0xa",
    "from": "0xabc...789",
    "to": "0xdef...456"
  }
}

eth_getBlockTransactionCountByHash

Returns the number of transactions in a block specified by its hash.

Input:

  • String - Block hash

Output:

  • String - Number of transactions in the block (hexadecimal format)

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByHash",
  "params": ["0x5c3d...a7f5"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x10"
}

eth_getTransactionByBlockHashAndIndex

Returns a transaction by block hash and index position.

Input:

  • String - Block hash

  • String - Transaction index (hexadecimal format)

Output:

  • Object - Transaction details

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockHashAndIndex",
  "params": ["0x5c3d...a7f5", "0x0"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "hash": "0xabc...123",
    "from": "0xabc...789",
    "to": "0xdef...456",
    "value": "0xde0b6b3a7640000"
  }
}

eth_getTransactionByBlockNumberAndIndex

Returns a transaction by block number and index position.

Input:

  • String - Block number (hexadecimal format)

  • String - Transaction index (hexadecimal format)

Output:

  • Object - Transaction details

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockNumberAndIndex",
  "params": ["0xa", "0x0"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "hash": "0xabc...123",
    "from": "0xabc...789",
    "to": "0xdef...456",
    "value": "0xde0b6b3a7640000"
  }
}

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash.

Input:

  • String - Transaction hash

Output:

  • Object - Transaction receipt

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionReceipt",
  "params": ["0xabc...123"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "transactionHash": "0xabc...123",
    "blockNumber": "0xa",
    "status": "0x1"
  }
}

eth_getLogs

Returns logs matching a given filter.

Input:

  • Object - Filter parameters

Output:

  • Array - List of log entries

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getLogs",
  "params": [{"fromBlock": "0xa", "toBlock": "latest", "address": "0x123...456"}],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    { "address": "0x123...456", "data": "0x..." }
  ]
}

eth_chainId

Returns the chain ID of the current network.

Input: None

Output:

  • String - The chain ID as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_chainId",
  "params": [],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xc352"
}

eth_getBalance

Returns the balance of an address at a given block.

Input:

  • String - Address to query.

  • String - Block number or "latest", "earliest", "pending".

Output:

  • String - Balance in wei as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "latest"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xde0b6b3a7640000"
}

eth_getTransactionCount

Returns the number of transactions sent from an address.

Input:

  • String - Address to query.

  • String - Block number or "latest", "earliest", "pending".

Output:

  • String - Number of transactions as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionCount",
  "params": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "latest"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xa"
}

eth_getStorageAt

Returns the value from a storage position at a given address.

Input:

  • String - Address of the contract.

  • String - Position in storage.

  • String - Block number or "latest", "earliest", "pending".

Output:

  • String - Storage value as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getStorageAt",
  "params": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "0x0", "latest"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x000000000000000000000000000000000000000000000000000000000000000a"
}

eth_getCode

Returns the contract code of an address.

Input:

  • String - Address to query.

  • String - Block number or "latest", "earliest", "pending".

Output:

  • String - Contract code as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "latest"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x6080604052348015600f57600080fd5b5060..."
}

eth_sendRawTransaction

Submits a raw transaction to the network.

Input:

  • String - Raw signed transaction data.

Output:

  • String - Transaction hash.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_sendRawTransaction",
  "params": ["0xf86b80843b9aca0082520894a8d7e4fcf4422f17713da6a5a4740a54b3eb3d4880de0b6b3a76400008025a0..."],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
}

eth_call

Executes a new message call without creating a transaction.

Input:

  • Object - Transaction call object:

    • from: (optional) Address of sender.

    • to: Address of contract.

    • gas: (optional) Gas limit.

    • gasPrice: (optional) Gas price.

    • value: (optional) Amount in wei.

    • data: Call data.

  • String - Block number or "latest", "earliest", "pending".

Output:

  • String - Returned data as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_call",
  "params": [
    {
      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
      "data": "0x06fdde03"
    },
    "latest"
  ],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x..."
}

eth_estimateGas

Estimates the gas required for a transaction.

Input:

  • Object - Transaction object:

    • from: (optional) Address of sender.

    • to: Address of recipient.

    • gas: (optional) Gas limit.

    • gasPrice: (optional) Gas price.

    • value: (optional) Amount in wei.

    • data: (optional) Call data.

Output:

  • String - Estimated gas as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_estimateGas",
  "params": [
    {
      "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
      "data": "0x06fdde03"
    }
  ],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x5208"
}

eth_feeHistory

Returns a fee history for a given block range.

Input:

  • Number - Block count.

  • String - Newest block (e.g., "latest").

  • Array - Percentiles for priority fees.

Output:

  • Object - Fee history.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_feeHistory",
  "params": [5, "latest", [10, 50, 90]],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "oldestBlock": "0x5bad55",
    "reward": [["0x1", "0x2", "0x3"]],
    "baseFeePerGas": ["0x4", "0x5", "0x6"],
    "gasUsedRatio": [0.1, 0.5, 0.9]
  }
}

eth_getAccount

Returns information about an account.

Input:

  • String - Address.

Output:

  • Object - Account details.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_getAccount",
  "params": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "latest"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "balance": "0xde0b6b3a7640000",
    "nonce": "0xa",
    "codeHash": "0x...",
    "storageRoot": "0x..."
  }
}

Ethereum Subscription Methods

eth_subscribe

Subscribes to events.

Input:

  • String - Subscription type ("newHeads", "logs", "newPendingTransactions", "syncing").

  • Object - Optional filter parameters.

Output:

  • String - Subscription ID.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_subscribe",
  "params": ["newHeads"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1234567890abcdef"
}

eth_unsubscribe

Unsubscribes from events.

Input:

  • String - Subscription ID.

Output:

  • Boolean - true if successful.

Example:

{
  "jsonrpc": "2.0",
  "method": "eth_unsubscribe",
  "params": ["0x1234567890abcdef"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Network (NET) Methods

net_version

Returns the network ID.

Input: None

Output:

  • String - Network ID as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "net_version",
  "params": [],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "50002"
}

Web3 Methods

web3_clientVersion

Returns the client version.

Input: None

Output:

  • String - Client version.

Example:

{
  "jsonrpc": "2.0",
  "method": "web3_clientVersion",
  "params": [],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "portal/1.0.0"
}

Debug Methods

debug_getRawBlock

Returns a raw block.

Input:

  • String - Block number or block hash.

Output:

  • String - Raw block data as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "debug_getRawBlock",
  "params": ["latest"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xf90211a0..."
}

debug_getRawHeader

Returns a raw block header.

Input:

  • String - Block number or block hash.

Output:

  • String - Raw block header data as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "debug_getRawHeader",
  "params": ["latest"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xf901..."
}

debug_getRawReceipts

Returns raw receipts.

Input:

  • String - Block number or block hash.

Output:

  • Array - List of raw receipt objects.

Example:

{
  "jsonrpc": "2.0",
  "method": "debug_getRawReceipts",
  "params": ["latest"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": ["0xf8438080...", "0xf8438080..."]
}

debug_getRawTransaction

Returns a raw transaction.

Input:

  • String - Transaction hash.

Output:

  • String - Raw transaction data as a hexadecimal string.

Example:

{
  "jsonrpc": "2.0",
  "method": "debug_getRawTransaction",
  "params": ["0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xf86b80843b9aca0082520894a8d7e4fcf4422f17713da6a5a4740a54b3eb3d4880de0b6b3a76400008025a0..."
}
JSON-RPC
Ethereum JSON-RPC API