Skip to content

Commit 4720165

Browse files
authored
CIP-0013 | Generalise for further protocols (cardano-foundation#559)
* first draft, will proofread for GitHub flavoured markdown * remove accidentally duplicated line * URI scheme is no longer "basic" but all encompassing * ugly typo at top, need to correct immediately * clarify that other URI standards should have their own CIPs * doc reorganisation means "next" link not appropriate anymore * better clarification of terms used in grammar * ABNF section improperly broken between protocols + badly formatted * makes more sense with *all* stake pool details in one place * former "grammar" only section now includes *interpretation* * final corrections for initial draft * consolidated + simplified language for payment links vs BIP-21 * moved payment Rationale out of Spec, simplified section anchors * typo * current discussion has become significant
1 parent 729bf52 commit 4720165

File tree

1 file changed

+71
-37
lines changed

1 file changed

+71
-37
lines changed

CIP-0013/README.md

Lines changed: 71 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Title: Cardano URI Scheme
44
Status: Proposed
55
Category: Wallets
66
Authors:
7+
- Robert Phair <[email protected]>
78
- Sebastien Guillemot <[email protected]>
89
- Vicente Almonacid <[email protected]>
9-
- Robert Phair <[email protected]>
1010
Implementors: N/A
1111
Discussions:
1212
- https://github.com/Emurgo/EmIPs/pull/2
@@ -15,16 +15,25 @@ Discussions:
1515
- https://github.com/cardano-foundation/CIPs/pull/61
1616
- https://github.com/cardano-foundation/CIPs/pull/86
1717
- https://forum.cardano.org/t/cip-stake-uri-scheme-for-pools-delegation-portfolios/40594
18+
- https://forum.cardano.org/t/cip-generalized-cardano-urls/57464
19+
- https://github.com/cardano-foundation/CIPs/pull/546
20+
- https://github.com/cardano-foundation/CIPs/pull/559
1821
Created: 2020-09-22
1922
License: CC-BY-4.0
2023
---
2124

2225
## Abstract
2326

24-
This proposal describes a basic URI scheme to handle Ada transfers and links to single stake pools or weighted lists of multiple pools.
27+
This describes a general standard URI scheme with two specific protocols to handle Ada transfers and links to weighted lists of stake pools.
2528

2629
## Motivation: why is this CIP necessary?
2730

31+
### In general:
32+
33+
Developers of protocols that use URI schemes should be able to choose unique protocol keywords indicating how these links are handled by applications.
34+
35+
Beyond the two earliest defined protocols below, protocols using distinct keywords (e.g. `//stake`) can be defined in other CIPs and implemented without ambiguity by applications which interpret those particular URI protocols.
36+
2837
### For payment URIs:
2938

3039
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).
@@ -49,74 +58,79 @@ URIs for weighted stake pool lists provide alternatives to using a JSON file to
4958

5059
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:`)
5160

52-
Rationale:
53-
- 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)
54-
- Many wallets support multiple currencies. Following the same standard will ensure higher adoption of our protocol.
55-
5661
Examples:
5762
```
5863
<a href="web+cardano:Ae2tdPwUPEZ76BjmWDTS7poTekAvNqBjgfthF92pSLSDVpRVnLP7meaFhVd">Donate</a>
5964
<a href="web+cardano://stake?c94e6fe1123bf111b77b57994bcd836af8ba2b3aa72cfcefbec2d3d4">Stake with us</a>
6065
<a href="web+cardano://stake?POOL1=3.14159&POOL2=2.71828">Split between our 2 related pools</a>
6166
<a href="web+cardano://stake?COSD">Choose our least saturated pool</a>
67+
<a href="web+cardano://claim/v1?faucet_url=https%3A%2F%2Fclaim.hosky.io&code=consensus2023">Claim $HOSKY</a>
6268
```
6369

64-
### Considerations
70+
The protocol term (e.g. `//stake`) is called the _authority_ as defined in [Wikipedia > Uniform Resource Identifier > Syntax](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax).
6571

66-
1. BIP-21 is limited to only features Bitcoin supports. A similar feature for Ethereum would, for example, also support gas as an extra parameter. BIP-21 is easily extensible but we have to take precaution to avoid different wallets having different implementations of these features as they become available on Cardano. To get an idea of some extra features that could be added, consider this (still under discussion) proposal for Ethereum: [EIP-681](https://eips.ethereum.org/EIPS/eip-681)
72+
### Choice of URI scheme name
6773

68-
2. Depending on the protocol registration method (see next section), browsers generally enforce a `web+` or `ext+` prefix for non-whitelisted protocols (note: `bitcoin:` was whitelisted; see [registerProtocolHandler > Permitted schemes](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler#permitted_schemes)). The prefix `ext+` is recommended for extensions, but not mandatory (see [protocol_handlers](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/protocol_handlers)).
74+
`cardano:` is chosen over `ada:` because 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 and dApps - as opposed to a simple payment system).
6975

70-
### ABNF Grammar (Proposal)
76+
Depending on the protocol registration method (see Rationale), browsers generally enforce a `web+` or `ext+` prefix for non-whitelisted protocols (note: `bitcoin:` was whitelisted; see [registerProtocolHandler > Permitted schemes](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler#permitted_schemes)). The prefix `ext+` is recommended for extensions, but not mandatory (see [protocol_handlers](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/protocol_handlers)).
7177

72-
This is an initial, simplified protocol definition for fast implementation; it only requires:
78+
### Grammar & interpretation
7379

74-
* for a payment URI (authority unspecified), an address and an optional amount parameter;
75-
* for a stake pool URI (authority = `stake`), a weighted list of one or more stake pools.
80+
This top-level definition is mainly to allow switching to a particular protocol for each separately defined `authority`, with a payment link being the default:
7681

77-
As discussed above, these rules are likely to evolve in order to support other capabilities of the Cardano blockchain.
82+
* When `authority` is unspecified, it is a payment URI (with an address and an optional amount parameter;
83+
* When `authority` is explicit (containing `//` followed by the authority keyword), it is defined in the `//stake` case below or in a separate CIP for that protocol.
7884

7985
```
80-
cardanourn = "web+cardano:" (paymentref | stakepoolref)
81-
82-
paymentref = cardanoaddress [ "?" amountparam ]
83-
cardanoaddress = *(base58 | bech32)
84-
amountparam = "amount=" *digit [ "." *digit ]
85-
86-
stakepoolref = "//stake" stakequery
87-
stakequery = ( "?" stakepoolpair) *( "&" stakepoolpair)
88-
stakepoolpair = stakepool [ "=" proportion]
86+
cardanouri = "web+cardano:" (paymentref | authorityref)
8987
90-
stakepool = poolhexid | poolticker
91-
poolhexid = 56HEXDIG
92-
poolticker = 3*5UNICODE
93-
94-
proportion = *digit [ "." *digit ]
88+
authorityref = (stakepoolref | otherref)
89+
otherref = "//" authority query
9590
```
9691

9792
For grammar reference, see:
9893

9994
- [Wikipedia > Augmented Backus–Naur form](https://en.wikipedia.org/wiki/Augmented_Backus%E2%80%93Naur_form)
95+
- [RFC 2234: Augmented BNF for Syntax Specifications: ABNF](https://datatracker.ietf.org/doc/html/rfc2234)
10096
- [Unicode in ABNF](https://tools.ietf.org/html/draft-seantek-unicode-in-abnf-00)
10197

10298
#### Payment URI queries
10399

100+
```
101+
paymentref = cardanoaddress [ "?" amountparam ]
102+
cardanoaddress = *(base58 | bech32)
103+
amountparam = "amount=" *digit [ "." *digit ]
104+
```
105+
104106
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.
105107

106108
#### Stake pool URI queries
107109

108-
For brevity, essential in many Internet contexts, `poolticker` must be supported here in addition to the unambiguous `poolhexid`.
110+
```
111+
stakepoolref = "//stake" query
112+
query = ( "?" stakepoolpair) *( "&" stakepoolpair)
113+
stakepoolpair = stakepool [ "=" proportion]
109114
110-
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.
115+
stakepool = poolhexid | poolticker
116+
poolhexid = 56HEXDIG
117+
poolticker = 3*5UNICODE
118+
119+
proportion = *digit [ "." *digit ]
120+
```
121+
122+
For brevity, essential in many Internet contexts, `poolticker` must be supported here in addition to the unambiguous `poolhexid`.
111123

112-
##### Interpretation of `proportion`:
124+
##### Interpretation of `proportion`
113125

114126
* If only one stake pool is specified, any proportion is meaningless and ignored.
115127
* 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.
116128
* Any missing `proportion` is assigned a precise value of `1`.
117129
* If a stake pool is listed multiple times, the URI is rejected as invalid.
118130

119-
### Handling stake pool links
131+
##### Handling stake pool links
132+
133+
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.
120134

121135
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.
122136

@@ -125,6 +139,10 @@ If, during a wallet or other application's development process, it is still only
125139
* any value for the first URI query argument;
126140
* any URI query argument beyond the first.
127141

142+
#### Other URI queries
143+
144+
An ABNF grammar should be specified and explained similarly for each CIP that defines a new Cardano URI authority by explicitly defining the terms `authority` and `query` as for the "Stake pool" case above.
145+
128146
### Security Considerations
129147

130148
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.
@@ -133,7 +151,9 @@ If, during a wallet or other application's development process, it is still only
133151

134152
## Rationale: how does this CIP achieve its goals?
135153

136-
### Why not use Universal links, deep links or other non-protocol-based Solution?
154+
### Rationale for general URI scheme
155+
156+
#### Why not use Universal links, deep links or other non-protocol-based Solution?
137157

138158
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.
139159

@@ -143,13 +163,21 @@ For background, see
143163
- [Apple Developer Docs > Defining a custom URL scheme for your app](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app)
144164
- [React Native > Linking](https://reactnative.dev/docs/linking.html)
145165

146-
### How URI delegation portfolio links supplement use of JSON files for the same purpose?
166+
### Rationale for payment links
167+
168+
#### Why confine payment links to address and amount like BIP-21?
169+
170+
BIP-21 is limited to only features Bitcoin supports. A similar feature for Ethereum would, for example, also support gas as an extra parameter. BIP-21 is easily extensible but we have to take precaution to avoid different wallets having different implementations of these features as they become available on Cardano. To get an idea of some extra features that could be added, consider this (still under discussion) proposal for Ethereum: [EIP-681](https://eips.ethereum.org/EIPS/eip-681)
171+
172+
### Rationale for stake pool links
173+
174+
#### How do URI delegation portfolio links supplement use of JSON files for the same purpose?
147175

148176
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.
149177

150178
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.
151179

152-
For a CIP based on this principle, see [CIP-0017](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0017).
180+
For a CIP based on this principle, see [CIP-0017](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0017/README.md).
153181

154182
## Path to Active
155183

@@ -159,18 +187,24 @@ For a CIP based on this principle, see [CIP-0017](https://github.com/cardano-fou
159187
- [x] Yoroi
160188
- [x] There exist one or more wallets supporting Stake Pool URIs.
161189
- [ ] TBD
190+
- [x] There exist other CIPs or drafts defining additional URI protocols.
191+
- [ ] There exist one or more wallets supporting additional URI protocols.
192+
- [ ] TBD
162193

163194
### Implementation Plan
164195

165-
Survey contemporary wallet developers to suggest adoption of both feature sets, since they are likely to be considered separately:
196+
Encourage wallet and dApp developers to support all currently defined URI protocols, keeping in mind these are each likely to be considered separately:
166197

167198
- Payment URIs
168199
- Stake Pool URIs
200+
- all other URI schemes defined in separate CIPs
169201

170-
This survey can be conducted and/or advocated by either (ideally both):
202+
Education and advocacy about these standards should be done by:
171203

204+
- Developers of applications and standards requiring new URI schemes
172205
- Cardano sponsoring companies
173206
- Community advocates
207+
- CIP editors
174208

175209
## Copyright
176210

0 commit comments

Comments
 (0)