IntersectMBO / IntersectMBO/cardano-api
gRPC: Replace Ogmios as Kupo's chain data source with cardano-rpc gRPC
- Dominant language
- Haskell
- Stars
- 40
- Forks
- 30
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 30
Description
## Goal
Enable [Kupo](https://github.com/IntersectMBO/kupo) to use cardano-rpc as a drop-in replacement for its [Ogmios](https://github.com/IntersectMBO/ogmios) backend.
Kupo currently uses Ogmios for chain synchronisation via WebSocket/JSON-RPC.
The same capability can be provided natively by cardano-rpc over gRPC, eliminating the need for a separate Ogmios process.
## Kupo's Ogmios usage
Kupo depends on exactly three Ogmios methods:
| Ogmios method | Mini-protocol | Purpose |
|---|---|---|
| `findIntersection` | ChainSync | Resume sync from a known chain point |
| `nextBlock` | ChainSync | Stream blocks (RollForward/RollBackward) with full block data |
| `queryNetwork/genesisConfiguration` | Network query | One-shot Byron genesis bootstrap (optional if local genesis files available) |
Additionally, Kupo's HTTP API uses a separate Ogmios connection for ad-hoc historical block lookups (e.g. the `/metadata` endpoint fetches a block by slot on demand).
## Required gRPC services
1. **`SyncService.FollowTip`** - #1219
Server-streaming RPC delivering blocks as applied/rolled back.
Must carry full block data (transactions, inputs, outputs, datums, scripts, redeemers, metadata).
This is the primary blocker - replaces Ogmios's `findIntersection` + `nextBlock` streaming.
2. **`SyncService.FetchBlock`** - #1216
Retrieve a full block by chain point.
Required for Kupo's HTTP API endpoints that perform ad-hoc historical block lookups (e.g. `/metadata`).
3. **`QueryService.ReadGenesis`** - #1217
Return genesis configuration for all eras.
Only required when Kupo cannot read genesis files from disk.
## Prerequisites
- ADR-019 (node kernel access) - direct ChainDB access is needed for efficient block streaming and block-by-point retrieval.
Current N2C IPC (one connection per request, double serialisation) cannot support this.
## Not required for this goal
- `ReadTip` (#1218) - same SyncService cluster, likely lands alongside FollowTip, but Kupo does not use it (tip comes back in FollowTip responses)
- `SubmitTx`, `EvalTx` - already implemented, Kupo does not use them
- Mempool watching, stake/governance queries - Kupo does not use them
## Downstream integration
Once the gRPC services exist, Kupo needs a new `ChainProducer` backend (alongside its existing `CardanoNode`, `Ogmios`, `Hydra` backends) that connects via gRPC instead of WebSocket.
Contributor guide
Assessment
This issue has not been assessed yet.