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

Loading player…

ETHParis: High-speed SKALE sidechains: effortless smart contract deployment

ETHGlobalWed, Oct 9, 2019, 12:00 AM

A workshop talk at ETHParis: "High-speed SKALE sidechains: effortless smart contract deployment" **VOLUME corrects at 0:30 seconds in!** ETHParis was an ethereum focused hackathon held in Paris, March 8-10, 2019 as part of the 2019 ETHGlobal series of ethereum focused hackathons. These workshops covered a range of topics, would explain different developer tools and approaches for hackers. Friday, March 8, 2019

Transcript

Wow yeah so my name is Stan Plato I'm the CTO of scale lips so we're getting yeah so probably every one of you guys knows how to program solidity right that's why all of you are here hopefully making this lots of money but solidity truffle metal mask remix there isn't like number of tools people love and people kind of keep on trying to create the apps and at every hackathon they're like so many of these d apps but the problem is that none of them actually getting so much of traction we don't really have the apps that have like millions of users so definitely there's a problem and the major problem about ETH is scalability so as you guys probably know transactions cost lots of money you pay me at least like 10 cents or more per transaction and then you also pay to store things pay like 10 cents store 256 bytes which is pretty much very expensive so the scalability is something which is really making it hard for the apps to propagate and to get lots of users right and if that's not bad enough the other limiting factor is speed so it's crazy to think that today the best we can do is wait 40 blocks or 10 minutes to finalize a transaction and so through layer 2 solutions we're hoping to find ways to speed that up but Stan can you first tell us about some of the current solutions available today yes so several I know some people tried in the past to solve this how the scalability problem many people do just computations no centralized server or you do use a network like proof of authority which is pretty much like a centralized server it's something which is controlled by by particular party so you can actually do lots of computation on a centralized thing but it actually doesn't really address the this period of blockchain because blockchain means that the computational system is independent of everyone right it's trusted and dependent the code runs everywhere and runs forever that's really not something which happens for centralized server another possibility is you can have offload storage in particular to a storage network so there is like ipfs there is file coin which is supposed to be a secure storage network but this storage network is storage networks are not there yet although some people are working on different kinds of storage networks but they not yet use and then you can always wait for a th 2.0 we probably know that it h 2.0 is going to have like a thousand transactions per second and it's actually gonna to speed up a lot they may net the zero maintain but you still have to wait for like probably two or three years until the zero main it goes to the thousand transactions per second finally what you can do you can use layer two side chains that's something that we obviously do at scale and I'm gonna tell you in a second would actually this the side chain is how it works noted does well then how does it work using a slayer to solution yes so side chain is actually something very simple it's pretty much like a block chain so it's a book chain like a theorem like Bitcoin the only thing it's not using proof of York it's using proof of stake so instead of using like lots of computations like number crunching it uses cryptography and then still fully decentralized it's run by minors or validators however you want to call them and then when you come to us with a Dieppe you know some of these miners are gonna run your Dieppe is going to be still fully decentralized and this book chains there will be lots of them they're going to use this proof of stake protocol and can we get into a little bit more about how to deploy a smart contracts yeah so our side chains are fully compatible with ETH compatible with solidity remix truffle metamodel school of the stuff you guys been using they're just working faster so when you come to us we actually give you a chain a block chain which is totally yours although you don't control it it's run by independent people and on this block chain you can deploy lots of smart contracts they work really fast they work really cheaply and so do you you can do most of the computations there and then in your browser you literally run two versions web 3GS you probably guys know what the web series is it's a library that you use to connect a blockchain so you have one instance of web cj's that connects to the side chain and other one connects to the main net and really most of the computations you do on the side chain like if you have a game all of the game dynamics you don't decide chain if you have a decentralized all of the bidding and asking you don't decide chain and really you only need to use main net when you deposit money so you deposit money into the side chain on the main net your monies is actually frozen on the main net and the clones are created on the side chain and then you operate in this clones and when you want to exit you actually destroy the clones and go back to the main net but all of this functionality going back and forth is secure and provided by us to you so literally you just have to use several lines of code it's a regular library which you can use in JavaScript you can use it and in Python it's a very simple thing for you guys because we do all of the secure dynamics of it direction of the side chain with the main net thanks Dan so the next part we want to get into is how do we actually make the changes in code at this hackathon we understand that you might not need scalability to its full potential but doesn't mean you still can't use it here and I'm gonna show you through a live demo of how easy it is to change two lines of code within your truffle config to deploy to the maintenance well deploy to scale so I have this tab and the snap currently references to smart contracts one for authenticating and one to play rock-paper-scissors which we'll all play together soon but first let's see what that process looks like well rinkeby so if I interact with my authentication smart contract here the process you familiar with meta masks comes up you're able to confirm that transaction but what you're experiencing now is the waiting period waiting for that transaction to be finalized by rinkeby before you can actually move on and actually have the users use the rest of your down that's look a really long time just assigns a person up so let's log out and see what this process would look like using scale so here at the hackathon if you go to our discord you'll be connected with one of us and we'll give you an s10 that you can use for this hackathon that s chain also is going to be accompanied by documentation I'm going to copy this here because I'm gonna need that later and click into this documentation so you can see what we have developed for you guys so it really is a quick 1 2 3 step for getting up and running with scale essentially we need you to connect some meta mask and tomorrow I'll show you how to do it without meta mask we can give you tes eath to play around with and then you simply deploy your smart contracts using a truffle config or whatever configuration you are currently familiar with but that really is it so if I go to the code samples here there's also code samples for understanding how to actually make the changes in truffle or ingest web 3j s and nodejs so if I go over to my program here what you'll notice is a truffle config file that you've probably seen before I've tested already locally on ganache I've then migrated to rinkeby and so to make the change in scale it's going to be pretty much following the exact same pattern so the two lines of code that I was telling you about you have to change is simply pointing to that end point here that will give to you via our disc or channel simply copying an existing config that you already have or rink B or whatever else you're using and then changing the names to actually map to that specific end point that we want to use and really that's all you have to do so those bounds that we have they're pretty easy to achieve now if I go over to my terminal similar to deploying to rinkeby the process is going to be the same truffle deploy I'm gonna go ahead and do a reset because I've deployed this contract before I'm gonna choose the network for scale and then I'm just gonna compile all but really that's all you have to do it's a deploy to scale now I won't bore you and have you watched you have you watched this running instead what I'm gonna do is go back to the app where I already have my smart contract deployed and we're gonna go through this again but this time using scale now I want you to remember how long it took for that transaction to come back on rinkeby and just see the difference in scale so if I start the demo again I'm gonna select my name sign up similar process we're all used to confirm and just like that in near-real-time I'm within the application so let's try a different smart contract call and play the game rock-paper-scissors so who wants to play with me all right what move yeah rock paper or scissors scissors all right let's see so again this is referencing a smart contract with your ploy to scale and in near-real-time you're not waiting and you won so again all I have to say is it really is just changing two lines of code to deploy to scale and then you can start to run your smart contracts written as literally absolutely directly on our network without any changes on your side but to finalize this of course we're offering six bounties here five prizes for 500 euros one for a thousand and then if you just want to play around with that scale chain while you're here please log on to our discord and we'll give you one any questions that's a good question so to reiterate for the livestream what he was asking is if we give him a chain is it going to be shared by other people or is it going to be solely for his dog and the answer is the latter it is going to be your s chain and you won't have to share that so yeah the other question that's a good question so to reiterate a question again for the live stream the question was if you're using the side chain do users have to go and meta mask and change it to reference the side chain URL the answer is it depends it depends on how you implement it for the purpose of this test and ease of demoing I simply switched to the S chain within the meta mask but as you can imagine in production that's not going to be the case the side chain is meant to operate in the background and so ideally you want to use mainly just web 3 methods to be able to interact with that s chain so you'll sign the contracts before sending it and I have a workshop tomorrow with the demo explaining other methods for thinking about the architecture around deploying for a side chain and I'll be joined with Chadwick over here in the corner so yeah I'll explain how to actually do that without having to switch within that mask that's a good question I'll repeat it and then I think stand to take that question so the question is if you have an S chain that's going to be dedicated to you who are the actual validators that are running that consensus for your application I think it's a very important question and so when you come to us to the network right and you create the chain we don't want you to control the chain because we need to keep the fine balance of blockchain where no one has power right on Bitcoin you can't control Bitcoin network so even if you had even though you are the creator of this chain you have no power over it and the chain is run on independent validator so miners very much like Bitcoin or ETH main net so these guys are picked randomly from a legend Network and they are actually a science to your chain and then you don't control it it becomes an independent blockchain and from time to time these guys have also rotated so they don't stay there forever and that's really a fine balance that we are trying to reach because our most important goal is to keep the level of decentralization high because the entire premise for blockchain is a computational engine which doesn't depend on any parties so it can be trusted and your your smart contracts can run for a long time and once you put this mod contract over there even you won't be able to control it so we're really like focused on this particular issue that's a great question so the validators are compensated by the services they provide to the network so there's a gonna be a standard stake that you'll you everyone would be able to we'll be able to put a server on the network and starting sometime this summer all of you guys can become validators and then do we need to measure quality of service for the validators so we introduced this notion of decentralized quality of service so decentralized SLA service level agreement where if you put your server on the network there are some randomly assigned people or actually nodes that measure your performance metrics on you and you're measuring metric on someone else so the actual matrix measurement is also decentralized so imagine some kind of a self-organized group of people where we all like all together providing some service but then we also every month I report how good your service was and you report how good my service was there's some mathematical averaging and then and then if you're a good behaving service provider you're gonna gonna get paid the same bounty so the bounty is going to be standard and although the nodes in the network are going to be standard nodes and then if you have lots of money you can buy a lots of servers and put them on the network and then and then how fast so when you when you when we spin up the the the chain we need to do some really interesting cryptographic algorithms to randomly pick this node and there is lots of cryptography going into this random picking of nodes there's a set of algorithms which is called probably heard about this BLS physical signatures and come and go and all of the crypto thing so it takes some time to spin the chain the production chain I think the development chain we can spin really fast but for the production chain it will take probably like several hours because all of the algorithms have to complete what's important is that we run all of our algorithms on a zero main net so we're not like competing with the main net everything which we can do on the main net we do on the main net and currently we have a very a large set of smart contracts that we are actually going to deploy to the mainland once our network goes production and this oh that's all of this bounty payments service level agreement all of this stuff is going to actually happen easy Romain net only th main net so the way it's going to happen is that it's a deal developer you're going to decide for how long are you going to have this production chain so the production chain you can only have for long time because we have to protect the security of users right you shouldn't be able to kill the chain really fast so the production chain you'll be able to have a like for a year or for two years the test chain you'll be able to spin up and down really fast but it won't be production now what was it yes so so then an interesting question is how once you have that you chain for the most part is going to be almost free for the end-user but to protect against denial of service attacks we still have to introduce some kind of guest payments which are going to be almost zero all the time but if someone is doing any other service attack the guest fee is going to go up to protect against in all of service so so this is still guess fee for the most part your your network your chin is going to be under utilized and the guess he is going to go pretty much exactly to zero because we are using very much the same algorithm which is going to be used in a th 2.0 where the guess he is slowly changing depending on the load of the network and if the network is under loaded the guest fee will go almost exactly to zero but if the network is getting loaded the guest fee is going to go go up 1 an interesting additional thing that we are implementing is that you will be able to replace guess fee by proof of your work so it is a user which doesn't have any tokens and you want this user to actually like on the so create a social network for instance on blockchain right don't user doesn't have any tokens so how can this user actually use blockchain user browser will be able to do a little proof of york in lieu in replacement of the gas fee and in this case you'll be able to use unauthenticated users that you don't have any tokens exactly so are each of our genes you can view it is pretty much a copy of a zero main it in the sense that is fully compatible you can use truffle you can use everything it just works faster but api wide it just looks to you as a zero gene which we should works faster we're working on implemented next implement this fancy bye-bye that we're gonna gonna participate in the hackathon in New York at the time currently just zero our guests fees for this hackathon but the next one is going to have this implementation you would actually the chain would actually have its native currency so you don't have to have any easier you could view you can print any amount of this native currency and distribute it to users in any way and don't no reason to having having this native currency is to protect against you know denial of service and you if you don't want to do this it's very interesting possibility just you will be able to configure the chain in such a way that there's no guess fee in terms of native currency it's in terms of proof of work and then everyone with the browser will be able to use the chain and say I don't to that we're going to have a workshop tomorrow to explain how to pretty much office gate on the Gatsby from the user so you'll be able to see that tomorrow at 4:30 I forgot the one thing which you have another extension machine is gonna show it tomorrow we have also interesting extension which does file storage on the blockchain so we'll be able to do websites like upload images and music and Christine will show it tomorrow absolutely your chain actually your chain is going to be totally yours and there will be different types of chains there will be change that take the entire server but they will be also less expensive chains in a shared environment in the sense that the server is going to be split in docker containers and so we like split the server in ten docker containers and then each of those docker containers can become part of a different chain and then you have to pay ten times less so we expect if people have lots of money to pay they will create powerful exchange but many people will just be fine creating this kind of shared as chains think about like Heroku has this unions you can that's a very similar idea of sharing so one single server can participate in lots and lots of small like tiny chains which are not powerful but maybe enough for a particular application and they're going to be really cheap absolutely the servers are going to be like done by Diwali by people who want to make money very much the same way like Bitcoin or zero but we don't have number crunching we have like just literally we'll have to buy like a two or three thousand sir like mid range server and put it like all on the net somewhere and then you'll be able to make money from the server but that's the validator the guy who makes money putting the server on the network and the gif developer will just come and pay for creation of this a chain and the chains are not going to be expensive especially the shared ones could be very inexpensive maybe I don't know hundreds of dollars I don't know exactly the amount but I suspect that the shared ones are going to be really inexpensive yes it's a great question so we were thinking about these features and frankly this is something which probably gonna be happening a little later but we're thinking about replicating the state in all things thinking about things like reading a distribution like Ubuntu Linux or Red Hat Linux we're just as gene will have a package manager you know there are like package manager for smart controllers like it each p.m.

and as a package manager and then it will be almost like a do Linux distribution where it will be like you know open Zeppelin and you know all of this stuff ENS and all of the different nice packages and you come prepackaged and pre-tested in a very similar way like Ubuntu 18 comes with all of the stuff pre-tested so well get kind of thinking in this direction reaching distributions I think you guys very good questions [Applause]

Automatic transcript — names and jargon may be misspelled.