API Definition
Introduction
Pocket Network's public endpoints are built on the decentralized Pocket Network and do not require any level of client specificity or client configuration. The PATH framwork ensures that you are given the best and fastest response provided by the Pocket Network. This evaluation is made in real-time for your requests.
If a specific request fails, often retrying the request can yield an improved result.
Web Protocols
JSON-RPC
The public endpoints supports all blockchains that use the JSON-RPC 2.0 Specification.
JSON-RPC Supported Methods
List of Supported Methods
The following methods are supported by the public endpoints:
- debug_traceCall
- debug_traceTransaction
- eth_accounts
- eth_blockNumber
- eth_call
- eth_chainId
- eth_coinbase
- eth_estimateGas
- eth_gasPrice
- eth_getBalance
- eth_getBlockByHash
- eth_getBlockByNumber
- eth_getBlockTransactionCountByHash
- eth_getBlockTransactionCountByNumber
- eth_getCode
- eth_getFilterChanges
- eth_getFilterLogs
- eth_getLogs
- eth_getStorageAt
- eth_getTransactionByBlockHashAndIndex
- eth_getTransactionByBlockNumberAndIndex
- eth_getTransactionByHash
- eth_getTransactionCount
- eth_getTransactionReceipt
- eth_getUncleByBlockHashAndIndex
- eth_getUncleByBlockNumberAndIndex
- eth_getUncleCountByBlockHash
- eth_getUncleCountByBlockNumber
- eth_getWork
- eth_hashrate
- eth_mining
- eth_newBlockFilter
- eth_newFilter
- eth_newPendingTransactionFilter
- eth_protocolVersion
- eth_sendRawTransaction
- eth_sendTransaction
- eth_sign
- eth_signTransaction
- eth_syncing
- eth_uninstallFilter
- net_listening
- net_peerCount
- net_version
- web3_clientVersion
- web3_sha3
JSON-RPC to HTTP Status Code Mapping
It's common practice in JSON-RPC-over-HTTP implementations to map:
Client errors(e.g., -32600Invalid Request) to4xxHTTP statusesServer errors(e.g., -32603Internal erroror -32000 "Server error") to5xxHTTP statuses
PATH follows this practice and maps JSON-RPC errors to HTTP status codes as follows:
| JSON-RPC Error Code | Common Meaning | HTTP Status Code |
|---|---|---|
| -32700 | Parse error | 400 Bad Request |
| -32600 | Invalid request | 400 Bad Request |
| -32601 | Method not found | 404 Not Found |
| -32602 | Invalid params | 400 Bad Request |
| -32603 | Internal error | 500 Server Error |
| -32098 | Timeout | 504 Gateway Timeout |
| -32097 | Rate limited | 429 Too Many Requests |
| -32000…-32099 | Server error range | 500 Server Error |
| > 0 | Application errors (client-side) | 400 Bad Request |
| < 0 (other negative) | Application errors (server-side) | 500 Server Error |
JSON-RPC Batch Requests
We support batching requests in adherence to the JSON-RPC 2.0 Specification. Our enhanced batching process ensures superior performance and reliability by providing individual Quality of Service (QoS) for each request within a batch. Additionally, we've updated our relay count policy to reflect the individual attention each request receives.
Batching Process:
- Initial Reception: Batches are received and processed for unpacking.
- Unpacking: The batch is unpacked to individual requests, allowing for tailored processing.
- QoS Processing: Each request undergoes independent QoS processing, ensuring it receives the optimal handling.
- Repacking: After processing, the requests are repackaged into their original batch format.
- Batch Delivery: The processed batch is then delivered back to the customer as a cohesive unit.
REST APIs
We are able to support any RESTful API configuration.
Services that utilize a RESTful API will be provided in accordance with their individual specifications.
Cosmos & CometBFT
We support the CometBFT and Cosmos SDK APIs.
Websockets
We supports WebSocket subscription for a subset of its services.
Recommendations and Considerations
Data Size and Timeouts
Pocket Network's public endpoints cap request and response size at 100MB, however, optimization can help to ensure successful responses.
The endpoints have a 10 second timeout limit, so large or excessive data pulls may fail to return. If you encounter this issue, we recommend reducing the amount of data requested wherever possible and retrying the request.
Logs
Pocket Network's Public Endpoints limit user requests to 100,000 log lines in a request. If you encounter issues when requesting log lines, please reduce the amount of data requested and try again.