New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Delightful Developer Experience With Solidity Hot Loader by Igor Yalovoy (Devcon5)

DevconFri, Oct 9, 2020, 12:00 AM

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on IPFS and more. https://archive.devcon.org/archive/watch/5/delightful-developer-experience-with-solidity-hot-loader Mass adoption of Ethereum requires attracting both users and developers. Developers trying to enter Ethereum are often pushed away by unstable libraries, lack of documentation and poor developer tools. The typical Solidity development cycle is: change a Solidity code, compile the code, restart a local node, apply an initial state, and restart a frontend app. It can be reduced to just saving Solidity source code and all the changes will propagate automatically. We present a practical implementation of Solidity Hot Loader as well as a generic approach to enable it across the entire Ethereum developer space. Speaker(s): Igor Yalovoy Skill level: Beginner Track: Developer Infrastructure Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum Learn more about devcon: https://www.devcon.org/ Learn more about ethereum: https://ethereum.org/ Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. Devcon 5 was held in Osaka, Japan on Oct 8 - 11, 2019. Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/

Transcript

[Applause] developer conference Apple in for those of you who don't know us at open zeppelin we build developer tools and formalities of decentralized systems which power multi-million blowers economies we fear on foundation on the solidity compiler outlet and and we created the most popular smart contracts library which has over 1 million downloads and over 180 contributors as you can see we spend some time writing and auditing smart contracts and today i'm excited and delighted to share my findings on how you can improve your solidity developer experience with hot loader but Before we jump to the next slide please raise your hand if you have a written smart contract in solidity yes developers developers workers yeah with the companies by today's developers used it to ship software and it was literally immutable code once you stupid you can't change the single line on it it affected their practices Backlund the workers were really careful about testing and point in their code because he knew once it's out you can change it does it remind you something something we do today this is Internet Explorer 6 is the first browser ever used and is the first browser I've written called for back in the day it was boiling it was working in the common way you would edit your mixture of JavaScript and HTML in external editor then you save it and once you say you go back to the browser and you first the page to see what has changed and if you have to change something else you have to do the game and just remind you something and what I think how rich do our schools in the exports its head the answer is no it hasn't been having any developers DOS and I'm here not to smash Internet Explorer 6 instead it was a great piece of technology at the time you will see a lot of similarities about how developer tools were back then in the days and how developers tools are today at the blockchain and go change in general we're gonna see quick video but before that I'm gonna explain what's happening here yeah so I have a really simple smart contract it's called counter old has is that simple is that one state variable called count and you can go by the up and down basically with smart contract just counts up and down and has appropriate methods increased counter decreased under which you can modify this state variable and on the left is the front end representation of the smart contract written in create react app it displays contract address as well as the current weight which is 32 and brought to buttons to increase and decrease the counter for one and let's say realize that increase in counter by amount is not good enough low business logic and then only gonna increase it by the number of three in this video I'm gonna modify this math contract to do that and he's going to be reflected on the front yeah let's see so first I'm gonna edit smart conduct itself and save it then ever like compiled we will compile comment once it compiles I'm going to deploy but because if you don't blockchain is mutable every time you devote it you have to initialize during your contract and my old contract has a value of 32 but now I have to provide a new alias for the counter initial value I'm gonna go give one two three and also because new contract is a new address my favorite F can't pick up the files required for protium so I also have to restart my Granger app which takes some time but you see how like our now keepsake and let's say does it even work okay so I'm going to press the button metal mask as usual yes first it went from 1 2 3 to 1 to 6 and so over a minute we achieved incredible things to just change the counter somehow it's free right and I read you'll agree with me that was quite a lot of steps involved for something trivial I called one line change problem let's break it down quickly in order to at the minimal change one line is not very smart contract which is tied to some front-end app you have to change a smart contract then compiled the decoy then the story today the historic state and if you had some my complex state restoring say can be greeted not drivel because one security put all the contracts of your state is gone and if it was in the middle of my dividing some issue and suddenly you have to be wrong everything everything is gone and I experienced it personally and then you have to refresh the browser but if you think about it how it really should be is it is it the whe way if you look at the Internet Explorer 6 it's not like how we do things anymore now we have this our luxury of development tools is like loading confront me and web dev server switched just like refresh everything for us watch our files you just type called in your editor hit save and everything works in web development and I believe it should be the same experience when you develop applications for film excited to present a significant loader so you have other address this problem we're going to see another video it has the same setup where is the counter contract which channel familiar at least to not familiar with and same content on the left but right now issue our value is 58 there is a console at the bottom and we're going to repeat the same steps as just to get before whether it is time we've solidity upload or enable you're going to change the file and save it as you can see it starts to compile it's in the console while I'm randomly clicking everywhere and suddenly our front end does refresh and if I press this button it doesn't visit by free but as you can see the stage Township stayed the same which is strange because the state did appoint you can't exchange using why/how as possible let's quickly break down what's it about your desk for you compiles just not contracts essentially right in a compartment for you so they need to type in then it deploys in your body code to the local node which is Ganesh with a tricky step and then it refresh the browser page frame let's dig into how exactly it was a new code in the way you preserve your state and address Lance's availability behind since the effort logic relies on availability of pattern which allows you to change implementation of a smart contract without losing its state or address so a lot there is imitation by open Zeppelin SDK it's called upgrades and I'm gonna give a quick explanation how it works but if you want more if you want to know more go to open Zeppelin from /tk and you'll find everything you want to know about it far more examples and where the detailed explanation verse 3 the proxy contract which pretends to be your contract and handles all the calls and it is delicious constructions to redirect the function calls to contracts issue to contain implementation lodging while the contract while the proxy contract calls all the state and address in that way we always interact with a proxy contract where is why our state and rest is preserved at all times and then we change the code and hit safe in our editor what happens is the new byte code gets compiled and uploaded to the blockchain and proxy address is limitations changed to the new new contract implementation and all the calls after you upgraded go to the new implementation in that way you can achieve frictionless transition from old called the human where you preserve the state and your dress which is place nice rest really well with front-end tools yet again ability being great and awesome for many cases not always works for every project every environment every setup and I was thinking can we do better and we create some solution which will be a silver bullet for four cylinders development and any environment with any framework a library we have to talk a bit about Ganesh before as you all know Ganesh is the film MBC client which is really good for development testing has slightly used and has quite a few dishes to help you with testing and development and in particular has custom methods even snapshot TM revert even Christine and mine they allow you to do things which are not possible on production ready knows such as parity in gear for example in action shot allows you to take a snapshot of your blockchain do some stuff and then go back through and then go back to this stage which is not possible a magnet I guess honestly doubt but then it's expensive and with other commands which is increased time enough to jump in time forward to really helpful with testing and give in mind allows you to mighty block as you can see something similar between his commands is that they allow you to do things which are not possible on mayhem yeah it's extremely variable and how to do in testing in development and I was asking myself is there any missing comments for our test development Hulme clients I want to suggest the presenter evm a big command this to be absolutely clear this is on the state of an idea proposal research at this moment the idea and this command is it will allow you to upgrade smart contracts in the really hard way evolve like my notes or I turn anything else essentially just swapping the implementation of one implementation of smart contract with another limitation so I'm going to give a quick example of how it's gonna work let's say because the same smart contract under which you know we have expert knowledge fun and the original limitation just improves the count by one but you want to allow is to be increased by any arbitrary amount and on the left series of course from top to bottom and to start with an account get counter which which on 32 is the initial state of our contract and then you gotta call EVM update to update the smart contract between you by code which will be by called allowing to increase it by any month and after that we wanna call increased counter method here isn't quite free but this car is not going to fail because now code now our contract has you implementation and after that we're gonna call a jet counter method which returns the magnitude 35 in that way not only we are graded our contract we also preserve this day and address which is really important for developers schools because you want to have you want to hide all the complexity from the user a developer and to hide it inside the dev tools in this approach as might be in English which surfaced an opportunity for other developers tools as well where ability just modified any modified mutation of management contract of course not gonna happen on the black chain in anywhere anytime but again it's very variable for developer tools and will enable all sorts of tricks which will make each video for the development process then I won't talk a bit of teacher free death tolls in the way that I believe the future is that predefined remain many possible fishes and if you all know almost a century ago gasps cries were completed electric cars but for some reverse reasons electric cars lost the bet off to the gas cars and only right now electric cars starting to get some traction and in this way blockchain doesn't particularly has to happen where like other futures where it happens in 100 years but I personally don't want it to happen in 100 years because I want to see happen and I believe that if I developers tools you'll stay on the level Internet Explorer sees is going to try to bring new developers to the field in the system because the expectations right now developers so high they'd be like super spoiled and unless we make this awesome we're three developers which happen I would say it's going to be incredibly hard to achieve developer adoption I urge you all to try uploading today do it just run ten Peaks seal I unpacked the oil commend and by the way this is the slide where you take a picture but if you security you concerned person and don't want to run random calls on your machine you can just go to open Zeppelin github account and clone start repeat tutorial this is a tutorial which has say to upload your there enable so you can wherever it does has a great ability insulite so you get more than just a lot of the ladies and it's rather polished experience thank you very much for time and patience [Applause]

Automatic transcript — names and jargon may be misspelled.