Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPS-0012? | Query Layer Standardization #625

Merged
merged 21 commits into from
Sep 3, 2024
Merged
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c4dddef
Add a draft for Query Layer Standardization
klntsky Nov 27, 2023
5798cfc
added PR number to discussions
rphair Nov 28, 2023
9114d90
Apply suggestions from code review
klntsky Nov 29, 2023
cd09dcb
Expand use cases and ecosystem risks
klntsky Dec 14, 2023
149a788
Merge branch 'klntsky/query-layer-cps' of github.com:klntsky/CIPs int…
klntsky Dec 14, 2023
1c4a9dd
assign CIP number 113
rphair Jan 27, 2024
3fcded0
accidentally promoted as CIP instead of CPS
rphair Jan 27, 2024
30b07b1
Merge remote-tracking branch 'klntsky/klntsky/query-layer-cps' into k…
klntsky Jan 30, 2024
dc4a928
Update CPS-0012 directory name
klntsky Jan 30, 2024
d9753a7
removing artefact HTML comment from CPS template
rphair Jan 31, 2024
ea6d3d4
removing invalid YAML for formatted Discord reference
rphair Jan 31, 2024
6d5cae1
more + deeper links to Discord discussions
rphair Jan 31, 2024
8c2e31f
add feedback from workshop 1 replacing PR #1
Ryun1 Mar 6, 2024
8e929cc
Update CPS-0012/README.md
Ryun1 Apr 18, 2024
0073fbe
fix typo
Ryun1 Apr 18, 2024
aa513fc
Merge pull request #2 from Ryun1/query-layer-cps-workshop-1-backup
klntsky May 13, 2024
a5d16f3
Apply suggestions from code review
klntsky May 13, 2024
2fec176
add adoption barriers and open new open question
Ryun1 May 13, 2024
7be35e6
Merge pull request #4 from Ryun1/ryun1/query-layer-cps-adoption-discu…
klntsky May 16, 2024
f707e81
Apply suggestions from code review
klntsky Aug 20, 2024
c1ff8ab
Apply suggestions from code review
klntsky Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions CPS-0012/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
CPS: 12
Title: Query Layer Standardization
Status: Open
Category: Tools
Authors:
- Vladimir Kalnitsky <vladimir@mlabs.city>
Proposed Solutions: []
Discussions:
- https://github.com/cardano-foundation/CIPs/pull/625
- `#wallet-connectors` in CIP editors Discord: https://discord.gg/tkp6r6ESJR
rphair marked this conversation as resolved.
Show resolved Hide resolved
Created: 2023-11-27
---

## Abstract

Cardano lacks a standardized query layer. This leads to suboptimal tooling, dApp and wallet architecture.

## Problem

### Query Layers and Tooling

Lack of a standardized query layer results in multiple different implementations of roughly the same set of functionality:

- [Blockfrost](https://blockfrost.io/)
- [Koios](https://www.koios.rest/)
- [Maestro](https://www.gomaestro.org)
- [Ogmios](https://ogmios.dev/)

As a result, there is a need to support multiple incompatible APIs in downstream tools, examples of which are:

- [Mesh.js](https://meshjs.dev/providers)
- [Lucid](https://lucid.spacebudz.io/)
- [cardano-transaction-library](https://github.com/Plutonomicon/cardano-transaction-lib/blob/develop/doc/runtime.md)

Query layer providers are not identical, which means that the *promise* of abstracting away from a particular query layer provider completely, that an offchain library may want to give to its users, will either be left *unfulfilled* (i.e. some features will work with some providers, but not others) or the scope of the downstream API will have to be *reduced* to the very minimum that is covered by every supported query layer.

### Query Layers and Wallets

This CPS initiative originated in the discussion about [Extensive Wallet Standard CIP](https://github.com/cardano-foundation/CIPs/pull/620) in [Discord](https://discord.com/channels/971785110770831360/992011119872970762/1176567729017327737) ([invite](https://discord.gg/P59aNVN8zu)).
rphair marked this conversation as resolved.
Show resolved Hide resolved

Every light wallet has its own backend infrastructure: functioning of the browser extension relies on the availability of the data sources. However, none of the wallets currently provide a way to override their query layer endpoint URLs.

In the past, users have encountered problems with ability to submit transactions due to limited mempool capacity, which resulted in some wallets providing a way to configure custom [tx-submit-api](https://github.com/blinklabs-io/tx-submit-api) endpoints - but this only covers transaction submission.

Tight coupling between wallets and query layers results in unnecessary economic burden imposed on wallets, and forces them to make opinionated choices (of query layer provider) that could otherwise be delegated to the end user, similarly to how it is done in Metamask with RPC provider selection.

The economic burden, in turn, results in discouraging of innovation in the wallet ecosystem, because there is a very strong pressure to keep wallet standards minimal coming from wallet providers.

Another downside of tight coupling between wallets and query layers is that, unlike Ethereum wallets, Cardano wallets can't be used to interact with dApps deployed to custom (private) testnets. Only public testnets are supported, and as a result in order to simply test a dApp end-to-end, it must be deployed to a public testnet. This is a privacy concern for dApp developers, because making on-chain contracts available publicly (although in a compiled form) before they are officially open-sourced can be seen as data breach.

### Centralization and Ecosystem Risks

Inability to interchange query layer providers results in vendor lock-in. Query layer providers are disincentivized to opensource their infrastructure setup or provide a competitive service. Dependency on a fixed set of entities to run the infrastructure makes it easier for adversaries to attack dApps by taking over the infrastructure.
klntsky marked this conversation as resolved.
Show resolved Hide resolved

## Use cases

- Wallets want to provide their end users with ability to run custom query layer software
- dApp developers want to avoid vendor lock-in
- New Cardano infrastructure providers want to join pools of interchangeable query layer suppliers, instead of replicating or deploying one of the many competing products

## Goals

1. Create an extensive query layer API specification that is not tied to any particular implementation

2. Describe how can it be used in different contexts: HTTP API, JavaScript interfaces, ???
klntsky marked this conversation as resolved.
Show resolved Hide resolved

## Open Questions

<!-- A set of questions to which any proposed solution should find an answer. Questions should help guide solutions design by highlighting some foreseen vulnerabilities or design flaws. Solutions in the form of CIP should thereby include these questions as part of their 'Rationale' section and provide an argued answer to each. -->

- How can we encourage query layer providers to adopt the solution?
- How can we encourage wallet developers to adopt the solution?
- How can we encourage dApp developers to adopt the solution?