Skip to content

Add gRPC API alongside JSON-RPC #3

@tac0turtle

Description

@tac0turtle

Summary

Introduce a gRPC server exposing the same blob and header APIs currently served over JSON-RPC. gRPC provides better performance characteristics (binary serialization, HTTP/2 multiplexing, streaming) which matters for high-throughput namespace indexing workloads.

Motivation

  • Performance: Protobuf encoding is significantly faster and smaller than JSON-RPC payloads, especially for blob data which can be large
  • Streaming: gRPC bidirectional streaming is a natural fit for Subscribe methods (headers, blobs)
  • Type safety: Protobuf service definitions provide a strict contract and codegen for clients
  • Ecosystem: Many Cosmos/Celestia ecosystem tools already use gRPC as the primary transport

Requirements

Proto definitions

  • Define BlobService and HeaderService in .proto files
  • Mirror the same methods as the JSON-RPC API:
    • Blob.Get, Blob.GetAll, Blob.Subscribe (server-stream), Blob.GetProof, Blob.Included
    • Header.GetByHeight, Header.Subscribe (server-stream), Header.LocalHead, Header.NetworkHead

Server

  • gRPC server listening on a configurable port (separate from JSON-RPC)
  • Add [grpc] address config field
  • Reuse the same underlying store and sync engine — no logic duplication

Client (optional, for testing/tooling)

  • Generated Go client from proto definitions
  • CLI or test harness that can exercise the gRPC endpoints

Non-goals

  • Replacing JSON-RPC — both transports coexist. JSON-RPC remains the default for ev-node compatibility.

References

  • Design doc: test_plan.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions