BUIP086: bitcoincash: URI format update

Brendan Lee

New Member
Feb 9, 2018
19
22
BUIP086: bitcoincash: URI format update
Submitted on 9th February 2018 by Brendan Lee
Sponsored by torusJKL

Revision 1.0-1.3 Proposal

Revision 1.4: The spec now structures the transaction outputs as a set of arrays. The zeroth element of each array corresponds to the legacy bitcoinparam elements from a version 1.0 URI to maintain backwards compatibility, however wallets that aren't compatible with version 2.0 will drop output data in bitcoinparam[1+] positions. POS systems would need to detect this and create additional transactions URIs for missed outputs.

Revision 1.5: Added support for scripts through addition of bitcoinscript[]

Revision 1.6: The file has become too big to paste into this window. Please visit the following link to view the most current version of the file:
https://www.dropbox.com/s/o456ulytswct022/BUIP 086.docx?dl=0
It has been updated to accommodate the feedback put forward by TheZerg.

Revision 1.7: Now moved to Github: https://github.com/the-beer-engineer/SmartURI
____
Edit: title, date, author, revision labels, sponsor info formatted/added by solex 21 April 2018
Voting system PDF to be created from https://bitco.in/forum/threads/buip086-multiple-output-uris.9476/page-2#post-61977
 
Last edited by a moderator:

Brendan Lee

New Member
Feb 9, 2018
19
22
Thank you for the feedback. Is there a good resource where I might be able to learn why this is not valid and make appropriate modifications?
 
  • Like
Reactions: freetrader

Brendan Lee

New Member
Feb 9, 2018
19
22
Hi Deadalnix, I have made some updates to the above. I have ideas for a few more examples which I will add once I know I have understood the URI assembly process.
 
  • Like
Reactions: freetrader

torusJKL

Active Member
Nov 30, 2016
497
1,156
Thanks for this BUIP. I like the idea.

Would it be a good occasion to add a version parameter such that future changes could be identified better?

I'm happy to sponsor the BUIP if you like.
 

Brendan Lee

New Member
Feb 9, 2018
19
22
Thanks torusJKL for the offer of sponsorship! That would be amazing. Thank you also deadalnix for the idea of an array. Did not know that was possible... I will read up, make some further changes and come back.
[doublepost=1518393556][/doublepost]question for deadalnix: how important is it to maintain compatibility with old wallets?
 
  • Like
Reactions: freetrader

Brendan Lee

New Member
Feb 9, 2018
19
22
torusJKL interestingly there is already a parameter for version number in BIP20/21 which is the original URI spec. Just not used very frequently...
 
  • Like
Reactions: freetrader

torusJKL

Active Member
Nov 30, 2016
497
1,156
Bitcoinversion is set to 2.0 and the wallet is not compatible, the wallet will reject the URI as invalid.
Does this mean we can't add the version parameter and still have a fallback address and amount for old wallets?
 
  • Like
Reactions: freetrader

Brendan Lee

New Member
Feb 9, 2018
19
22
You can omit version and use the version 1.0 parameter set (all supported), but it’s assumed that if you specify version 2.0 you will be using the data arrays. Doing it this way breaks compatibility if the wallet does not support version 2.0. I thought about doing it similarly to what I had in the last version but I feel like it will be too complicated for POS system makers to implement correctly...
 
  • Like
Reactions: freetrader

Brendan Lee

New Member
Feb 9, 2018
19
22
I have updated to maintain compatibility with version 1.0 wallets however I have moved away from the idea of nested transactions being subtracted from the primary amount in favour of pushing the POS maker to implement a system that creates multiple transactions when a transaction doesn't include the additional outputs. This should reduce confusion and makes the system easier to use once compatibility is widespread.
 

theZerg

Moderator
Staff member
Aug 28, 2015
1,012
2,327
This is a good proposal and I can see how it could make some purchasing scenarios a lot simpler. But, I'd want to hold this back from the formal review period and voting until the URL syntax is legal ([] is reserved) since it is not implementable as currently defined.

Other comments:

1.
> The embedding of this information can be made mandatory or optional by the seller.

You say "mandatory". But the network cannot enforce this so "mandatory" is impossible. I think in this context "mandatory" may mean "or the receiver will not recognize your payment". It would be good to clarify this.

2.
> bitcoinaddress[] = “address[?]=” base58 *base58

Address should be updated to accept either base58 or cashaddr formats

3. what if they specify both bitcoinaddress= and bitcoinaddress[0]= fields?

If its not too painful to specify the array field in your new URL-compliant format (for example, by just removing the brackets), I'd recommend removing the bitcoinaddress= style and using arrays of 1 element for the same functionality. Clients can use the version 1.0 url format if they don't want the arrays.

4. xxxparam: We know that these are parameters. I'd recommend removing the "param" from all the field names since it makes the URL longer which is both more difficult to read, and requires a denser QR code.

5. for something like a restaurant tip, they would REALLY like to offer you a suggested amount. But your optional output cannot suggest an amount.

Are there other uses for a suggested amount?

6. multibuy

Please clarify what happens if outputs are not in common.

Please clarify what happens if there are multiple OP_RETURN outputs, with identical or different information.

Clarify whether a wallet is allowed to produce multiple transactions or whether one transaction MUST be created. Perhaps a field in OP_RETURN that can bind multiple bitcoin tx into a single "merchant" transaction? Or is "merchant code" field not necessary because the merchant just looks for filled outputs.
 
  • Like
Reactions: freetrader

Brendan Lee

New Member
Feb 9, 2018
19
22
Thank you for the feedback TheZerg.
I have some responses below:


> until the URL syntax is legal ([] is reserved) since it is not implementable as currently defined.
I have added the following note:
· To maintain compatibility with URI standards, all reserved characters must be transmitted as percent encoded values. E.g. %5B = [ and %5D = ].
· For further information on reserved characters, see the following link: https://tools.ietf.org/html/rfc3986#section-2.2
· For the purposes of readability, this specification uses the reserved symbols, however all examples have been represented using RFC3986 compliant notation.


> "mandatory" is impossible
Yes definitely the wrong language.
Have updated to this:
Where amount[N] is defined, the wallet will assume that the value is agreed upon between payer and payee, and will prepare the transaction with an output directing the corresponding amount to address[N]. The wallet may offer the payer the ability to modify this amount prior to the transaction taking place however this is a consideration for the wallet software provider and is not part of this specification.


> Address should be updated to accept either base58 or cashaddr formats
Done.

> what if they specify both bitcoinaddress= and bitcoinaddress[0]= fields?
A URI that defines more than one element in any bitcoinparam[N] field would be rejected as invalid. E.g. if a URI defines an amount in the amount field and then defines a conflicting amount in the amount[0] array position, the URI would be rejected as invalid.

> If its not too painful to specify the array field in your new URL-compliant format (for example, by just removing the brackets), I'd recommend removing the bitcoinaddress= style and using arrays of 1 element for the same functionality. Clients can use the version 1.0 url format if they don't want the arrays.
Not quite sure what you mean by 1 element array. If the URI specifies information using version 1.0 compliant labels, each item is already in a 1 element array. It's only if the URI has further outputs specified that the array notations would be needed.

> xxxparam: We know that these are parameters. I'd recommend removing the "param" from all the field names since it makes the URL longer which is both more difficult to read, and requires a denser QR code.
The 'param' suffix is only in the specification to ensure clarity that the value is being discussed and not the label. The labels used in the URL are all shortened to address, amount, etc.

> for something like a restaurant tip, they would REALLY like to offer you a suggested amount. But your optional output cannot suggest an amount.
They are free to suggest an amount by using the amount[?] field in the URL. The specification is simply saying that if there is no value specified, the wallet should prompt the user to enter a value. If a value is defined in the URL It would be up to the wallet software being used to then allow the payer to go back and modify the suggested amount.

> Are there other uses for a suggested amount?
If you build it they will come.

> multibuy
Please clarify what happens if outputs are not in common.
Multibuy would look at the outputs from each URL scanned and aggregate any amounts directed to the same receiving address into one larger output. Any outputs that are to unique address would be separate outputs in the final transaction. I will try to clarify the language around this.

> Please clarify what happens if there are multiple OP_RETURN outputs, with identical or different information.
There are no OP_RETURN outputs specified in the URL. If receiptparam is set to true, the wallet software concatenates the 'messageparam[]' from each output in plaintext allowing merchants to provide on-chain receipts or other functionality. The wallet that scans the URL creates the OP_RETURN output. If the seller has set receiptparam to true the wallet software should create the OP_RETURN output automatically. If the user then excludes it from the transaction this may cause issues.
If there is too much data in the message array then it will be up to the wallet software to work out how to proceed. This may be to drop any messages that don't fit or to offer the user the ability to remove certain messages. If the current limitation of 1 OP_RETURN output per transaction is lifted this becomes easier as the wallet can simply create an additional OP_RETURN output and append more data.


> Clarify whether a wallet is allowed to produce multiple transactions or whether one transaction MUST be created. Perhaps a field in OP_RETURN that can bind multiple bitcoin tx into a single "merchant" transaction? Or is "merchant code" field not necessary because the merchant just looks for filled outputs.
If the user want multiple transactions, they can just hit 'no' when asked and send each scanned URI as a unique transaction. If the merchant wants unique transactions, they can just set 'multibuyparam' to false. It is assumed that a merchant using this feature would have multiple items for sale at different prices, but that payments would be directed to a single address or set of addresses. In this case the merchant would most likely also set receiptparam to true to enable their POS system to see the list of items purchased on-chain. This is intended to operate in a more passive environment without an active POS to manage each transaction.

[doublepost=1518588899][/doublepost]I am having trouble posting the latest edition due to its length. Is there a better way to do this?
 
  • Like
Reactions: freetrader

torusJKL

Active Member
Nov 30, 2016
497
1,156
I have updated to maintain compatibility with version 1.0 wallets
Great. The UX will be much better this way. No situations where it fails and the merchant needs to try another version until it works.

The new URI format maintains compatibility with the current version 1.0 format through the inclusion of existing bitcoinparam values. These values are mapped to the zeroth position of each corresponding bitcoinparam[ ] array.
Why do the legacy paramaters need to be mapped to the zeroth position of the new array?
A 2.0 aware wallet could still read the legacy parameters if it wanted although there is no need because the legacy field holds the sum/default of all new values, right?
 
  • Like
Reactions: freetrader

Brendan Lee

New Member
Feb 9, 2018
19
22
>the legacy field holds the sum/default of all new values, right?

I decided to move away from that, as I thought it results in a system that is less flexible and more difficult to manage. Now each array position (including zeroth) relates to a single self contained output. I figured that in this instance where a POS system is watching it will see that only the first output has been sent and can present a new URI for each output. The user can send each as a separate transaction.
Otherwise I feel like I'm running in circles for a compatibility issue that may only exist for six months or a year.
 
  • Like
Reactions: freetrader