From 93ba713a71ff6754411eb72fc11e502940100c52 Mon Sep 17 00:00:00 2001 From: Robert Phair Date: Thu, 29 Jul 2021 05:46:18 +0530 Subject: [PATCH] Extend URI scheme for delegation portfolio links (#86) * added work from PR#25 to support single stake pool links as well * for brevity * for clarity * response to first round of editing by co-author * second round of co-author edits * reclassified wallet integration as Motivation rather than Rationale * 2 of 3 changes from @nicarq via PR 65 * undone most recent commit (removing PR65 suggestions) * undone most recent commit (removing PR65 suggestions) * added remaining multi pool components of PR#25 plus further writing * added current PR link as a Comments-URI * first round of editing from developer feedback --- CIP-0013/CIP-0013.md | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/CIP-0013/CIP-0013.md b/CIP-0013/CIP-0013.md index dfb4b035d4..67c92d2090 100644 --- a/CIP-0013/CIP-0013.md +++ b/CIP-0013/CIP-0013.md @@ -7,6 +7,7 @@ Comments-URI: - https://forum.cardano.org/t/cip-cardano-payment-uri-scheme/41457 - https://github.com/cardano-foundation/CIPs/pull/25 - https://github.com/cardano-foundation/CIPs/pull/61 +- https://github.com/cardano-foundation/CIPs/pull/86 - https://forum.cardano.org/t/cip-stake-uri-scheme-for-pools-delegation-portfolios/40594 Status: Draft Type: Informational @@ -16,7 +17,7 @@ License: CC-BY-4.0 # Abstract -This proposal describes a basic URI scheme to handle Ada transfers and links to stake pools. +This proposal describes a basic URI scheme to handle Ada transfers and links to single stake pools or weighted lists of multiple pools. # Motivation @@ -34,10 +35,12 @@ Stake pool URIs will provide an additional means for small pools to acquire dele Interfaces that connect delegators with pools beyond the highly contested top choices of the in-wallet ranking algorithms are important to avoid saturation and maintain decentralization. -Larger pools and collectives can also use these URIs to link to a family of pools they own to avoid any one of their pools becoming saturated. +Larger pools and collectives can also use these URIs to link to, and spread delegation between, a family of pools they own to avoid any one of their pools becoming saturated. Pool links allow for interfaces to initiate delegation transactions without requiring any code modifications to the wallets themselves. +URIs for weighted stake pool lists provide alternatives to using a JSON file to implement *delegation portfolios* in a way that may better suit certain platforms, applications, or social contexts. + # 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:`) @@ -50,6 +53,7 @@ Examples: ``` Donate Stake with us +Split between our 2 related pools Choose our least saturated pool ``` @@ -64,9 +68,9 @@ Examples: 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. +* for a stake pool URI (authority = `stake`), a weighted list of one or more stake pools. -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. +As discussed above, these rules are likely to evolve in order to support other capabilities of the Cardano blockchain. ``` cardanourn = "web+cardano:" (paymentref | stakepoolref) @@ -75,10 +79,15 @@ paymentref = cardanoaddress [ "?" amountparam ] cardanoaddress = *(base58 | bech32) amountparam = "amount=" *digit [ "." *digit ] -stakepoolref = "//stake?" stakepool +stakepoolref = "//stake" stakequery +stakequery = ( "?" stakepoolpair) *( "&" stakepoolpair) +stakepoolpair = stakepool [ "=" proportion] + stakepool = poolhexid | poolticker poolhexid = 56HEXDIG poolticker = 3*5UNICODE + +proportion = *digit [ "." *digit ] ``` ### Payment URI queries @@ -89,13 +98,20 @@ The amount parameter must follow the [same rules](https://github.com/bitcoin/bip For brevity, essential in many Internet contexts, `poolticker` must be supported here in addition to the unambiguous `poolhexid`. -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. +When there is more than one pool registered with any of the specified `poolticker` parameters (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(s) to finally delegate is left to the user through the wallet UI. + +#### Interpretation of `proportion`: + +* If only one stake pool is specified, any proportion is meaningless and ignored. +* If all stake pools have a numerical proportion, each component of the resulting stake distribution will have the same ratio as the provided `proportion` to the sum of all the propotions. +* Any missing `proportion` is assigned a precise value of `1`. +* If a stake pool is listed multiple times, the URI is rejected as invalid. ### Handling stake pool links The wallet UI should always confirm the exact delegation choice even when it is unambiguous from the URI. When the user has multiple wallets, the wallet UI must select which wallet(s) the user will be delegating from. -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: +If, during a wallet or other application's development process, it is still only able to support single pool links, these 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: * any value for the first URI query argument; * any URI query argument beyond the first. @@ -104,6 +120,7 @@ These yet unsupported parameters in the URI query string should (by preference o 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. +3. If wallets *create* stake pool links, the actual ada or lovelace balance should not be used literally as the `proportion` figure, to avoid revealing the identity of the wallet owner who is creating the portfolio (e.g. the proportions could be scaled to normalise the largest to `1`). # Rationale @@ -111,6 +128,12 @@ These yet unsupported parameters in the URI query string should (by preference o 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. +## How URI delegation portfolio links supplement use of JSON files for the same purpose + +URIs facilitate the "social element" of delegated staking and pool promotion through a socially familiar, easily accessible, and less centralised convention for sharing stake pool references and potential delegation portfolios without having to construct or host a JSON file. + +The processing of a JSON file delivered by a web server will depend highly on a user's platform and might not even be seen by the wallet application at all. With a properly associated `web+cardano:` protocol, developers and users have another option available in case JSON files are not delivered properly to the wallet application. + ## Read More https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler @@ -126,3 +149,5 @@ https://developer.apple.com/documentation/uikit/core_app/allowing_apps_and_websi https://en.wikipedia.org/wiki/Augmented_Backus%E2%80%93Naur_form https://tools.ietf.org/html/draft-seantek-unicode-in-abnf-00 + +https://github.com/cardano-foundation/CIPs/pull/82