Skip to content

Implement Celestia node JSON-RPC compatibility layer #2

Description

@tac0turtle

Summary

Implement the JSON-RPC server and API modules that replicate the celestia-node RPC interface ev-node expects. This is the core API surface that makes apex a drop-in replacement for celestia-node.

Context

ev-node communicates with celestia-node over JSON-RPC (go-jsonrpc). Apex must expose the same interface so ev-node requires zero modifications. This covers Phase 2 of the implementation plan plus the stub modules from Phase 3.

Requirements

Blob module (pkg/api/blob.go)

  • Get(height, namespace, commitment) — query SQLite by height+ns+commitment
  • GetAll(height, namespaces[]) — query SQLite, filter to tracked namespaces
  • Subscribe(namespace) — real-time streaming via subscription manager
  • GetProof(height, namespace, commitment) — retrieve stored NMT proofs
  • Included(height, namespace, proof, commitment) — verify against stored data
  • GetCommitmentProof(...) — return "not supported" error (requires full EDS)
  • Submit(...) — return "not supported" error (read-only service)

Header module (pkg/api/header.go)

  • GetByHeight(height) — local store with upstream fallback
  • Subscribe() — stream new headers
  • LocalHead() — last synced height
  • NetworkHead() — query upstream

Stub modules

  • share — return "not supported" errors
  • fraud — return "not supported" errors
  • blobstream — return "not supported" errors

Server (pkg/api/server.go)

  • JSON-RPC server using go-jsonrpc (matching celestia-node's pattern)
  • Configurable listen address ([rpc] address)
  • Register all modules above

Verification

  • Point ev-node at apex instead of celestia-node — should work without changes
  • Test subscription streaming under load
  • Verify error responses match celestia-node format for unsupported methods

References

  • celestia-node api/rpc/server.go — server pattern
  • celestia-node nodebuilder/blob/blob.go — module interface
  • celestia-node api/client/read_client.go — required modules
  • Design doc: test_plan.md — API Compatibility section

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions