# DevTools Summit | A brief foray into v6 - Richard Moore

- Speakers: [Richard Moore](https://streameth.org/speakers/richard-moore)
- Channel: [ETHGlobal](https://streameth.org/ethglobal)
- Date: 2022-10-09
- Duration: 35:57
- Topics: Science & Technology
- Watch: https://streameth.org/watch/yt-c7jn1RApaCs
- YouTube: https://www.youtube.com/watch?v=c7jn1RApaCs

## Description

Welcome Richard Moore from Genetic Mistakes Software for a talk titled "A brief foray into v6". Part of ETHOnline's DevTools Summit.

ETHOnline is our biggest event of the year! Collaborate with thousands of developers and creatives from around the world and win over $300k+ in prizes! We're bringing in 30+ of the biggest teams in web3 to give you access like never before. Learn from ecosystem leaders and build your biggest ideas as the merge nears reality. The future of Ethereum is being written right now, and it's time to make your mark.

---------------------------------------------------
Follow us: https://twitter.com/ETHGlobal​
Check us out: https://ethglobal.co​m
Email us at: hello@ethglobal.com

#ethereum #eth #blockchain #crypto

## Transcript

foreign [Applause] [Music] without further Ado I'd like to welcome our last speaker of the day and that is Richard Moore talking about ethers V6 hi hi how goes things are going great how are you excellent excellent kind of just woke up so [Laughter] that's a very familiar exactly four o'clock so you know it makes sense all right well great having you Rick uh let's uh let's talk about V6 Edna see what things you can uh tell us without also committing to excellent oh um yes let me find the Keynotes uh can you see that everything is great okie dokie and the little bar for Zoom is covering the button there we go okay okay um so I was kind of expecting more q a at the end so it might not be enough so we'll figure that it would go along um but for those that don't know ethers is like I don't know what the target audience is in terms of like familiarity with with ethers but it's just a library for interacting with ethereum blockchain and that sort of thing so V6 is up and coming I was hoping to have it out a while ago but the beta is coming along and uh I've got a big release I was hoping to make by this talk but I didn't quite get finished last night um hence waking up at four oh there we go ah so yes one of the biggest features of V4 is I'm moving to Modern Equis script or JavaScript features um prior to like V5 and before I only targeted features that were available in ES3 so it does mean that ether's V5 will probably work in like Internet Explorer and like browsers Circa 2010 um but that's becoming less less important especially for ethereum and so moving to Modern es features gives us a lot of like really cool abilities that javascript's added in the last you know five years so uh one of the big ones that people seem to always want and I am kind of looking forward to getting this if there is Biggins begins are now built into JavaScript um things like September 2000 that kind of the last holdout which was Safari out of them so everything should basically have access to begins these days there was a lot of issues like before using big big number there was a lot of extra coming like an extra code you needed because it was like dot Mall this dots add that um instantiate big numbers from uh their their static Constructor before you're doing anything with them so I think it was the nice thing with big ends is they're built into JavaScript they just work you just add this little n to the end of your number and now you can have numbers that exceed the value that uh IEEE 754 can support and it also means you can do other cool things like you can just multiply them together there's no complicated things you need to worry about that way and you can just check them if they're equal to each other use greater than less than um I mean that was a point of of uh difficulty for a lot of people especially when they're using test Frameworks and they just want to see if this one value is greater than another and the existing Frameworks just use like inequality operators internally so um lots of cool things that way one kind of downfall of begins I'm still trying to figure the best way around is you can't Json stringify them and so I do expect some people have issues where they have a value they want like a complete instruction they want to jsonify and so there'll be a special function to help handle that sort of thing um but so let's begin um another really cool feature I've I mean back in the day when I was using python this is just built into language es6 proxies are freaking awesome uh basically it is an object that if you if you're familiar JavaScript if you have an object and you call a phone you you call a method on it and the method doesn't exist it just fails the cool thing with the proxy is before that failure it gives code a chance to determine do I want to do something or do I just want to fail and so if you have an object called if you have object Foo and you do foo.bar if bar doesn't have a value it'll just fail but a proxy will give the code a chance to say do you want to do anything with bar and so in V6 one of the big things we do with this is contracts because now contracts can take a a property you're trying to access and kind of make it better educated guesses that what you're actually trying to do and find for example the math that you want to call um if you're familiar with V5 and you've got like really complicated and big apis from third parties you probably also see like a thousand warnings in your uh console log saying like duplicate API definitions you have too many balance ofs you have too many owner ofs because each one of these had a different signature because slowly allows you to overload signatures so the cool thing is you only get those type of warnings now if you actually try using something that's ambiguous and that kind of leads into oh maybe a few slides ahead I'll get to that in a second um but yes basically it gets rid of all those errors that people have been receiving um that we're kind of required for each years to throw up at the beginning because it wouldn't know whether you would try using them or not um right package exports that's actually why the latest version is a little bit behind I'm trying this out basically in Prior versions of ether's fee five it was a massive mono repo with 20 some odd sub packages in each sub package is managed and and has its own TS config and package Json and all this crazy stuff and it also meant that when you install these there's some things would start getting out of sync and if you blew away a bunch of stuff but not everything and then did an npm install you start you start getting issues where versions of the library within ethers for example ether's project slash provider might not be compatible with the version of ether's project slash uh contracts you have um and so then you got these really crazy warnings and errors that make no sense because it's basically just the build system is completely lost and so you had to delete the package Json or the package lock your yarn locks all those crazy things delete the node modules then do a fresh npm install and things just worked but it was a lot of hassle so now using the the new the package exports um it's just everything is in one package ethers and if you do slash providers it knows to pull in a specific set of files um and so the big advantage that this really helps is it makes tooling much simpler uh tools are just much happier now with a normal build process the original like ether's B5 has a convoluted crazy build process to handle how typescript deals with composite packages plus how the bundler mind just those things together and so yes bundler two and tool support is much better the other cool thing with this ethers slash provider thing is you still get all the great benefits of tree shaking because the exports kind of steers the bundlers and steers the toolings as to what file the look at and so because true shaking really only works effectively on a per file level um these exports kind of guide the the the file processing part well and right basically publishing is much easier for me maintaining one package that I have to modify and not worry about having like a thousand siblings for and then the Sim links sort of get like unsynchronized over time for one reason or another or setting up a new machine um anyways it's just much easier so how I'm kind of belong to my slides very quickly and I'm a little bit worried I'm going to be too fast um hopefully Karthik is thinking up some good questions for me or keeping track of things um another big advantage of V5 is the dependencies I mean I think sorry V6 I think V5 had dependencies around 9 or 10 dependencies with this we're down to um five dependencies the web the websocket library is only necessary in node um I can't quite see all my slide I think it was 60 million but anyways the basically a very popular library that has a ton of downloads um so it's maintained I feel like the important thing people don't look at when they look about dependencies it's not just how many absolute dependencies you have it's kind of how many different authors and contributors you're depending on because of those dependencies and also the kind of like the quality of of the author when you see these packages have very few downloads you almost have I feel uncomfortable because it means that they're probably not worrying too much about the security and all it takes is one of your dependencies dependencies dependencies dependencies to like fail and also the world is just flossed and we've seen things like the eslint hack I mean there's always the possibility of supply chain hacks so if we can reduce the number of people we have to rely on um but also increase the quality of the people we love we rely on we help protect ourselves from all these supply chain problems so TS for example I mean it's only included in V6 because it drastically reduces the size of the library to include all those little helper methods that typescript injects for you once but again Microsoft is a fairly big company if they got compromised they would suffer some sort of like Fallout and like PR nightmare so they're heavily incentivized to keep to keep all their um security up and running WS has a crazy number of downloads it's only used to node I don't personally know the person so I can't that's my one kind of like concern Paul Paulo Paul Miller the the author of The Noble classes he's awesome um they're all audited and he's a big security guy as well so you know we can kind of I trust him more than I trust random other projects I've used in the past that maybe take a long time to get back to their their uh like non well serious issues that sort of thing and then there's ethers if you're depending on ethers you're already depending on me being secure and so my other Library aesjs which ethers uses um is kind of in the same security threat model so anyways the goal is to kind of like bring down dependencies but also bring down the number of people that responsible expenses um that's kind of my take on that um okay now back on to like more cool V6 things so this goes back to the proxy thing I mentioned earlier um because the proxy can kind of decide a runtime we get all these cool abilities the next two slides will cover those um so first of all we have a typed contract interaction uh historically if you saw this ABI the um as you can see there's two methods called Foo sorry yes as you can see with it's called food so first of all in V5 if you build this API you'll get warnings in your console saying duplicate duplicate definitions of Foo which makes sense there are two of them and so if you just did contract.foo um as you can see this first case it doesn't know which one you actually meant to call because a address can also look like a number um so in the first case it would still fail as it does in V5 but in V6 we added the typed object and so typed lets you kind of hint to the contract by the way this some Adder parameter is actually an address and now it's no longer ambiguous it knows that if you're calling Foo and the first value is something but the second value has to be an address then it can find the right food at all um and keyword contract interaction so this is something that I've just started adding so it's still very bleeding edge um but this is a feature that I've seen a few people ask for they want to be able to basically call um a contract method using the key keyed arguments this is something you're probably familiar with uh the KW args if you're using python um excuse me it can make a code a little more readable in in many situations and so if you pass in one of these type keywords objects it realizes that all the parameters are not being passed in positionally they're not being passed in based on the order of the the parameters as they show up in the uh API but actually by their name and so for example in this example so in this example you see I'm using from to in value but the order doesn't really matter if you wanted to you could specify the two and the from and then the value you could imagine constructing these these um objects somewhere else if this is available throw that in and kind of like codifying or procedurally generating the stuff and so this will also be useful for a lot of um like Frameworks that need to uh kind of call functions in a constructive way based on other information they may be pulling from other places um is there anything else to say on that so I think that's good for now um right so another big thing has changed in V6 is how providers work um so not how they work for from users points of view by how they work internally um when V5 came out it was very heavily influenced by V4 which was helping this would be 3E and so on and so on so back in like 2017 it was a very different landscape basically everyone only used HTTP providers the um socket providers were still kind of like a niche thing websockets were expensive to run um now there's a much more um it's much more it's much calm much more common to use web sockets and even IPC I don't think IPC is still that popular but the thing is once you support one you might as well support both because they're both basically the same so there's been a lot of work just to abstract and change the model so that internally they work better um from a long-lived socket connection so for example websockets uh as a result one thing people always want with web sockets is they want to that when there's a hiccup when the connection drops they want the websocket to reconnect and just continue on trucking is actually quite difficult to do especially in how V5 was structured because you could imagine if you were streaming if you're listening for some event and then there was a hang up and you reconnect you may have missed events during that time you need to kind of know which was the last event you saw so you can kind of re-subscribe to Old events uh or pull for the old events and replay those but you can't start uh emitting the new events until the old events are processed because you still want to keep things in order basically there's just it's a consistency nightmare um so in V6 there's been a change in how the overall model works so these are all abstracted away so each uh provider kind of gets to decide how it's going to process these and so the websocket provider has its own custom Mojo thing going on so that it knows how to reconnect restart uh uh and kind of keep all the events consistent on that note the crap I've lost track of where I was going with that um oh yes pausing that was the other cool thing I think that might actually be on another slide though maybe I'll save that for the next slide I think it's there um so right uh basically by using filter IDs we also gain a lot of abilities because now we can uh actually get uh orphaned events from even a polling connection some back ends do not support filter ID but things like inferior do and so we can use those which also helps some of the problems with talking to a large back-end cluster of uh nodes making sure that everything comes in consistently consistently and in order um also there's new plugins available so that for example it's much easier if you're trying to build something on top of AWS which might want barrier authentication tokens um and generalized contract Runner type this is a little bit of a I'll try giving a quick overview basically a contract Runner is something you pass into a contract to run it historically in V5 that's been either a provider a signer or null and depending what you pass in kind of dictates what type of things you can use the contract for by generalizing the contract Runner uh there's now a higher level interface that anything can influence it happens at provider influences interface that happens at cider influences interface the cool thing is you can now build your own random weird things that also into this interface which gives you for example some really cool things you could do for marketing purposes if you want to build some sort of test contract Runner that's going to feed fake data but that's meaningful to the to the contract if it asks for it and it'll think it's just talking to something speaking its language um right here's the the pausing thing I was mentioning um so basically providers can now be paused you can pause resume restart them and so this is this was kind of almost free because we needed this this functionality for the purposes of being able to restart a websocket provider um like the events on it and make sure everything comes back consistently so this is an example where if your application is goes to the background if they click a different tab in the browser you might as well turn off all the providers that are running events and triggering things and updating the UI um because your aide using bandwidth you're paying for those inferior requests or or Alchemy or anchor you're paying for or even like just contacting your own server to do things you're paying for that infrastructure you might as well pause it when you're not being used maybe they close the tab later and then anything you were updating wouldn't have mattered anyways um or when they come back later you can then decide do I want to continue replaying all the events that happened while my tab was gone do I want to just replay the last 10 minutes to catch up my UI so it looks nice or just a little bit of State um so I think this will help a lot of people as well it makes it nice and easy to pause a provider um Network plugins so another big issue with uh ether's is some people want to use ethers on networks um chains that are kind of insane like they they just break the rules in ways that made either no sense for them to break or in ways that from my perspective as a like ethereum semi-maximalist um didn't really think was a great idea but I also don't want to preclude those people from having access to ethers I don't want them building their whole own other library that maybe has other problems or I mean in general it's just nice if we all work together and that way anything they build on top of ether's other ethereum people can use as well and so Network plugins kind of allow weird networks to be weird and you know just treat it as that's an okay thing to be um so for example uh so some examples I will give of this are cross ens support ens actually supports um any chain any chain in the universe you want BNS supports it the problem is you need an ethereum connection for that for a lot of networks so for example if you are on um Finance smart chain and you want to get a binance smart chain address you need some way to talk to L1 ethereum to ask for that so this just kind of provides a way for networks to to figure out how to connect to and talk to L1 chains um different chains have their own way of computing intrinsic gas costs that's not really that interesting for most people that's just something kind of used internally by contracts when they're trying to estimate gas um so for example uh in terms of VIP 1559 priority fees the Mumbai what's that one a polygon the polygon uh peeps kind of chose weird values for those and it causes a lot of confusion when people use ethers because the way they use the AP 1559 is not really the way that 15559 was intended to be used and it's certainly not the way it works on um ethereum and so this allows people to build and just kind of attach a little plug-in to their Network saying by the way um when doing a gas estimation use this other criteria to kind of like uh munge the values um it also lets you add or add extra Fields or missing fields to the transaction uh there are some chains that actually compute transaction hashes completely differently this makes it nice and easy for them to kind of uh shim that in there without having to have their own complete instance of every provider Under the Sun and it also allows you having custom URLs because uh in general I try keeping ethers quite lean which means focusing on kind of the main chains people use but for example etherscan does have a binance smart chain uh API and so this means that the network object can now encode that so that if anybody wants to use a Binet smart chain with ethers they just need that one network object and once they pass it into a provider the provider knows all those weird exceptions um excellent and I think I made it through and I guess I took longer than I thought I might but yes that's V6 in a nutshell um from what I could throw a slides together in the last few days for so that was still great and uh all right so I have I have a few questions but they're largely uh meta questions because um you were very concise and articulate on what you're trying to do and it's very very easy to understand like what this does and why you're doing it um I I think um maybe kind of just well let's start with like the more obvious one um obviously didn't get deployed today but what's the the timeline on uh oh yeah when when should we see V6 coming out so there is already V6 beta it's been for a few months now so if anybody wants to use it um just npm install ethers at V6 Dash beta um the exports stuff is kind of new I've just started I just found out kind of that it was widely supported by most of the tools I need um this week so I started porting everything over to use that um oh oh sorry I ended up disabling the screen share in case oh there we go okay I thought maybe my my device had hung up on you um right so I only discovered like this week that um it's quietly supported so I've been kind of like adding that so that was what was opening it up today it didn't quite happen um but hopefully this weekend people will be able to start using the new version that has the package exports but yes um it's already available it's on GitHub if you go to GitHub and look at the branches there's a branch called V6 Dash beta um and the new one that will be coming will be V6 Dash beta Dash exports um that's the one that will include the exports instead of the crazy monorepo the mono repo still isn't completely off the table I'm just hoping it is because it exports is so much more useful and so much easier to develop against tree shaking is way nicer um um okay so uh other sentence set of questions um broadly kind of speaking uh and and these are kind of mostly matter questions but like I I like that the inference piece I like how uh you're trying to conform uh es6 to to python um uh and uh and the network Plug-In or just plug oh actually maybe one guess so I like the network plugin architecture it like sounds really actually extensible and it's how you get it to apply to other EDM shames um is it just specifically for Network plugins or is it overall just a a hook system that you're think talking about but you just refer to the network plugins as the example um so there's two there's two places I kind of put plugins one was in the provider one was in the network it is mostly just to handle kind of exceptional cases for now um they are hooks things and I mean once people have hooks they'll use them in weird and crazy ways and it'll be awesome and I'm looking forward to that but the main purpose that I'm putting them in for is just kind of like for like headache reduction uh when people have some weird Network and like this thing's not working for me and I have to give them like this big work around or they have to like re-imple this whole thing um it'll be easier if I just say like just add you know hijack this hook on the network and or add this hook on this network and then the the provider will kind of know what you will need to do the other thing is it's also extensive people that if some weird ones weird networks comes along and has something that I don't support it doesn't need to change the um the API for the provider because I can basically add the special logic into the provider necessary they can add the plugin onto the network and then when the the provider is running it can ask the ask the network for this new plugin that didn't exist before um and kind of go from there so it just means that I can stop changing interfaces like the the signatures for for methods because someone has some new thing like historically I haven't been able to I don't need backwards breaking changes so they say I want to do this thing and I'm just like I'm sorry but there's nothing I can do about it because it'll break you know there's over there's almost a million downloads the week now of this thing it's gonna break a ton of people if I just make this weird change for you um so it gives me the ability to still make weird changes for people who need weird changes without hurting everyone else and it's amazing um onto the meta questions how do you decide when something is ready for release and which features should be part of a like a major version upgrade versus like a minor or testing like what's kind of been the design or philosophy behind this thing because V6 has been the worst for quite some time um how you get to how do you get to a new version exactly um it's very I mean it's it's very much an art um it's it's very like I remember I I think it was eight months into V5 when I first told some people like oh I've got some really cool ideas I want to do for V6 here's what I'm gonna do and everyone was like eight months uh it's too soon and so I kind of like I I just kind of sort of wrapping more and more ideas in until eventually got away from me and then it was like it was not no longer something I could complete in a short period of time and so that's why it's what like two years later since V5 has come out um so I think in the future I'm going to be a little more aggressive trying to release more frequently um in terms of major versions in terms of minor versions minor versions are required anytime that um you're breaking kind of forwards compatibility and patches are just um nothing bad is changing but it's absolutely it's not an easy thing to do and even trying to figure what features to include um so for example uh if I was willing to wait another six months because right now um there's still a bunch of craziness involved for fetch fetch is in the browser fetch happens to now be in node 18. if I decided to cut node 14 and node 16 out also my life would become much easier or if I waited six months for node HP to kind of but the thing is you kind of have to it's like buying a new computer right like my dad's been trying to buy a new computer and he keeps every time he has enough money to buy a new one he's like oh but if I wait another three months it smells much better it's like but you have to kind of find that happy balance between like the pragmatic side and the well your core principle is like preserving backwards compatibility then I feel like you uh you have to kind of deal with the polyfills for quite some time exactly exactly and for me backwards compatibility is an important feature this is something what people do not really get they're like well why don't you just do this well you just drop support for that like I'm the maintainer so many Legacy like iPhone apps and these sorts of things when these things like Drop compatibility it breaks like it's just a week of my life that disappears now because somebody dropped support for one little thing and that little thing was used by some other little thing I used and like I said it's like it's Turtles all the way down the dependency tree goes right down to the floor that bottomless to dependency is is worked and now you're bored so um yeah I hope that the websocket library is not using left pad um and uh all right so a few more questions um one is how do you uh granted obviously so much of um I would say web 3 infra right now relies on ethers um how do you kind of look at how people are using the library or how people are using other abstractions that use the library just kind of we just talked about walk me just before this and kind of see how it's being implemented versus what you think you can help simplify and abstract for others um do you kind of care about that how often do you actually do these things and how can those decisions end up influencing feature features and uh sort of what's the process like there and then I'll close off with a simpler question and uh cool I mean I mean I absolutely love other things using it it's really cool I mean I just saw the last few minutes of the Vlog me uh thing and I was like I was just like I was really impressed by the way it was able to detect errors and I was just like man I feel like it's really cool to see all these things built on top of ether's um that extend it because it means that it's something I don't have to write because the reasons in the first place is ethers is I I made ethers for me even today ethers is largely for me um it just happens that I make it available for other people as well and so all these other things I see out there for it are awesome because it now means that I have this extra ability using my own library that I mean going back you can even imagine like syntax highlighters like writing a syntax highlighter is like boring and annoying if somebody else out there wants to write them for me and let me use them like it's it's awesome um so yeah I mean that's one of the big things as well I'm seeing with with that's one of the reasons why I want things like um the types the keywords exactly I I basically want keywords to be available so people who are building Frameworks can continue building Frameworks that kind of expand and enhance the capabilities of ethers because that way someday I can use those Frameworks and save myself time and effort um and if it makes things more secure and better for them like why not um because this is one of the things I find in common when you build nice abstract libraries you'll often find a feature you add that's like increases of abstraction it makes it easier for Frameworks to interact with your stuff makes it easier for you when you need to interact with your stuff sometimes because you often do have these very abstract high level ways you end up needing to interact with things and having already abstracted them for the Frameworks to make it easy for for code to operate with it it makes easier for you to write your own code that operates with it if that makes sense yeah it does I I think abstraction is also an art and uh you end up learning about kind of how you know where these uh things are co-dependent so uh as long as that helps you anyone from improve it you make your life easier in the future that's a it's a pretty good way to look at it um final question um how do you usually collaborate with open source contributions on the project and if somebody wants to get involved how can they contribute to others oh uh so I I wasn't sure if your first question is that with external Partners or no sorry external contributions so just on a GitHub when you are complaining or suggesting or submitting pull requests like what's kind of the process and how can they get more involved if they would like to absolutely um so generally I prefer I mean it's one of the things we're trying to change with the V6 I'm trying to be less Mega Millennial um but I've historically been very tight with my code and I don't like other people just just um modifying it so I actually usually prefer like there's definitely PR's I appreciate the pr concisely shows the problem and but I still usually make those changes myself there are weird like attack vectors from just merging PRS so I merge them manually um there's actually git pull up I should give them a shout out as well I'll be um announcing they've integrated with ethers because ethers has its own um process because ethers doesn't doesn't really merge PR's it kind of the ptr's eggs damn it and I merge manually but now I've got a script that runs and anyone who has been tagged in one of my commits for either PR or an issue I really love issues as well if someone wants to open an issue and say it rather than building a PR because a PR is actually quite a bit of effort but if you've identified the problem is like oh in line 37 of this thing it's a plus or is it less than or equal to which would be just less than um like just a quick example of you know that sort of thing it's something that I can change very quickly and easily make a uh and then push the fixo for and I take all my commits with issue numbers and that sort of thing so the cool thing is the script now just picks up the fact that you reported above you don't have to fix the bug you just have to report the bug if you reported it and it gets tagged yeah so don't just report bugs because if you just open up and report a bunch of scam it's not going to count it's only for ones that actually get tagged as solving something but they get added to the contributors file and the contributors file has the Json equivalent which is then fed to get co-op and they can use that to like issue a a co-op I also call it I don't know how to how to pronounce the thing I say a poem so yeah at least you Co-op um and so basically yeah I mean I'm always open for if you have a question please use discussions if you have an idea discussions also has an ideas thing um if there's enhancements you can jump right to that but usually I'd recommend starting a discussion on GitHub about a new idea before jumping to the enhancement but basically I do everything through GitHub um everything is an issue everything is discussion or PR um I also listen to Twitter if people want to tweet out to me it's at rickmoo um uh I do keep in mind so I mean there's definitely climity issue things we have to worry about so I do keep a complete synced copy of all of my GitHub discussions issues ETC et cetera locally so that if there ever is like a tornado cash like event against ethers for whatever reason um then there I have somebody to at least mirror a lot of that data but for now basically everything goes through GitHub and any aspect of decentralization decentralization happens on my side on a private um clone of of all that data so awesome that was great well thank you so much and uh can't wait for V6 to come out very soon excellent thanks next
