monero icon indicating copy to clipboard operation
monero copied to clipboard

Support multiple destinations in make_uri and parse_uri

Open woodser opened this issue 3 years ago • 20 comments

monero-wallet-rpc supports make_uri and parse_uri which can be used to create a request for payment which the sender can parse to pay.

These calls currently only support a single destination address and amount.

This issue requests supporting multiple destination addresses and amounts to accommodate multi-output requests which can be used in a variety of applications or to prepare wallets with available outputs.

An encoding scheme is needed to support multiple addresses and amounts. The format should be small in order to accommodate limited capacity of QR codes.

woodser avatar May 20 '21 16:05 woodser

There is a $500 bounty on this issue. See https://github.com/haveno-dex/haveno/issues/83 for details.

erciccione avatar May 25 '21 13:05 erciccione

I’ll take a stab :p

benevanoff avatar May 25 '21 15:05 benevanoff

Example encoding scheme supported on IRC (originally proposed by @benevanoff):

monero:46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em,46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em?amount=239.39014,123.55423&description=donation,example (note description text needs escaped).

For backward compatibility, make_uri should produce the old format if using a single destination and address and this new format for multiple destinations and addresses.

woodser avatar May 25 '21 18:05 woodser

Positional parameters, description field optional.

monero:<addr1>,piconero,base64(desc):<addr2>,piconero,base64(desc)

trasherdk avatar May 26 '21 00:05 trasherdk

I like @trasherdk 's suggestion better

benevanoff avatar May 26 '21 00:05 benevanoff

@trasherdk's solution will use more characters overall because you will have e.g. "?amount=" multiple times.

selsta avatar May 26 '21 00:05 selsta

I would not use ?, amount, description and =.

Using : as delimiter for separate transactions. monero:<transaction1>:<transaction2> where a transaction is <addr1>,piconero,base64(desc) making description optional.

trasherdk avatar May 26 '21 01:05 trasherdk

@trasherdk Ok I understand now. Your proposed format is nicer than what we currently have, though it wouldn't be backwards compatible as far as I can see.

19:24 <moneromooo> In any case, it'd be nice if it was backward compatible.
19:24 <moneromooo> ie, passing one address/amount with the new rules yields an URI that old rules parse correctly.

I guess it can be discussed if having backwards compatibility is more important than a cleaner format.

selsta avatar May 26 '21 02:05 selsta

I’m personally in favor of just biting the bullet and changing it. The payment ID field should already be deprecated iirc so I’d think that can go and having a recipient tag as well as a transaction description tag seems rather redundant since they’re both just free forms.

benevanoff avatar May 26 '21 02:05 benevanoff

Actually now that I think about it more, it’d probably be a headache for 3rd part wallets so maybe not the best idea

benevanoff avatar May 26 '21 03:05 benevanoff

I would think it would be easier (less code) to parse my version :question:

trasherdk avatar May 26 '21 03:05 trasherdk

Long payment IDs should still be supported afaik.

The old call should be backward compatible for a single address/amount, but it could produce the new format for multiple addresses/amounts, or we could create new RPC calls like 'create_payment_request' and 'parse_payment_request'.

woodser avatar May 26 '21 06:05 woodser

Long payment IDs should still be supported afaik.

Integrated addresses are fine. No need for external payment id field.

selsta avatar May 26 '21 06:05 selsta

Using : as delimiter for separate transactions. monero:<transaction1>:<transaction2> where a transaction is <addr1>,piconero,base64(desc) making description optional.

URI syntax only allows for '?' and ';' as delimiters within a single URI. Please let's not invent solutions that would break all existing URI-processing software.

hyc avatar May 26 '21 11:05 hyc

The tricky part is that the bade of the Uri is an address. This makes processing additional addresses that much more annoying. The problem with the solution I'm about to propose is that wallets will have to append a query to the base address list. Which is 2 lines of code.

monero:addr1? addr=addr2&amt=val1&addr=addr3&amt=val2

Any competent Uri parser should be able to retrieves values as a list from a Uri.

elibroftw avatar Jan 26 '22 00:01 elibroftw

@elibroftw there is a PR for it already https://github.com/monero-project/monero/pull/7737

selsta avatar Jan 26 '22 00:01 selsta

@elibroftw there is a PR for it already https://github.com/monero-project/monero/pull/7737

Yeah I realized. Too late for me 😅

elibroftw avatar Jan 26 '22 00:01 elibroftw

#7737 has been abandoned. Anyone willing to recover it can claim part of the bounty: https://github.com/haveno-dex/haveno/issues/83

erciccione avatar Apr 13 '22 14:04 erciccione

@darkdrag00n It's no longer needed in Haveno, but multiple destinations in Monero payment URIs is still a valid use case that would be good to support long term. We would still honor the bounty.*

*Reduced the bounty to $350.

woodser avatar Dec 02 '22 10:12 woodser

I will take this @woodser

NorrinRadd avatar Apr 06 '24 13:04 NorrinRadd