Proposal for supporting a wallet initiated flow


#1

Hello :slight_smile:

I just introduced myself in the “Introduce Yourself” thread.
I also joined the telegram channel.

I was talking to @ligi to get some initial feedback regarding the sanity of the proposal I’m trying to make. This all stems from many month of thinking about a flow that would make my life as a web developer easier and I would love to implement a wallet using some kind of standard like the one I’ll sketch below:

It would work as follows:
0. [optional] - the user: opens his e.g. `data-wallet.html` URL in the browser
1. the user: opens a dapp in a different browser tab
2. the dapp: offers a "connect wallet" input field to the user
3. the user: pastes his wallet URL and clicks "connect wallet"
4. the dapp: creates an iframe with users URL height:0, width:0
5. the dapp: makes requests to the iframe via .postMessage()
6. the wallet: the tab or browser window with the users data wallet prompts the user to confirm interaction with the dapp
7. the user: confirms on his wallet page
8. the wallet: sends a response to the dapp via .postMessage()
9. the dapp: receives data from the logged in user in this controlled way
=> communication between dapp and user's wallet goes back and forth as the user navigates

This also would require dapp developers to skip QR scanning libraries and/or an SDK, because they could hand code the necessary support relatively easily :slight_smile:

Any thoughts?
I can go into a lot more detail if the above is maybe not clear enough.

cheers


#2

Technically portis is the wallet that is the closest to the approach I have in mind in that they are actually using iframes, but:

  1. they embed the iframe visibly inside the dapp which can be attacked by a compromised dapp by creating a “click through overlay” to suggest something false to the user to make them click on the fake overlay, but the click “goes through” and actually is caught by the “real wallet” and triggers something the user did not intend
  2. they use the generic library penpal from npm to talk to the iframe and don’t use a standard

If there WAS a standard to directly talk to iframes via .postMessage, dapp developers could

  1. write their own “sdk” to talk to any wallets which supports that standard or use a trusted one
  2. users are more likely to choose from a variety of web based wallets similar to portis making the ecosystem more resilient

The associated UX standard for users would be to sign in with their “wallet URL” and all the page needs to do is create an iframe with that URL and embed it in an 0x0 iframe and talk to it using the specific standard.

Web Wallets like that are also much easier to fork and maintain compared to extensions like metamask, which - even if there is a successful fork - need either google or apple to cooperate by allowing it into the app store rather than having “the web” be the app store


#3

Hey @serapath, thanks for writing this detailed proposal, like you mentioned Portis is the closest to this however it’s a proprietary solution that couldn’t easily be used by dapp/wallet developer.

I’m totally onboard with building a standard around this to increase interoperability and adoption. Although this a wallet solution that is incompatible with WalletConnect, I would like to help you get this off the ground.

My first thought was that Web Wallets are insecure therefore I would be super cautious with communicating that to users. I like your approach of a separate tab to approve transactions to avoid an attack by dapp mimicking the UI of the wallet.

This actually is a very similar proposal to what the Burner Wallet team was planning to do with their Sign-with-Burner idea. So it would be good to connect you with them to discuss this proposal. I would love to see this becoming an ERC itself and use Burner Wallet implementation.


#4

Thank you.
Yes - I am aware that it is not supported by WalletConnect, but maybe WalletConnect can offer more than one possible flow given that somebody wants to build a Wallet App which also runs a local webserver to serve the wallet.html page that follows the standard I tried to describe above :slight_smile:

Also - I don’t think that Web Wallets are insecure - I agree though that the approach Portis takes has some weaknesses. I also agree with the ERC proposal and that’s exactly what I think would need to happen sooner or later.

Thank you for the feedback.
I’ll try to reach out again to Austin Griffith. We already asked him at EthParis if we could use his Burner Wallet to integrate it with a our solidity editor, but somehow my take-away was that he feels that wouldn’t make sense - anyway, I’ll ping him again :slight_smile: