Pharos Json-RPC API Methods Doc
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:
Response:
eth_gasPrice
Returns the current gas price in Wei.
Input: None
Output: String
- Gas price in Wei
Example:
Response:
eth_blockNumber
Returns the number of the most recent block.
Input: None
Output: String
- Block number in hexadecimal
Example:
Response:
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:
Response:
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:
Response:
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:
Response:
eth_getBlockReceipts
Returns the receipts of all transactions in a block.
Input:
String
- Block number (hexadecimal format)
Output:
Array
- List of transaction receipts
Example:
Response:
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:
Response:
eth_getTransactionByHash
Returns information about a transaction by its hash.
Input:
String
- Transaction hash
Output:
Object
- Transaction details
Example:
Response:
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:
Response:
eth_getTransactionByBlockHashAndIndex
Returns a transaction by block hash and index position.
Input:
String
- Block hashString
- Transaction index (hexadecimal format)
Output:
Object
- Transaction details
Example:
Response:
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:
Response:
eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
Input:
String
- Transaction hash
Output:
Object
- Transaction receipt
Example:
Response:
eth_getLogs
Returns logs matching a given filter.
Input:
Object
- Filter parameters
Output:
Array
- List of log entries
Example:
Response:
eth_chainId
Returns the chain ID of the current network.
Input: None
Output:
String
- The chain ID as a hexadecimal string.
Example:
Response:
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:
Response:
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:
Response:
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:
Response:
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:
Response:
eth_sendRawTransaction
Submits a raw transaction to the network.
Input:
String
- Raw signed transaction data.
Output:
String
- Transaction hash.
Example:
Response:
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:
Response:
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:
Response:
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:
Response:
eth_getAccount
Returns information about an account.
Input:
String
- Address.
Output:
Object
- Account details.
Example:
Response:
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:
Response:
eth_unsubscribe
Unsubscribes from events.
Input:
String
- Subscription ID.
Output:
Boolean
-true
if successful.
Example:
Response:
Network (NET) Methods
net_version
Returns the network ID.
Input: None
Output:
String
- Network ID as a hexadecimal string.
Example:
Response:
Web3 Methods
web3_clientVersion
Returns the client version.
Input: None
Output:
String
- Client version.
Example:
Response:
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:
Response:
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:
Response:
debug_getRawReceipts
Returns raw receipts.
Input:
String
- Block number or block hash.
Output:
Array
- List of raw receipt objects.
Example:
Response:
debug_getRawTransaction
Returns a raw transaction.
Input:
String
- Transaction hash.
Output:
String
- Raw transaction data as a hexadecimal string.
Example:
Response:
Last updated