meta icon indicating copy to clipboard operation
meta copied to clipboard

Improve URI `monero_wallet` standard by allowing optional <txid> string

Open SamsungGalaxyPlayer opened this issue 2 years ago • 1 comments

Current Monero URI documentation: https://github.com/monero-project/monero/wiki/URI-Formatting#wallet-definition-scheme

There is a Monero gift card project that could benefit from including txids in the URI, not that scan_txid is available.

Proposal

Only one of mnemonic_seed and (spend_key,view_key) may/must be specified. If height is specified, then txid should not be specified, and vice versa. Multiple txids may be specified. txids must not be specified if other incoming txids are sent to the wallet. For multi-use wallets, a height should be specified instead.

Parameter Type Description
address String Raw (95-character) address
spend_key Hex String Private spend key of a wallet.
view_key Hex String Private view key of a wallet.
mnemonic_seed String URL Encoded seed to restore a deterministic wallet.
height Long Block height when the wallet was created.
txid String txid(s) to scan

Example:

monero_wallet:467iotZU5tvG26k2xdZWkJ7gwATFVhfbuV3yDoWx5jHoPwxEi4f5BuJQwkP6GpCb1sZvUVB7nbSkgEuW8NKrh9KKRRga5qz?spend_key=029c559cd7669f14e91fd835144916009f8697ab5ac5c7f7c06e1ff869c17b0b&view_key=afaf646edbff3d3bcee8efd3383ffe5d20c947040f74e1110b70ca0fbb0ef90d&txid=715d7f44aa641d562ea649d14152f10f84f5fd087caf637295b963cbcbb05a0e

Context/Use

There is a desire to use Monero "gift cards" with a small preloaded value on them. In situations where these cards are loaded in a single transaction, wallets can easily and near-instantly scan specific txids, for then sweeping into another seed automatically.

If only a restore height is specified, then scanning can take minutes or hours.

Scanning a monero_wallet URI with specific txids signals to the wallet that the only funds in this seed are from these specific txids.

This field serves 2 purposes:

  1. Specifying txids for significantly faster scanning.
  2. Indicating to wallets that this seed is for single-use only, and can be discarded (swept) once scanned.

Questions

  • Should we allow multiple txids, or just 1?
  • Should we allow specifying both a txid and block height? What use-case would this be for, and how should a wallet handle this?

SamsungGalaxyPlayer avatar Sep 02 '22 14:09 SamsungGalaxyPlayer

Some great use cases for scan_tx (insta syncing a one-time-use gift wallet with 1 input -> to be transferred to the users own wallet via magic - ideally from a trusted node)

Sidenote: theres a bit of a bug with scan_tx where duplicates can be scanned and appear in your history list as amount "0" - probably causes issues elsewhere, jberman has a PR fixing it here https://github.com/monero-project/monero/pull/8566

plowsof avatar Sep 21 '22 12:09 plowsof

1 txid , or a list separated by commas is easy to work with. proof of concept here https://github.com/plowsof/redeem_gift_poc

edit* this pull request to add multiple recipients to a payment uri uses ";" so for consistency txid should also https://github.com/monero-project/monero/pull/8665

plowsof avatar Dec 04 '22 06:12 plowsof

I believe it's ready for final review now @luigi1111

SamsungGalaxyPlayer avatar Dec 29 '22 19:12 SamsungGalaxyPlayer

@luigi1111 Cake Wallet is implementing the URI standard as written above, which deviates somewhat from the listed version in the wiki.

SamsungGalaxyPlayer avatar Feb 13 '23 15:02 SamsungGalaxyPlayer

Should the wiki be updated?

luigi1111 avatar Feb 13 '23 17:02 luigi1111

to get this moving along, this needs to be a pull request to the actual wiki, then it can be reviewed conveniently before merging. thanks @SamsungGalaxyPlayer for this :1st_place_medal: ( @ofrnxmr (?) pointed out that connecting to a node as --trusted-daemon reduces network usage. in my PoC i found it reduced the time to claim a gift card from 18s to around 8s~ )

plowsof avatar Feb 13 '23 23:02 plowsof

@plowsof how can I open a pull request for the wiki? I haven't done that before

SamsungGalaxyPlayer avatar Feb 13 '23 23:02 SamsungGalaxyPlayer

@SamsungGalaxyPlayer sorry, the feature does not exist, removes foot from mouth will ask around what the best course of action here is

plowsof avatar Feb 14 '23 00:02 plowsof

@SamsungGalaxyPlayer a suggestion was to make a PR to https://github.com/monero-project/meta/tree/master/api (adding a file called something like uri_formatting.md inside the api folder) because we can't make PRs/review @ the wiki

plowsof avatar Feb 14 '23 00:02 plowsof

Well Cake is going forward with the standard above. If Core wants to update the wiki page to match this, only they can edit that page as far as I understand @luigi1111 @plowsof

SamsungGalaxyPlayer avatar Feb 14 '23 17:02 SamsungGalaxyPlayer

https://github.com/monero-project/monero/wiki/URI-Formatting/_history isn't only Core, but I don't know off-hand how to do it (for non-maintainers).

luigi1111 avatar Feb 14 '23 17:02 luigi1111

We locked the wiki because people would add nonsense / malicious links.

selsta avatar Feb 14 '23 17:02 selsta

I will re-open with changes. Our devs have advised me, and I've learned more about URIs in the process.

SamsungGalaxyPlayer avatar Mar 14 '23 20:03 SamsungGalaxyPlayer