JSON-RPC API Methods
Pharos Network is a fully EVM-equivalent Layer 1 blockchain, supporting a JSON-RPC interface for seamless blockchain interactions. This RPC API is fully compatible with existing Ethereum JSON-RPC API 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_maxPriorityFeePerGas
Get the priority fee needed to be included in a block.
Input: None
Output: String
- The hex value of the priority fee needed to be included in a block
Example:
{
"jsonrpc": "2.0",
"method": "eth_maxPriorityFeePerGas",
"params": [],
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0"
}
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 hashBoolean
- 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 hashString
- 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. REQUIREDString
- blockReference. REQUIRED
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..."
}
}
eth_createAccessList (This interface is still under debugging and returns a null value)
Generates an access list for a transaction to be used with EIP-2930.
Input:
Object
– A transaction call object, excluding accessList (since it’s what this method generates)
from
(optional)
: The sender’s address (20 bytes). If omitted, defaults to the node’s default account.to:
The recipient’s address (20 bytes). Typically the destination contract or externally owned account.gas
(optional)
: The maximum amount of gas allowed for execution, expressed as a hexadecimal value.gasPrice
(optional)
: The legacy-style gas price (in wei), specified as a hexadecimal. Only used in transactions that do not follow EIP-1559.maxPriorityFeePerGas
(optional)
: The tip, in wei, the sender is willing to pay per unit of gas above the base fee. Must be paired with maxFeePerGas for EIP-1559-style transactions.maxFeePerGas
(optional)
:
The total maximum fee per unit of gas (base + tip), in wei. Must be used alongside maxPriorityFeePerGas.value
(optional)
: The amount of Ether to transfer with the transaction, represented as a hexadecimal string in wei.data
(optional)
: The call data, including the method selector and encoded parameters, following Ethereum’s ABI format.
String
– Block identifier (e.g., "latest").
Output:
Object
– An object containing the generated access list and estimated gas usageObject – (null value temporary):
accessList
: An array of access descriptors, each including:address
: The account address that the transaction will access.storageKeys
: An array of storage slot keys (as hex strings) that may be read or written during execution.
gasUsed
: A hexadecimal string representing the estimated gas consumption for the transaction if the suggested access list is applied.
Example:
{
"jsonrpc": "2.0",
"method": "eth_createAccessList",
"params": [
{
"from": "0x8ee...bee",
"to": "0x0000000000000000000000000000000000000000",
"data": "0x60806040..."
},
"latest"
],
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accessList": [],
"gasUsed": "0xb880",
}
}
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..."
}
Last updated