ETHParis: SKALE have your cake & eat it too
ETHGlobal·Wed, Oct 9, 2019, 12:00 AM
ETHParis workshop: SKALE Have your cake & eat it too. Chadwick Strange and Christine Perry of SKALE Labs explain and demonstrate ways to approach the challenges of building something at a hackathon, starting with the example of effortless smart contract deployment, for developers and hackers attending ETHParis. ETHParis took place in Paris, France, as part of the ETHGlobal series of ethereum focused hackathons. For more information go to ethglobal.co March 9, 2019 at the coding school 42 in Paris, France.
Transcript
hello my name is chadwick strange vp a product of scale labs I'm joined on stage with Christine Perry our solutions engineer we're gonna switch things up a little bit so we decided to put on a little bit of a play between us and we really wanted to get away from a technical talk we really wanted to just show you how everyone can have their cake and eat it too how can you win you're here to win bounties so we want to try to help you out all right so we're gonna do in the next 25 minutes is we're gonna go over you know us being here at the hackathon and joining a team so I just met Christine at the hackathon hi Christine hi hey let's build a project let's win some of these bounties so we're here in Paris what should we build it's like what what things do you like what should we build that's a good idea I think that I want to try to digitize building a cake fine cuz I really like cake and I want to build it on the blockchain I know it doesn't make sense but I'm pretty sure I can extrapolate some part of it and put it on the blockchain so are you with me I like that we're in Paris some of the best pastries are here so let's do it cake I want when I want cake I want to be sure that I order cake I can get cake nothing prevents me from getting cake how can we do this how can we make this user experience of getting cake as simple as possible so I think first off we need to have let's talk about the requirements like if if people want cake they should we should make it as seamless as possible you know allow them to order cakes without any difficulty so the user user experience needs to be really solid really good what else do you think we should have well I think before just going full throttle let's slow it down a bit and let's work with existing technology so I want to deploy this one rinkeby and then maybe we can see how we can improve it or already have something developed and we can start there and then improve it but I walked around and the scale team gave me this prototyping pod that apparently I can use to model out my my cake contract really so I started to write down some ideas it's just a team of you and me right now we have room for two anything else wants to join us yeah you okay so I have one more also more but I also had design ideas so we're going to need to upload some ingredients those are gonna be our assets and I'm assuming that we may want somewhere to store it I know there's like file stores out there but is there any way we can still keep that decentralized ona block chain - not sure but we'll see of course meta masks cuz it that seems to be like a standard today like you have to interact with meta mass and then I'm gonna use blockchain rank B and I have to write my smart contract got it got it yeah everyone uses rinkeby everyone uses meta masla let's let's use these tools that are available everyone uses and let's see how it works out all right Wow if you're with me then let's go ahead and look at what I felt so far cool yeah you are you said that you built a smart contract first so can we take a look at this yes thanks for reminding me okay so my smart contract here bakery what I'm doing is I have a smart contract that I want to create other smart contracts from so I'm not sure how that's going to work out but I just have the basics here and essentially what we're gonna do is create a new cake and each new cake is going to be a smart contract sorry it's own contract I see so a contract that creates a transaction and that instantiates another contract yeah so I'm not finished with this yet I'm gonna need your help I know you've really good solidity so you'll help me fix this um but right now I just want to see if I can just deploy the basics all right let's try it out all right so if I go back to my application I have some ingredients here every cake needs to basics eggs flour milk these are currently just stored on my desktop so it's running really fast but I want to see if I can find some also store that but we'll worry about that in the future so what's the first cake that you maybe wants to make what else would be add to it oh no I mean a lot of people like fruit cake it's definitely not my favorite cake mine either but you know we'll just go with it let's see what a fruit cake turns out to be so make cake button actually interacts with my smart contractor in rinkeby and oh it looks like I don't have enough guy let's fix that all right all right so I'm gonna refresh let's read our ingredients here root make a cake all right it looks like it's working it's taking a while taking a while okay I'm gonna wait I am pretty sure this is going to work the transaction will come back eventually all right so waiting it's a long time to wait for a cake waiting you know a song I don't know a song no not a good singer all right okay well you're in luck the cake came back we have our fruit cake it's not that great I would not eat this if doesn't look doesn't look pleasing to me it's gonna it's fruit cake not my favorite cake all right well how can I make that better so let's see if we can put scale into the best sure I've heard scale has a scaling solution for smart contracts okay so I interacted with Chadwick already and he gave me my S chain and documentation now I saw a presentation on this yesterday that went through deploying this truffle and there were cold samples here so I followed exactly that and copied this snippet over and into mine my code and so if I go to my truffle file and I paste that endpoint it looks like all I have to do now is change this and use that new scale endpoint so just like that I'm able to deploy the scale pretty easy you want to see how that works let's try it out okay so if I go over here to my application I'm gonna use truffle deploy reset because I might have done some weird things we'll choose that new network that I just created for scale and I won't compile all my contracts that are we have employed the rinkeby so I want to use the exact same a be eyes on both networks so let's see if I can make that work all right all right it's executing hopefully eventually I'll be able to see those smart contracts apply to scale one thing I'm noticing is it took me forever almost ten minutes to deploy the rinkeby right now I'm almost already through the migration and I'm on my last contract here and it's deployed that went really fast it's a lot better so if that's just as fast let's see what happens to the application using these smart contracts once again all right so I'm still gonna have the end-user use meta mask I'm gonna switch to that scale chain and let's make a new cake all right let's let's let's improve upon our last thing because we have we're using scale so instead of a fruitcake what about cheesecake I think that's a big improvement cheesecake yep alright I'm not sure I kind of like cheesecake but anyway okay so same process looks the same I'm gonna go ahead and confirm that transaction and I did not have to wait 45 seconds nice nice that's much better much better yeah but I did have to click a bunch of things metamath keeps coming up and why do I have to click metamath like still seems like a little bit too much for the user to have to click through these windows that pop up can we make that simpler you're right like when you think of applications today like no one has to go through these extra hoops to be able to interact or get the outcome from the application interacting with it feels like adapt like how can we make it feel more like an app okay um let me see here so let me go back to the documentation and see if there's anything else I can use here there is as money transfer script so well let's last idea about this let's say that I wanted to have the user deposit a certain set amount of funds and then I'll be able to pull from that amount of funds every single time I want to do simple transactions by clicking a button gotcha i I can assume that they'll login once maybe when they sign in that sign in is them giving me the okay to approve all similar to like a 721 approve all method gotcha and we will be able to then approve all of these transactions in the background so with scale I'm seeing that there's only a deposit end and exit out so even then I only had to interact with two methods from their smart contract to kind of frame out that that functionality so it's like creating a new cake could be an e rc 7:21 a collectible people do collect cake recipes per se yeah yeah so there could be something there with that yeah okay well I don't think I'm gonna go through and do that at this hackathon but maybe I can at least do the signing piece were automatically signing for the user and having the transaction work in the background so let me walk you through what I started so you can see what that looks like all right so if I go here to my source and this is in react so on any of my components I have actions here I'm bringing in that smart contract as you can see here but instead of making a cake and having meta masks show up I'm going to do make them make a cake with scale using that transaction essentially I'm only doing a few things here because I use truffle to deploy I mean used truffle of surgery of my contract it's simple enough I'm cake doc deploy and then from there on I'm then able to create a raw transaction switching over to just web 3j s technology after that I just have to simply sign it with a private key and because I already have the money from the user they gave me the go-ahead I just gonna use the funds from that from that account lastly what I'm gonna do is send the sign transaction so that way everything happens in the background and the user does not even know they're interacting with a blockchain application sounds like magic sounds like magic but will it work will it work let's see okay can we try it let's see so I'm gonna switch it over here so just use scale in the backend let me refresh my ingredients so I have eggs I have flour I have milk are there any other ingredients well we don't have chocolate up there and I think really gonna bring this up we need to have something chocolate integrated so maybe like a tiramisu something like that or some sort of chocolate cake I love where this is going so for tara misu we will need chocolate and i'm gonna add an ingredient here too I'm gonna add an ingredient to my application and it's going to use skills file storage I also saw in their documentation - how's that file so let me walk you through what that looks like and the documentation here what you have are a few set files that you set methods you can use I can upload I can delete I can download to my browser or to a buffer and they also had an NPM package to make it easy to work with my react application so instead of having to interact with the low level contract even though I could I had these easy methods to be able to add this functionality to my application you want to see what that looks like absolutely yeah okay so in the same actions file here if you see here I'm able I'm using the upload feature wow storage is the name of the NPM package that I pulled in and then I'm using upload file and I'm passing some key parameters here now I saw there was an option to still let meta mask do its thing in the backend by not passing a private key but we're trying to make sure that the user doesn't feel like they have to go through another hurdle to use our application so let's just do it this way awesome it's all packaged all into one so let's try it out all packaged all into one so if I come back here what I see is I now have that file and I'm going to call it from the blockchain to add to my application god sure that happened pretty fast that's awesome so that's pulling that file that we uploaded onto the skill chain directly into our onto our app right okay so more decentralisation for our application here so let's go through and make the cake and see what happens that was pretty fast look at that without metamath yep or without another quick tip for the end user yep I clicked a button to add my ingredients we stored a file onto the scale chain we were able to pull that file from the scale blockchain and I'd only ingredients together to adapt that really feels like an app I had to like one button there is no meta mass nothing it doesn't mean doesn't even feel like a blockchain at all pretty amazing I agree awesome so how so here's an example of how you all can have your cake and eat it too so as we've shown really good UX really good examples of this and we actually have a chef in the audience is an expert cake kind of sort with some macaroons yes so for those who do really want to eat cake and not just a digital Thais one we have some macaroons in the audience so feel free please feel free to take one any questions yes after this demo sorry the question was is a demo available to download from our github and I will be adding it there right after this presentation so you'll be able to have access to that so if you interact with us on our discord I'll be able to give you the link directly there so you won't have to search for it any other questions great thanks too fast oh yeah how do we compare it to plasma so plasma is another skilling technology that has a different different architecture we are a side chain so we're a different style layer tech skill in technology yeah yes can you reconcile the state to the main chain so we use a lot of messages to communicate between a scale side chain and a scale into the main chain so it's just messages that we send back and forth so we don't send any state per se it's just messaging excuse me yes well you you if you do want a message to the main chain we do offer a micro service that allows you to transmit those Mehcad messages back and forth but it's it's a very simple integration to enable that yes yeah and we'll be happy to like explain more details about the sort of snapshot service after this so we can meet with you and kind of discuss if you have a specific solution in mind we can help you out with that yeah yes sure so the servers so there's a network of permission nodes there validators that provide compute and storage power to the network and so those are the people that are running the servers so it's a permissionless network and when you select a scale chain to scale your app on to a subset of those nodes are chosen at random and that allows your contract to operate really fast if all validators are colluding yes but as adapt developer you have no control over these servers they are independent servers that operate independently and over time the scale chain their servers that are swapped in and out if n minus 1 are corrupted so it's a Byzantine fault-tolerant system so it assumes that less than a third are are malicious all right thank you [Applause]
Automatic transcript — names and jargon may be misspelled.