API Reference

Pocket Network exposes APIs at two levels: the Shannon chain (CometBFT/Cosmos SDK endpoints for on-chain operations) and the PATH gateway (relay forwarding and gateway management). Most developers only need the relay endpoints — the chain API is for operators and protocol integrators.

Warning

This page is a structural reference. Full OpenAPI specs exist in the poktroll and PATH repositories. The definitive API documentation is generated from those specs.

Relay API (Gateway/PATH)

This is what application developers interact with. Relay endpoints accept standard JSON-RPC requests and forward them through the Pocket Network to backend chains.

Endpoint Format

plaintext
POST https://{chain-slug}.api.pocket.network
Content-Type: application/json

Request Body

Standard JSON-RPC 2.0:

json
{
  "jsonrpc": "2.0",
  "method": "eth_blockNumber",
  "params": [],
  "id": 1
}

Response

Standard JSON-RPC 2.0 response from the backend chain:

json
{
  "jsonrpc": "2.0",
  "result": "0x134a5b8",
  "id": 1
}

Error Codes

HTTP StatusMeaning
200Success (check JSON-RPC error field for RPC-level errors)
400Malformed request
502Backend chain unreachable
503Service unavailable (no suppliers available for this chain)

Shannon Chain API

The Shannon chain (poktroll) exposes standard Cosmos SDK API endpoints. These are used for on-chain operations: staking, querying state, submitting governance proposals, etc.

CometBFT RPC

Default port: 26657

Used for transaction broadcasting, block queries, and consensus state. Standard CometBFT JSON-RPC interface.

bash
# Get latest block
curl http://localhost:26657/block

# Broadcast transaction
curl -X POST http://localhost:26657/broadcast_tx_commit \
  -d '{"tx": "<encoded_tx>"}'

Cosmos REST (LCD)

Default port: 1317

RESTful API for querying chain state. Auto-generated from proto definitions.

bash
# Query application
curl http://localhost:1317/poktroll/application/application/{address}

# Query all suppliers
curl http://localhost:1317/poktroll/supplier/supplier

# Query session
curl http://localhost:1317/poktroll/session/get_session?application_address={addr}&service_id={id}&block_height={height}

# Query shared params
curl http://localhost:1317/poktroll/shared/params

gRPC

Default port: 9090

Protocol Buffers-based API for programmatic access. Fastest option for service integrations.

bash
# Using grpcurl
grpcurl -plaintext localhost:9090 poktroll.application.Query/Application
grpcurl -plaintext localhost:9090 poktroll.supplier.Query/AllSuppliers
grpcurl -plaintext localhost:9090 poktroll.session.Query/GetSession

Key Query Endpoints

ModuleREST PathgRPC Service
Application/poktroll/application/poktroll.application.Query
Supplier/poktroll/supplier/poktroll.supplier.Query
Gateway/poktroll/gateway/poktroll.gateway.Query
Session/poktroll/session/poktroll.session.Query
Service/poktroll/service/poktroll.service.Query
Proof/poktroll/proof/poktroll.proof.Query
Tokenomics/poktroll/tokenomics/poktroll.tokenomics.Query
Shared/poktroll/shared/poktroll.shared.Query

Key Transaction Endpoints

ModuleMessageDescription
ApplicationMsgStakeApplicationStake or update application
ApplicationMsgDelegateToGatewayDelegate to a gateway
SupplierMsgStakeSupplierStake or update supplier
GatewayMsgStakeGatewayStake or update gateway
ServiceMsgAddServiceRegister a new service
ProofMsgCreateClaimSubmit a relay claim
ProofMsgSubmitProofSubmit a relay proof

PATH Gateway API

PATH exposes operational endpoints for monitoring and management:

EndpointPortDescription
/health3069Gateway health status
/ready/<service>3069Per-service readiness check
/metrics9090Prometheus metrics

OpenAPI Specifications

Full machine-readable API specs are available in the source repositories: