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

Extend URI scheme with single stake pool links #61

Merged
merged 10 commits into from
Mar 30, 2021
72 changes: 62 additions & 10 deletions CIP-0013/CIP-0013.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
---
CIP: 13
Title: Cardano URI Scheme
Authors: Sebastien Guillemot <sebastien@emurgo.io>, Vicente Almonacid <vicente@emurgo.io>
Authors: Sebastien Guillemot <sebastien@emurgo.io>, Vicente Almonacid <vicente@emurgo.io>, Robert Phair <rphair@cosd.com>
Comments-URI:
- https://github.com/Emurgo/EmIPs/pull/2
- https://forum.cardano.org/t/cip-cardano-payment-uri-scheme/41457
- https://github.com/cardano-foundation/CIPs/pull/25
- https://forum.cardano.org/t/cip-stake-uri-scheme-for-pools-delegation-portfolios/40594
Status: Draft
Type: Informational
Created: 2020-10-20
Created: 2020-09-22
License: CC-BY-4.0
---

# Abstract

This proposal describes a basic URI scheme to handle ADA transfers, as well
as possible approaches for a multiplatform implementation.
This proposal describes a basic URI scheme to handle ADA transfers and links to stake pools, as well as possible approaches for a multiplatform implementation.
rphair marked this conversation as resolved.
Show resolved Hide resolved

# Motivation

#### For payment URIs:

Users who create community content often want donations as a financial incentive. However, forcing users to open their wallet and copy-paste an address lowers the amount of people likely to send tokens (especially if they have to sync their wallet first).

If donating was as simple as clicking a link that opens a light wallet with pre-populated fields, users may be more willing to send tokens. URI schemes would enable users to easily make payments by simply clicking links on webpages or scanning QR Codes.

#### For stake pool URIs:

Centralised sources of information, such as the Daedalus ranking algorithm and its presentation to the delegating user, have led a growing amount of stake to be disproportionately assigned to pools pushed near & beyond the saturation point.
rphair marked this conversation as resolved.
Show resolved Hide resolved
rphair marked this conversation as resolved.
Show resolved Hide resolved

Stake pool URIs will provide a convenient and popular alternative to the trend of stake centralisation, while supporting diversity and resilience in the Cardano network.
rphair marked this conversation as resolved.
Show resolved Hide resolved

# Specification

The core implementation should follow the [BIP-21](https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki) standard (with `bitcoin:` replaced with `web+cardano:`)
Expand All @@ -30,9 +39,11 @@ Rationale:
- Use `cardano:` over `ada:` as other projects that implement this standard tend to take the project name over the currency name (this makes sense if we consider this protocol as a generic way for interacting with the blockchain through wallets - as opposed to a simple payment system)
- Many wallets support multiple currencies. Following the same standard will ensure higher adoption of our protocol.

Example:
Examples:
```
<a href="web+cardano:Ae2tdPwUPEZ76BjmWDTS7poTekAvNqBjgfthF92pSLSDVpRVnLP7meaFhVd">Donate</a>
<a href="web+cardano://stake?c94e6fe1123bf111b77b57994bcd836af8ba2b3aa72cfcefbec2d3d4">Stake with us</a>
<a href="web+cardano://stake?COSD">Choose our least saturated pool</a>
```

## Considerations
Expand All @@ -43,27 +54,64 @@ Example:

## ABNF Grammar (Proposal)

This is an initial, simplified protocol definition for fast implementation; it only requires an address and an optional amount parameter. As discussed above, these rules are likely to evolve in time in order to support additional features, including unique capabilities of the Cardano blockchain.
This is an initial, simplified protocol definition for fast implementation; it only requires:

* for a payment URI (authority unspecified), an address and an optional amount parameter;
* for a stake pool URI (authority = `stake`), a single stake pool reference.

As discussed above, these rules are likely to evolve in time in order to support additional features, including multiple stake pool references (in proportions defining a "portfolio") and other unique capabilities of the Cardano blockchain.

```
cardanourn = "web+cardano:" cardanoaddress [ "?" amountparam ]
cardanourn = "web+cardano:" (paymentref | stakepoolref)

paymentref = cardanoaddress [ "?" amountparam ]
cardanoaddress = *(base58 | bech32)
amountparam = "amount=" *digit [ "." *digit ]
amountparam = "amount=" *digit [ "." *digit ]

stakepoolref = "//stake?" stakepool
stakepool = poolhexid | poolticker
poolhexid = 56HEXDIG
poolticker = 3*5UNICODE
```

### Payment URI queries

The amount parameter must follow the [same rules](https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki#transfer-amountsize) described in BIP-21, namely, it must be specified in decimal ADA, without commas and using the period (.) decimal separator.

### Stake pool URI queries

For brevity, essential in many Internet contexts, `poolticker` must be supported here in addition to the unambiguous `poolhexid`. A safe interpretation of `poolticker` should be assured by the Daedalus wallet's integration with [SMASH](https://github.com/input-output-hk/smash) metadata.
rphair marked this conversation as resolved.
Show resolved Hide resolved

When there is more than one pool registered with the specified `poolTicker` (whether for pool groups which have the same ticker for all pools, or for separate pools using the same ticker), the choice to which pool to finally delegate is left to the user through the wallet UI.

In all cases above, the wallet UI must select, out of multiple wallets, which wallet(s) the user will be delegating from, and should confirm the exact choice even when it is unambiguous from the URI.

These yet unsupported parameters in the URI query string should (by preference of the wallet UI designers) *either* be ignored *or* generate a warning message, to avoid leading the user to believe they are implementing a currently unsupported but perhaps popularly referenced multi-pool delegation list:
rphair marked this conversation as resolved.
Show resolved Hide resolved

* any value for the first URI query argument;
* any URI query argument beyond the first.

## Security Considerations

1. We cannot prompt the user to send the funds right away as they may not be fully aware of the URI they clicked or were redirected to. Instead, it may be better to simply pre-populate fields in a transaction.
2. We should be wary of people who disguise “donate” links as actually opening up a phishing website that LOOKS like a wallet.
1. For payment links, we cannot prompt the user to send the funds right away as they may not be fully aware of the URI they clicked or were redirected to. Instead, it may be better to simply pre-populate fields in a transaction.
2. For either payment or staking links, we should be wary of people who disguise links as actually opening up a phishing website that LOOKS like that corresponding part of the wallet UI.

# Rationale

## Why not use Universal links, deep links and other non-protocol-based Solution

An alternative solution to the original problem described above is to use standard URL links in combination with a routing backend system. The routing system is used to redirect to the app's URI. The advantage of this scheme is that it allows to provide a fallback mechanism to handle the case when no application implementing the protocol is installed (for instance, by redirecting to the App Store or Google Play). This is the approach behind iOS Universal Links and Android App Links. In general, it provides a better user experience but requires a centralized system which makes it unsuitable for as a multi-app standard.

## Why stake pool links are important
rphair marked this conversation as resolved.
Show resolved Hide resolved

The popular choice for Cardano stake pool promotion has so far been an already saturated and heavily centralised YouTube market for stake pool promotional videos, purporting to be educational while collectively carrying rapidly obsoleted information and exploitative influences. Stake pools should also be directly supported by delegators based on *relevant HTML content* to create an ecosystem with relevance and accountability.
rphair marked this conversation as resolved.
Show resolved Hide resolved

As K continues to increase, options for convenient *and informed* re-delegation will be more important as Ada holders face pool saturation more often. Both delegators and small pools looking to survive will inevitably rely on sources of information outside the wallet to connect delegators with pools beyond the highly contested top choices of the in-wallet ranking algorithms. Larger pools and collectives will also need these URIs to provide an "exit strategy" from saturating or saturated pools to preferred alternates.
rphair marked this conversation as resolved.
Show resolved Hide resolved

A sudden DeFi migration to Cardano would cause a vast, sudden increase in transaction frequency and depth that the stake pool network will need to support with quality and diversity. A flow of delegation following small stake pool URIs will help maintain a number of pools sufficient to accommodate Cardano's needs during such expansion periods, by encouraging smaller operators to keep their pools operational and performant.

More meaningful association between a pool's social identity and delegated stake will help ensure that pool operators are rewarded, by their own communities and other supporters. This will be further encouraged as when multiple pool links develop from this URI standard, which can implement crowd-sourced delegation to large numbers of smaller pools based on common interests.
rphair marked this conversation as resolved.
Show resolved Hide resolved

## Read More

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler
Expand All @@ -75,3 +123,7 @@ https://developer.android.com/training/app-links/deep-linking#adding-filters
https://facebook.github.io/react-native/docs/linking.html

https://developer.apple.com/documentation/uikit/core_app/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app

https://en.wikipedia.org/wiki/Augmented_Backus%E2%80%93Naur_form

https://tools.ietf.org/html/draft-seantek-unicode-in-abnf-00