RPC Endpoint
Json-RPC API Methods Documentation
Pharos is a high-performance, EVM-compatible Layer 1 blockchain designed to offer a seamless development experience for Ethereum developers. Anyone familiar with Ethereum's ecosystem will find building on Pharos intuitive and efficient.
Pharos provides a JSON-RPC interface for blockchain interactions. Developers can refer to the RPC-API documentation for a comprehensive list of supported methods.
Currently, Pharos is under active development and running in a private DevNet . Public RPC endpoints and access details will be announced in the near future.
This section serves as an interactive reference for Pharos' JSON-RPC API , helping developers integrate and interact with the network effectively.
EVM Example
Example ERC-20 Token Details
To ensure a consistent reference, below is a predefined ERC-20 token example instead of selecting a random one from the chain explorer.
Token Name: Pharos Test Token (PTT)
Smart Contract Address: 0xcB8a4dF93DEB878ae10044E37Ffc1ea7450630b8
Example RPC Calls
Below are sample RPC requests using the Pharos Devnet endpoint.
1. Get the Latest Block Number
Request:
Copy {
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}
Curl Example:
Copy curl <https://devnet.dplabs-internal.com/> \\
-X POST \\
-H "Content-Type: application/json" \\
--data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
Response:
Copy {
"jsonrpc": "2.0",
"id": 1,
"result": "0x1fdde"
}
2. Get Token Balance of an Address
Request:
Copy {
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"to": "0x9C05F9bED4d87541722048558556BBAE197ea481",
"data": "0x70a08231000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdef"
}, "latest"],
"id": 1
}
Curl Example:
Copy curl <https://devnet.dplabs-internal.com/> \\
-X POST \\
-H "Content-Type: application/json" \\
--data '{"method":"eth_call","params":[{"from": null,"to":"0x9C05F9bED4d87541722048558556BBAE197ea481","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"}, "latest", {"0x1111111111111111111111111111111111111111": {"balance": "0xFFFFFFFFFFFFFFFFFFFF"}}],"id":1,"jsonrpc":"2.0"}'
Response:
Copy {
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
3. Get Token Transfer Events
Request:
Copy {
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{
"fromBlock": "0x186a0",
"toBlock": "latest",
"address": "0x9C05F9bED4d87541722048558556BBAE197ea481",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}],
"id": 1
}
Curl Example:
Copy curl -X POST <https://devnet.dplabs-internal.com> \\
-H "Content-Type: application/json" \\
-d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":"0x186a0","toBlock":"latest","address":"0x9C05F9bED4d87541722048558556BBAE197ea481","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],"id":1}'
curl <https://devnet.dplabs-internal.com/> \\
-X POST \\
-H "Content-Type: application/json" \\
--data '{"method":"eth_getLogs","params":[{"address": "0x9C05F9bED4d87541722048558556BBAE197ea481", "topics":["0xxxx"]}],"id":1,"jsonrpc":"2.0"}'
Response:
Copy {
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x9C05F9bED4d87541722048558556BBAE197ea481",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdef",
"0x000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdef"
],
"data": "0x0000000000000000000000000000000000000000000000000000000005f5e100",
"blockNumber": "0x1a4",
"transactionHash": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef",
"transactionIndex": "0x0",
"blockHash": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef",
"logIndex": "0x0",
"removed": false
}
]
}
The above examples showcase how to interact with the Pharos Devnet RPC for querying ERC-20 tokens.
Replace contract addresses and data fields with your specific token details where necessary.
For more RPC methods, refer to Ethereum-compatible RPC documentation.
If you have any further questions or need additional examples, please reach out to the Pharos development team.