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

Loading player…

J1 SAY 09 Jared Wasinger, Lane Rettig Hacking eWASM Cool demos!

Ethereum ParisTue, Oct 9, 2018, 12:00 AM

Speaker

Lane Rettig

Transcript

I'm gonna show you guys a quick demonstration of what I've been working on good oh yeah okay so I'm gonna do a quick demo here so basically what I'm going to be showing you is so the Blake to hash function and there have been an EIP proposal for adding that as a pre compile to aetherium but I'm going to show you that as a web assembly contract so okay so let's dive in here so all right so all right so the first thing here that we have is I have a modified C++ aetherium client running and there's nothing perfect okay great okay so let's pull up so I have this contract written in rust I'm just gonna do a quick overview of it so I found this rust Blake to library basically what it does is it just hashes the value 0 and stores the result of storage so yeah so this is the rust code I guess like one thing to note here is so how in you awesome how we interact with etherium is we use we import methods from the etherium interface so like if you can see on line 16 storage store yeah okay so Oh oh yeah that's that's pretty bad isn't it okay yeah is that is that good okay so yeah so basically like I was saying on line 16 we include storage store to interact with to put the result of this hash on the blockchain and then I'm gonna scroll down so yeah it's pretty I mean I don't really want to explain the details of the code but all it does is hash the value 0 and store it as storage to location 0 right so I am in a execute little script which is gonna build that rust into web assembly okay so and then [Music] let's see I need to execute a second script and what this is gonna do is so in order to deploy a contract you have to pass it as data to a transaction and that the code in that data has to return the code for the contract so this is just gonna create the data that will allow us to do that and then let's actually send the transaction that will create the contract okay so let's see let's see what the transaction receipt is gonna tell us ah okay it hasn't been included in the blockchain yet cuz a block still needs to be mine so let's wait for this to tick to ten its mining pretty slow right now okay yeah okay great alright so that's not really it's not easy to read but basically this is telling us that it created a contract at this address so let's actually invoke that contract okay so I'm just gonna scroll up to make sure that that was executed oh I set the knots too low let's do that again okay and grab the receipt from that just to oh yeah it still needs to mine a block for that to actually be included okay it's a mining slow today oh great okay yeah so Casey traded a nice little UI so that I don't have to keep showing you the command line so let's actually view the contract that was created through this he was an explorer UI this way for the page needs to refresh here oh yeah yeah I did sorry my computer's yeah okay so it needs to actually load up the accounts here and it will it will start the the wasum contract with a little tag or maybe not maybe I just need to open it up No let's try refreshing it okay so yeah it's it's not connected third time third time was the charm and hopefully it will load the account now yeah okay this is not working as I had intended it to of course it always works when I use it on my own machine but as soon as I come up to demo it it's yeah so basically what this should show you and I'm just gonna you're just gonna have to take my word and it works is it should show you that the so if we scroll back to the contract here so what you should see on that block Explorer is if you see line 36 those are the four bytes that we should be receiving as the first bytes of the hash and yeah those those are stored on the blockchain yeah that's [Applause]

Automatic transcript — names and jargon may be misspelled.