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:

JSON-RPC to HTTP Status Code Mapping

It's common practice in JSON-RPC-over-HTTP implementations to map:

  • Client errors (e.g., -32600 Invalid Request) to 4xx HTTP statuses
  • Server errors (e.g., -32603 Internal error or -32000 "Server error") to 5xx HTTP 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:

  1. Initial Reception: Batches are received and processed for unpacking.
  2. Unpacking: The batch is unpacked to individual requests, allowing for tailored processing.
  3. QoS Processing: Each request undergoes independent QoS processing, ensuring it receives the optimal handling.
  4. Repacking: After processing, the requests are repackaged into their original batch format.
  5. 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.