-
Notifications
You must be signed in to change notification settings - Fork 334
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
CIP-0013 update #130
Closed
tomislavhoracek
wants to merge
5
commits into
cardano-foundation:master
from
tomislavhoracek:CIP-0013-update
Closed
CIP-0013 update #130
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
badcf0d
Add Daedalus specific protocol handling section
tomislavhoracek 5c2a7ca
Add balance-tx scheme
j-mueller 27ff67b
Update example
j-mueller c7af6ed
Update
j-mueller 2ba48ea
Merge pull request #1 from j-mueller/CIP-0013-update
tomislavhoracek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
CIP: 13 | ||
Title: Cardano URI Scheme | ||
Authors: Sebastien Guillemot <[email protected]>, Vicente Almonacid <[email protected]>, Robert Phair <[email protected]> | ||
Authors: Sebastien Guillemot <[email protected]>, Vicente Almonacid <[email protected]>, Robert Phair <[email protected]>, Tomislav Horaček <[email protected]> | ||
Comments-URI: | ||
- https://github.com/Emurgo/EmIPs/pull/2 | ||
- https://forum.cardano.org/t/cip-cardano-payment-uri-scheme/41457 | ||
|
@@ -17,7 +17,7 @@ License: CC-BY-4.0 | |
|
||
# Abstract | ||
|
||
This proposal describes a basic URI scheme to handle Ada transfers and links to single stake pools or weighted lists of multiple pools. | ||
This proposal describes a basic URI scheme to handle Ada transfers and links to single stake pools or weighted lists of multiple pools, and partial transactions. | ||
|
||
# Motivation | ||
|
||
|
@@ -41,6 +41,13 @@ Pool links allow for interfaces to initiate delegation transactions without requ | |
|
||
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. | ||
|
||
#### For partial transactions: | ||
|
||
Off-chain infrastructure that drives Plutus applications, such as the PAB, creates partial transactions that spend and produce script outputs. These partial transactions need to be balanced, signed, and submitted to the node by a wallet. | ||
|
||
In the [Hosted PAB](https://plutus.readthedocs.io/en/latest/plutus/explanations/pab.html#hosted) deployment scenario, there is no direct communication between PAB and WBE. Whenever a partial transaction is ready to be submitted, the PAB produces a link that contains the partial transaction serialised to URL-encoded string. This link is opened by the user’s wallet, which displays a confirmation dialog to the user and then calls the WBE with the partial transaction. | ||
|
||
|
||
# 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:`) | ||
|
@@ -68,12 +75,13 @@ 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 weighted list of one or more stake pools. | ||
* for a stake pool URI (authority = `stake`), a weighted list of one or more stake pools; | ||
* for a partial transaction URI, a serialised Alonzo transaction | ||
|
||
As discussed above, these rules are likely to evolve in order to support other capabilities of the Cardano blockchain. | ||
|
||
``` | ||
cardanourn = "web+cardano:" (paymentref | stakepoolref) | ||
cardanourn = "web+cardano:" (paymentref | stakepoolref | balancetx) | ||
|
||
paymentref = cardanoaddress [ "?" amountparam ] | ||
cardanoaddress = *(base58 | bech32) | ||
|
@@ -88,6 +96,9 @@ poolhexid = 56HEXDIG | |
poolticker = 3*5UNICODE | ||
|
||
proportion = *digit [ "." *digit ] | ||
|
||
balancetx = "?" payloadparam | ||
payloadparam = "payload=" base64 | ||
``` | ||
|
||
### Payment URI queries | ||
|
@@ -107,6 +118,49 @@ When there is more than one pool registered with any of the specified `poolticke | |
* Any missing `proportion` is assigned a precise value of `1`. | ||
* If a stake pool is listed multiple times, the URI is rejected as invalid. | ||
|
||
### Transaction balancing and signing URI queries | ||
|
||
The JSON payload of this URI shall be passed by Daedalus, or other wallets that handle the link format, directly to the [CWB balance transaction](https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/balanceTransaction) API as its request body. | ||
|
||
The return value of that endpoint shall then be sent to the [Sign transaction](https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/signTransaction) API. | ||
|
||
Finally, the signed transaction shall be sent to the [Submit transaction](https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postExternalTransaction) API. | ||
|
||
#### Interpretation of `payload`: | ||
|
||
The "payload" parameter is the JSON representation of an [ExportTx](https://github.com/input-output-hk/plutus/blob/master/plutus-contract/src/Plutus/Contract/Wallet.hs#L113-L120) value, gzipped and Base-64 encoded using the URL-safe alphabet. The JSON object contains the CBOR-serialised partial transaction, a list of redeemers for script inputs, and a list of resolved outputs used by script inputs. The schema of the request body expected by the [`transaction-balance`](https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/balanceTransaction) endpoint of `cardano-wallet`. | ||
|
||
**Example:** | ||
|
||
```json | ||
{ | ||
"transaction": "84a50081825820cee2e9783e0aa4f697fefcdcfcd8a7e19340ffe11540eae3a3b608991c6b965d010d80018002000e80a30381590a78590a7501000033233223232332232333222323332223233333333222222223233322232333322223232332232333222323332223232332233223232333332222233223322332233223322332233222222323253353033333006300800530070043333573466e1cd55cea8012400046601664646464646464646464646666ae68cdc39aab9d500a480008cccccccccc064cd409c8c8c8cccd5cd19b8735573aa004900011980f981d1aba15002302c357426ae8940088d4170d4c174cd5ce2481035054310005e49926135573ca00226ea8004d5d0a80519a8138141aba150093335502e75ca05a6ae854020ccd540b9d728169aba1500733502704335742a00c66a04e66aa0a8098eb4d5d0a8029919191999ab9a3370e6aae754009200023350213232323333573466e1cd55cea80124000466a05266a084eb4d5d0a80118239aba135744a00446a0c06a60c266ae712401035054310006249926135573ca00226ea8004d5d0a8011919191999ab9a3370e6aae7540092000233502733504275a6ae854008c11cd5d09aba250022350603530613357389201035054310006249926135573ca00226ea8004d5d09aba2500223505c35305d3357389201035054310005e49926135573ca00226ea8004d5d0a80219a813bae35742a00666a04e66aa0a8eb88004d5d0a801181c9aba135744a00446a0b06a60b266ae71241035054310005a49926135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a8011919191999ab9a3370ea00290031180f181d9aba135573ca00646666ae68cdc3a801240084603a608a6ae84d55cf280211999ab9a3370ea00690011180e98181aba135573ca00a46666ae68cdc3a80224000460406eb8d5d09aab9e50062350533530543357389201035054310005549926499264984d55cea80089baa001357426ae8940088d4130d4c134cd5ce249035054310004e49926104d13504b35304c3357389201035054350004d4984d55cf280089baa001504250422212330010030022001222222222212333333333300100b00a00900800700600500400300220012212330010030022001122123300100300212001122123300100300212001122123300100300212001212222300400521222230030052122223002005212222300100520011232230023758002640026aa06a446666aae7c004940388cd4034c010d5d080118019aba200203623232323333573466e1cd55cea801a4000466600e6464646666ae68cdc39aab9d5002480008cc034c0c4d5d0a80119a8098169aba135744a00446a0726a607466ae712401035054310003b49926135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a01eeb8d5d09aba25002235035353036335738921035054310003749926135744a00226aae7940044dd50009110919980080200180110009109198008018011000899aa800bae75a224464460046eac004c8004d540bc88c8cccd55cf80112804919a80419aa81718031aab9d5002300535573ca00460086ae8800c0c44d5d08008891001091091198008020018900089119191999ab9a3370ea002900011a80418029aba135573ca00646666ae68cdc3a801240044a01046a0586a605a66ae712401035054310002e499264984d55cea80089baa001121223002003112200112001232323333573466e1cd55cea8012400046600c600e6ae854008dd69aba135744a00446a04c6a604e66ae71241035054310002849926135573ca00226ea80048848cc00400c00880048c8cccd5cd19b8735573aa002900011bae357426aae7940088d4088d4c08ccd5ce24810350543100024499261375400224464646666ae68cdc3a800a40084a00e46666ae68cdc3a8012400446a014600c6ae84d55cf280211999ab9a3370ea00690001280511a8129a981319ab9c490103505431000274992649926135573aa00226ea8004484888c00c0104488800844888004480048c8cccd5cd19b8750014800880188cccd5cd19b8750024800080188d4074d4c078cd5ce249035054310001f499264984d55ce9baa0011220021220012001232323232323333573466e1d4005200c200b23333573466e1d4009200a200d23333573466e1d400d200823300b375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c46601a6eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc048c050d5d0a8049bae357426ae8940248cccd5cd19b875006480088c050c054d5d09aab9e500b23333573466e1d401d2000230133016357426aae7940308d4088d4c08ccd5ce2481035054310002449926499264992649926135573aa00826aae79400c4d55cf280109aab9e500113754002424444444600e01044244444446600c012010424444444600a010244444440082444444400644244444446600401201044244444446600201201040024646464646666ae68cdc3a800a400446660106eb4d5d0a8021bad35742a0066eb4d5d09aba2500323333573466e1d400920002300a300b357426aae7940188d404cd4c050cd5ce2490350543100015499264984d55cea80189aba25001135573ca00226ea80048488c00800c888488ccc00401401000c80048c8c8cccd5cd19b875001480088c018dd71aba135573ca00646666ae68cdc3a80124000460106eb8d5d09aab9e500423500d35300e3357389201035054310000f499264984d55cea80089baa001212230020032122300100320011122232323333573466e1cd55cea80124000466aa010600c6ae854008c014d5d09aba2500223500a35300b335738921035054310000c49926135573ca00226ea8004448848cc00400c00844800448cccd5cd19b8735573a6ea8005200020052350033530043357389210350543100005499261261200120011123230010012233003300200200133332223332223333333322222222332233333222223332223333222233223322332233322233223322333222332233223322332233223233222222332235300e002222222222253353502533355301312001335015225335350270022100310015026253353033333573466e3c0300040d40d04d40a00045409c00c840d440ccd4c02800488008010480048004c8004c8c8c00400488cc00cc00800800488448894cd4d40400044d4d401800c88004884ccd4d402001488008c010008ccd54c01c4800401401000448848cc00400c008480048848cc00400c0088004888888888848cccccccccc00402c02802402001c01801401000c00880048848cc00400c008800488848ccc00401000c00880044488008488488cc00401000c48004448848cc00400c0084480048848cc00400c008800448488c00800c44880044800448848cc00400c0084800448848cc00400c0084800448848cc00400c00848004484888c00c0104488800844888004480044880084880048004848888c010014848888c00c014848888c008014848888c00401480048848cc00400c0088004848888888c01c0208848888888cc018024020848888888c014020488888880104888888800c8848888888cc0080240208848888888cc00402402080048488c00800c888488ccc00401401000c80048488c00800c8488c00400c800522011ca2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c200010481d879800581840000d87980820000f5f6", | ||
"redeemers": [ | ||
{ | ||
"input": { | ||
"id": "cee2e9783e0aa4f697fefcdcfcd8a7e19340ffe11540eae3a3b608991c6b965d", | ||
"index": 1 | ||
}, | ||
"purpose": "spending", | ||
"data": "d87980" | ||
} | ||
], | ||
"inputs": [ | ||
{ | ||
"amount": { | ||
"unit": "lovelace", | ||
"quantity": 10 | ||
}, | ||
"datum": "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec", | ||
"address": "addr1w9sz70wrdj2es6fd9pfjd6fu3sj0y235j65twcpzqk49ujssyha8s", | ||
"id": "cee2e9783e0aa4f697fefcdcfcd8a7e19340ffe11540eae3a3b608991c6b965d", | ||
"index": 1, | ||
"assets": [] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### 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. | ||
|
@@ -116,6 +170,31 @@ If, during a wallet or other application's development process, it is still only | |
* any value for the first URI query argument; | ||
* any URI query argument beyond the first. | ||
|
||
### Handling Daedalus specific links | ||
|
||
Implementation should follow the [BIP-21](https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki) standard as is defined in [Specification](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0013/CIP-0013.md#specification) section with `web+cardano:` replaced with specific custom protocol naming based on different Daedalus editions. | ||
|
||
Daedalus editions protocol naming: | ||
|
||
``` | ||
cardanourn = "web+daedalus-(daedalusedition):" (paymentref | stakepoolref | balancetx) | ||
daedalusedition = *(mainnet | mainnet_flight | testnet) | ||
|
||
Examples: | ||
|
||
Daeadalus Mainnet = web+daedalus-mainnet | ||
Daeadalus Flight = web+daedalus-mainnet_flight | ||
Daeadalus Testnet = web+daedalus-testnet | ||
``` | ||
|
||
Examples (for Daedalus Mainnet edition): | ||
``` | ||
<a href="web+daedalus-mainnet:Ae2tdPwUPEZ76BjmWDTS7poTekAvNqBjgfthF92pSLSDVpRVnLP7meaFhVd">Donate</a> | ||
<a href="web+daedalus-mainnet://stake?c94e6fe1123bf111b77b57994bcd836af8ba2b3aa72cfcefbec2d3d4">Stake with us</a> | ||
<a href="web+daedalus-mainnet://stake?POOL1=3.14159&POOL2=2.71828">Split between our 2 related pools</a> | ||
<a href="web+daedalus-mainnet://stake?COSD">Choose our least saturated pool</a> | ||
``` | ||
|
||
## Security Considerations | ||
|
||
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. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want the choice of "mainnet vs mainnet flight" to be made by the links themselves, rather than by the users?
E.g. if I only have Daedalus Flight installed, urls I find online with
web+daedalus-mainnet://
wouldn't work?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. Every application needs to have a dedicated URL schema. There is no other way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The network param would be used to preselect the correct application.
E.g. mainnet could be open up by Daedalus Mainnet, Daedalus Flight, Yoroi, AdaLite, etc.
I see Plutus apps offering users to chose themselves, but the network URL param preselects the default one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how we have envisioned it to work:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buh ah, the
web+cardano:://
prefix, however, would work with any wallet you have installed? (where I guess it might be undefined which wallet opens if you have several?)But where users, e.g. through PAB, also have the opportunity to specify the exactly wallet/app they want to use, through the other prefixes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
web+cardano:://
would open one of the installed ones. It is not possible to explicitly know which one. It depends on the platform, the order in which different wallets were installed, etc.We want to introduce the Daedalus specific handlers in order to handle different networks and in order to be able to explicitly open Daedalus.