Re-imagining the DevEx/Ux of Wallets & Dapps
ETHCC 5 · July 2022 · 15:19
Gregory Markou examines wallet and application experiences built for multiple chains. The speaker discusses SQRL-style connection techniques and how developers might rethink interactions for new users.
Speakers
Topics
From ETHCC 5, hosted by Ethereum France.
Transcript
hello hello oh there we go all right we're good we're back on awesome uh hello everybody my name is Greg Marco I'm the one of the co-founders and CTO at chainsafe um and for those that don't know me like some stuff I do in the public kind of spaces I used to work on lodestar the ethereum 2 client at chainsafe and I also used to work uh kind of maintain and lead web3.js for quite some time come on dear can I use the man okay we're not using that um so that's some stuff that I've done in the public you might have seen me around on Twitter before about that um and you know uh I'm here to talk about basically the developer experience and user experience of wallets and dapps
and how we can greatly improve on that and this is coming from a lot of the learnings from working and building load CERN as well as maintaining web3.js over the last little while I see some of you are paying attention today um and some of you clearly aren't so hopefully I've got your attention now um just a quick brief on uh chainsafe I don't have a lot of time so just we do a lot of protocol development work in ethereum uh substrate polka dot file coin Mina we do a we maintain a bunch of sdks web3.js unitys uh web through Unity build a bunch of metamask snaps as well as a bunch of products and bridging gaming and decentralized storage and a ton of research so you guys should look up uh but I don't have time to go over that 15 minutes um so that's security and attention as
you may have seen I try to get your attention and some of you paid attention um but it's there's an interesting crossover here with dapps and wallets and especially when we like build apps in the space basically um it'd be crazy to say you're not trying to get users attention that's basically one of the main goals you're trying to attract them to your website you're trying to get them draw them in and figure out you know how do you keep them there to like really enjoy the experience you're building and at the same time you're implicitly just trying to figure out what's the best way to do this securely which is why you're building on a blockchain most likely um so let's get a jump into my kind of first topic I am going to speak a little fast because I don't have a lot of time
here but basically connecting to dapps so you're probably all very familiar with like you know if you've used how many of you guys used a Dap in the last like week you know like probably all of you so you're familiar with like the common uh connection flow um and if you're not basically what happens when you connect to a website or adapt basically uh you have to get an RPC node somehow the common flows typically You Know You Broker the connection to your wallet and then your wallet says hey I have a trusted node that I know that I trust dap take that from me and use it and that's what's serving your data sometimes you might be lucky and they'll actually give you an RPC node and you don't have to go that way which means they'll display data for you and I'll get into that in a second
while that's important because typically you're prompted with this you reload the web page you go to the page and this is what you get you don't get the app you don't get the experience you get nothing instead you get this window that says you have to connect your dat because as I mentioned before um they're trying to get that RPC node from you and they just assume implicitly that hey you know like let's use the connect enable function and just grab that and this is like kind of tragic of a pattern that we've adopted and it's actually a big security concern because like why do you need my address if you're trying to sell me on your app and why I should be using like your portfolio manager or whatever it really
is just some like new yield farming thing why can't I just check out what's being built and displayed on the website before you actually serve me and ask me for my address that's like you know asking for my name before shaking my hand it's a little weird um I don't know because like we all know what cookies are yeah what if I connect two addresses in the same browser session in like five minutes apart two hours apart on a desktop that doesn't change IP I've now just correlated all your addresses and sure it's hosted on PFS you know you're not you know you're not storing this or logging this data but like you're using some analytics service that is and then they get exploited now your address is correlated to an IP and you can have two
three four five addresses correlated just because a user want to check out your app not use it so now you're basically compromising your users just simply because you're using this broken flow and you just don't want to give people an RPC URL here's something that's interesting this is really nice these guys have been doing this forever do you guys see what's like different here this is when you log into their website like there's something there there's something really magical right there you know they ask you hey what is an address that you want to look up because like you can just look up whatever why can't I pretend to be like vitalik.eath you know and just plug in s name see what his D5 positions look like
to experience your app it's probably because you're like a little too lazy to go put in like your own RPC or own you're just brokering it through metamask but what if I told you metamask lets you get access to reads for free you don't need my address so why do we keep asking people for our addresses when all we're trying to do is sell them on why you should go to our website and use your dap or whatever it's doing it's a big problem it's a really big problem and as I disclosed earlier you should really be figuring out how we can like get the RPC node there you know maybe you give let users plug in an RPC URL that would be really nice too but right now you rely on the wallet and you relying disclosing addresses which is a really really big concern
and so there's really only one actual real valid use case where you should I should disclose my address to you like right away and that's if you're trying to serve me private data and what I mean by private data is something I might have to decrypt maybe you're storing it in your postgres database or something like that maybe on ipfs but it's encrypted and I'm the only one that should ever be able to see it otherwise why can't I go to your yield farming website and just like plug in you know like I said vitalik.ether something like that there's nothing wrong with that I'm just reading data I can't even sign on behalf of it it doesn't break my experience it doesn't break your experience it just makes things a little bit more private a little bit more secure you sign in with ethereum because it's
great um quick deal there I don't have time to go over this because we're going to run out of time but you should have been paying attention so um don't disclose my address please let's talk about how I wallets don't talk a lot they're kind of dumb they're like built that way they're not really supposed to do a whole lot there need to be like secure first that's like kind of the idea but they're not expressive enough and what do I mean by that so let's use two of the most common features that people use every day that don't know are unbelievably broken and one of the most honorous things for developers to actually use speed up and cancel um building web3.js I learned this the painful way that like 90 of users think it's my problem it's web3 Justice
problem it's ether's prom why they can't access and understand that it's been sped up or canceled what if I told you it's not about a part of the protocol and I'm sure most of you probably know this that like in order for them to work you increase the gas price by 10 to jump it out of the mempool and you do a bunch of other stuff again I'm not going to go in details because it's time but pretty standard stuff this is how speed up and cancels work so Developers and dapps have a fundamental problem because all you're doing is replacing a transaction in the mempool that means when you send the TX hash down into the app so the wallet basically there's this whole provider API that exists and they pass information down to the DAT when the DAP
says cool thanks to the TX hash I'm waiting and then you speed up the app has no idea that like what you just did and all it sees is a new TX hash and it has to like try and figure out like what just happened it's onerous it's not great so then dap developers have gone clever and they're like oh okay I'll just like pull the blockchain endlessly and go block by block transaction by transaction trying to find and match those announces to that same address but this is like does anyone see what's wrong here like the wallet knows that the user pressed speed up yet it's not telling the browser that the user pressed speed up yet it'll tell the user everything else that the
the wallet has done so like there's a solution it's pretty easy I talked about before we have this thing called the ethereum provider API formalized in 2018 um it basically says how does a wallet talk to adapt this is just like super simple standard stuff and it was developed so that any new wallet could enter the space and basically say I it'll work out of the gate with every single app that exists this is what wall connect use web3.js metamask trustwallet any wallet you can think of any provider you can think of we all use it and there's a special method that exists in there that's arbitrary that's the best part if you ever use like you ever anybody I didn't hear do contract development
you like you know subscribe to an event to see if like an event triggered that uses this really arbitrary thing called the message um like the message provider API um it's a subset inside the ethereum provider API and we have a great EIP and I promise this isn't a chill um 2831 transaction replacement message type you know with three lines of code quite literally three lines of code in most wallets because you just add an extra event to fire out um you can now subscribe to TX cancel it'll speed up replacement obviously these things are also TBD we could change them a little bit but the gist is like you could figure out that a transaction was actually sped up so now
when you go to your app and I'm sure you've all experienced this you speed up next thing you know you're refreshing the page they can't find your transaction you saw it was mine but the app website's still going like where is it where is it don't find it and that's just like it doesn't work you refresh now you're missing some like in between steps because you had to do like three transactions in a row and it doesn't know it's doing and basically your experience sucks and if it isn't do that it's doing this endless polling in the background meaning you probably don't have like a truly decentralized app right it's probably not bundled nicely in the browser um so with a really simple addition we can actually like greatly improve the ux by just like having wallets be a little bit more expressive communicating a little bit more
to the website um to serve its purpose so I'm just checking the time I'm not being rude I promise oh Omar why are you texting me okay um uh yeah so tldr we'll go over this one quick I mean it's pretty easy you know it's like what can you do you can probably just Implement 2831 like that's the easiest thing we could ever do I've talked really fast wow we're doing great for time um let us squirrels so I gave this talk in ethereum to eat Denver I'm not gonna gloss over a bunch of the early stuff and kind of get to like the kind of good little bits um this is a concept that's existed forever um and this is a concept that was like really brought to light by Richard Moore the developer ethers uh ether's jazz and
um I kind of expanded on a little bit but the whole gist of this is like you know wallet Developers aren't there's a lot of like features that wallets can do and can provide to us especially from like the mnemonics phase all the way to like even the transaction phase as I described earlier but they like don't and they hide a lot of these things because they're considered like Advanced features that we shouldn't be disclosing to the user because they're like too difficult um so I'm going to propose to you like maybe something we can change um because I don't think so this is the function to take a I can't say mnemonic anymore secret recovery phrase um to a seed and a seed being like a private key type of deal but this is like the HD node and then you derive
anyway I'm a little technical there uh there's a really cool feature that exists in here that nobody ever lets you use this unless you've done some digging which is the password um typically this is set to empty string meaning it just doesn't do anything this is actually I don't know if anyone knows like the I got the number wrong last night the 13th word or the 25th word you know like that extra one you can tack on that's what this is but like everyone sets its empty string because it's just like too complicated for users to remember a password yeah right um so what can we do with this I'm going to kind of skip kind of looks like this so like just for clarity you take a secret recovery phrase you get a default
set of accounts you then add a password the accounts change it's just how to monitor it's how it's How like HD nodes work you just get a whole new set of accounts so like where's the benefit here for users why can wallet devs just implement this like one small feature and it will like greatly improve security for the end user um you can set up like a canary alert system so like canaries like in Coal Mines back in the day you know they used to put them everywhere to see if like there was dangerous gas and then the canary is dead and it's like oh no let's get out let's do the same thing you know what's an insurance policy that like here you had 100 eth what would your insurance policy be on if I could say like you could have like an hour to like
save the other half like one percent five percent what would you put up five E so to the hundred so what if you just put like five e in this Canary account that default set the first 24 words and then on the when you add the password and get that 25th that's where you store the other 95. then some email Learning System if somebody compromises your 24 words then all you have to do you'll just get an email saying like someone transferred money out of this account because like you just would never touch this you just leave it there honey it's a Honeypot but it's like an insurance policy for yourself without having to rely on like a third party then you get an email saying trans like something was transferred which should never have been which means you've been
compromised all you got to do is just like quickly rotate out set up this whole system again should be like no time at all um that's squirreling uh it's something that like while devs should really consider like adding it's easy to implement and like very straightforward it's literally one form input field um again all my stuff here like one small change one small change in like the ux like dramatically increases for everybody including the devx um and that's squirreling um yeah let's get more advanced features out there for everyone uh what's my time and I was sick okay cool um if you want to get in touch with anybody chain safe chain safe F funny um info chain safe or you can find me
Greg the Greek um you know slight Internet troll from time to time um if anybody has questions we've got probably 45 seconds if I'm doing my math right I'm happy to fire them off really really fast and oh yeah that's it thank you we have T-shirts not like this I get yelled at for wearing this one because it's old but we have nice ones like that find the nice people at the front if there's no questions I'm happy cool three two one wonderful thanks for coming guys I appreciate it a lot [Applause]