ETHDay - Gamefi is coming to a Ethereum L2 and it’s going to be ludicrous - Austin Griffith
CryptoCanal·Fri, Oct 7, 2022, 12:00 AM
Speaker
Amsterdam hosted Devconnect for a week, gathering the brightest developers and Ethereum builders. To get a glimpse into this universe, we hosted ETH Day on April 18th at the Transformatorhuis to showcase the best of the week to a wider audience. 🌷 Austin Griffith https://twitter.com/austingriffith https://speedrunethereum.com/ https://austingriffith.com/ builder Ethereum Foundation 👩🎤 builder on Ethereum Learn more https://cryptocanal.org/eth-day/ Join our TG community https://t.me/CryptoCanalCommunity We would like to thank our partners and sponsors that made this event possible. 🧡 Ethereum Foundation https://ethereum.org/en/ Devcon https://devcon.org/en/ Balancer https://balancer.fi/ Oasis https://oasis.app/ Perpetual Protocol https://perp.com/ Lido https://lido.fi/
Transcript
[Music] all right round of applause all right here we go for austin griffith [Applause] all right get these get these settings out of the way okay so game five's kind of loaded i don't idk if i'm the best person to talk about game five but i'm just gonna talk about like games and uh my my experience going through building games so hi i'm austin griffith uh i work on like developer tooling developer onboarding if you know web2 developers or you are a web 2 developer trying to get into web3 trying to get the mental model i have this website called speed runetheria it's a great place to get started and get the mental model it's built around scaffold eath which is a dap building kind of factory it helps you build adapt quickly if you're you know joining a hackathon this is like a stack that comes out of the box and you'll have an app deployed within within an hour uh i started building tools and games in this space and one of those tools is ethe.build so if you're looking for the fundamentals check that out so i really love building tools i love building tools that get other people to kind of scale up their own work and i really love making games i got into like early facebook games uh and then i discovered ethereum and fell in love with smart contracts and i built this game called gallias and i want to kind of talk about it just a little bit here so this is like a massive so these are all like hand-painted graphics like i painted them on oil and then i took pictures of them and each one of these ships is a different player and they kind of buy in this isn't going to work because i don't have there's no like i'm not even on the right network so there's no timber at the harbor right now so you can't mint another boat and it's all out now you don't have the minting keys for this so this game's kind of bricked but i just want to show the game and show kind of if you watch here these ships will move ooh they might not actually we need to have a block mind and i need a network for that let's see if i can reload this but what i want to talk about here is movement in the game when you build a game on on a blockchain it's going to be public it's going to be slow it's going to be asynchronous so you have to think about how you're going to craft your game to to run on this new kind of a network and one thing with galley s that i discovered is movement isn't going to be like move left move right move left right like you're not going to be making movement on chain with every move you kind of have to be clever about it and so with the ships i set it up so there's a ship and you make a transaction to put the sails up on the ship and then the ship basically sails with each new block that is mined so you only have to make one transaction to kind of start the ship and then another transaction to drop anchor it was just like kind of like that clever like click like oh yeah that's how we'll do movement in this game and and you kind of have to think about things a little bit differently as you're building blockchain games and dang if this could load i would show off those ships a little bit more uh also randomness right we made a pogs game and you uh you throw down these pogs and you win them randomly from people and we built it on main net like back in 2019 or 18 2018 i think and uh if you wanted to play this game now it would cost like a thousand dollars per game so it doesn't work at all basically uh and then it's kind of scaling up a little bit more we're starting to build games around the ethereum development process or games for ethereum developers and that's kind of what i want to dive into more after we get get some of these fundamentals out of the way okay so movement first of all movement is going to be hard you're going to have to think of tricks about how you're going to move your assets within the game how on chain is it going to be are you going to use events a lot a lot of interesting things there randomness is another thing right you can you can use commit reveal you can use the block hash you can use vrf it kind of depends on how good your random needs to be and so that's just another topic as you're getting into game building that you're going gonna have to explore so one thing that i did wrong let me see if i can get this market to come up oh man the internet is not fast enough for me to darn it okay so when i built this game i went in into the dark i spent months on it by myself i didn't show it off to anyone and i spent way too much time making the thing and not enough time showing it off and getting people to use it and i think this is a big lesson with your games if you're building a game uh build it and show it off and get people playing it right away right get your dev loops tightened don't go in the dark and build something for months and then show it off and expect it to to blow up right so uh let's get into as as you're building your games man i really wish i could pull up a marketplace so i built a market in scott or in gallias and you can get in there and you can trade assets uh but now there's so much more composability in the space you can spin up a little like uniswap v2 and have your these token assets being swapped back and forth so uh what i want to zoom in on there is instead of trying to build like this a giant game that has like everything built in look at the components of the game and find something that you can make that's super composable like a loot system or a map generation system or something like that where it's not actually like this giant game you're building but you're just building one component one composable component and making it available and and uh you know like easy for other people to implement into their games that's that's the kind of thing that'll get more traction okay so i think that's basically my my spiel on uh building and getting started with games uh the next thing i want to talk about oh burner wallets i didn't talk about burner wallets yet so uh if you played let's see where's a good game to do this on uh here we go so so if you're about to make a move in a game let's go find the game that we have deployed on rinkaby see if it's loaded please work internet i'm like tethered through my phone come on load it come on okay so a burner wallet is you have a wallet in local storage and that allows you as a developer to not have to worry about uh chain id and nonce and a lot of other like security issues am i using my mainnet wallet to deploy and play around on test nets you want to be careful with that right so with with burner wallets basically you you create a wallet for the user right in the browser and then they can just click click click click click and kind of like make those transactions happen in the background it's a great experience for the developer let me see if i brought nifty ink up in one of these i didn't nifty ink is a good example oh man what am i doing it's going to try to load this nifty dot inc is a good example of burner wallets being used in production if you take a tablet and you open it up and you go to nifty.inc you're going to get a key pair generated for you on page load and you as the artist you can draw something and mint it on chain using a meta transaction and you don't know anything about gas you don't know anything about wallets you're just an artist making something cool you post that up to the gallery you can even put it on sale and then someone can buy that uh that nft from you and then you earn some money so you as the artist didn't know anything about crypto you got in and you made something cool and then if people like it you you start to earn crypto and it kind of flips the onboarding on its head instead of oh you'd like to play this game first you need to learn how to protect a 12 word seed phrase and how to use a wallet and all of that stuff instead of doing that it says go use the app provide value to the ecosystem and if the ecosystem likes what you're drawing you will gain value and by gaining that value before learning about the 12-word seed phrase it flips that whole learning process and it turns it into i now have value how do i protect it and that's when you can teach someone about a 12-word seed phrase and they're going to be way more likely to want to learn about it if they have money they need to protect rather than just to come play this you have to go through this awful onboarding so that's nifty inc and that's how burner wallets are used and uh i i would i i have to mention dark forest one of the coolest games right now on chain uh and they use burner wallets if you've played dark forest before i think you maybe start and you make one transaction and then they're like okay are you ready to like automate this thing and you say yes and then it goes away and then you have a burner wallet that's more like a session wallet that's signing transactions and then uh posting those on chain and it's like on a side chain it's on gnosis chain right now and that's another thing that we're like leaning into here is that l222 is happening right and that's why that's where games are really going to explode uh even even where we find like optimizations on top of those l2s it's still a bit expensive right if every game move still costs cost me a couple dollars that's still going to be hard to to swallow oh man i'm going to run out of power before i get through this talk if we could just get internet would be great okay so we're building games uh on top of l2 and uh the the natural extension of that for me as a developer relations like developer onboarder is let's build games for smart contract developers and that's what uh here here in amsterdam we're going to do a game tomorrow evening i'm working with the chain link crew with andre and the game is basically built for smart contract developers so we will deploy a smart contract here we go here we go we will deploy a smart contract that has a game map and you as the player will have to deploy another contract that talks to our contract and we have it built into the contract where we're checking uh check this out let me find the register function we are checking that tx origin does not equal message.sender so that one line helps us prove that you have a middleware contract we're not allowing you to interact with the contract directly we're saying you have to deploy your own contract that talks to our contract then we're going to set up a little game map there's going to be some gold and some health that we're going to drop you're going to move around we don't know exactly we're kind of building the game as we go but this is this is the game board so what i wanted to do uh with the time we have is build build a quick like interface and see if we could all like get on here and play it but i have no idea if the internet is going to let us do it but but let's try so so a scaffold eath this is a scaffold e branch here you you have this um interface with your contracts and when you deploy your contract uh let's see let me go try to deploy it so as you make changes to your contract your front end is going to auto adapt to those changes so i've added in let's just actually start with the stock contract and let me show that off first okay let me yarn deploy let's just go to localhost okay so i'm deploying a contract just to my local chain and then i'm going to set my app to be pointed at localhost just for a second and i just want to show this dev loop that happens with scaffolding so you deploy your contract and then your front end will auto adapt to it there we go okay so let's look at our contract real quick we've got a string purpose let me make sure i save this somewhere okay i've got it over there okay so we've got a what do we have we have some string purpose some like arbitrary string we're saving and then we have some function to like set that string right this could be anything else let me just like make a uint just to show this off you went 256 public counter right a classic classic first smart contract let's make a function called increment and we'll make it public and it'll counter plus plus right so uh in this case let's just pretend we're like a new developer we're figuring stuff out we're testing our assumptions we're trying things out we're going to get in this dev loop where i'm just making small changes in solidity i'm hitting deploy and then my front end if we have network is is auto adjusting there we go so now we have like this counter and i can like increment my counter oh we're gonna need money from the faucet okay so we just charged up our burner wallet and now we can increment our our counter let me show let me lean into that burner wallet thing real quick if i go to localhost 3001 i get the same app but you'll notice i've kind of got like blue guy right like i've got green guy up here and i've got blue guy up here they're kind of like two different characters and it's just two different browser sessions right it's a session wallet so and i can go to debug contracts and i can increment that from there too so this helps you to sort of like when you set up your require statements for only owner maybe this guy will be owner but then this guy would be like the attacker and you would see you would make sure that blue guy couldn't get in and set things but green guy could so it helps you kind of test your contracts test your assumptions poke your contracts and kind of get a feel for it okay so i'm going to trash that contract i'm going to go back to one that i've prepared that is talking to the game contract and just give a little preview of what the game's going to look like and we've already deployed the game contract to rinkaby so i'm going to go ahead and deploy this to rinkeby wait wait wait let's yarn compile let's at least make sure it compiles 22 battery let's see how we do okay please compile please compile so what i'm hoping to do is uh write a smart contract that interfaces with the game contract and then along with that deploy a front end and that's kind of the magic of scaffolding is you get a back end you get your smart contract but you also get a front end kind of built in with it and there we go it did compile okay let's deploy let's ship this thing to rinkaby please work i've already yarn generated if you view scaffold eth you do a yarn generate and it puts a mnemonic in the directory and then i funded it already while we were sitting up there just because the internet is pretty slow come on deploy okay so hopefully that deploys and then oh man come on internet come on you can do it you were were the previous talks tethered or how did they do internet like wi-fi is the wi-fi working i tried it and it didn't didn't like it let me let me let me try their wi-fi again let's try the wi-fi just in case yeah yeah okay so it would be this one right here right maybe it just didn't like us up there we were hanging out up there and it wasn't working yeah yeah oh man if i run out of power what am i going to do uh oh yeah did the internet connect no okay let me tether up again and deploy this thing sorry y'all we're good we're good it'll go it'll go and then also let me get this dog going is this is this us by the seat of our pants here okay i've got power uh let's try to deploy this contract to rinkaby again please work tethered to my phone deploying a contract to rinkaby on stage at amsterdam what could go wrong okay so let's see what what are going to be our next steps okay so let's look at this contract that we're deploying here so it has an interface to the game the game has this register function so your middleware contract you need to hit your middleware contract and then it will call register on the smart contract and the smart contract will look at the tx.origin and the message sender pair and it'll know okay it's your account talking to your middleware we're going to register your tx.
org is kind of your account and then like you'll move around in the world as that person so then you'll be able to issue move commands and tell it you know north south east west basically and you'll move around in the world and the mechanic that we came up with for this is we'll just drop gold and health throughout the world and you'll have to move over to them and collect them but there's a lot of like little secrets and and tricks that you'll come up with as you're as you're writing this and i think it's going to be like a two to three hour session tomorrow evening so you'll have lots of time to like code up that middleware contract and i don't want to give away too much here because i don't want you to like show up with the answer i'd rather you show up and hack on it and figure it out do we know where it's probably full like oh it's probably full okay and i'll be doing a similar game at the defcon thing with the dark forest guys oh what was it network timed out okay so so you're saying go forget the okay and forget the dev connect yeah so advanced okay and then oh no don't cancel cancer sorry uh and then no and then reconnect okay [Music] it's trying man it's all good i can tether through like the tethers yeah let's try that one yeah wester gas free wi-fi i probably have to like say that i'm like a guest at some hotel or something right let's check yeah no it just worked oh whoa let's see yarn deploy ring of bee let's go lfg gm lfg oh it went heck yeah okay okay so now we've got a contract out on rinkaby so you'll make one other change to your app you'll need to tell your front end that we're not talking to local hosts anymore we're talking to rinkavy whoa all caps when you spell man name here we go rinkeby okay now our app automatically switches over to rinkeby our contract is deployed it looks like it might be working okay so let's see let's go back over to the game board now we kind of have this is our player over here and this is the game board over here and while that's working i want to do a yarn build just to get out ahead of that okay so here is the game board now what happens when i call now i've got a burner wallet over here so you'll notice that i'm just going to hit register and no pop-ups none of that i just clicked it this works really good on localhost it's a little bit dangerous like on a public network like rinkaby where i'm just like i just clicked a button and it worked but i'm going to show why that's important okay so there's our little character down here right and if we wanted to we could make another one here i'm going to go ahead and register as austin griffith.eth also so i'm going to make a transaction through my meta mask directly to the contract with which i think it's allowing right now it's not forcing the middleware contract and i'm going to just show the difference between using a burner wallet and not unis using a burner wallet here okay so there we go i should have another carry there we go so there's me and if i want to move let's see can i even like drop some prizes yeah let's make it rain some prizes all right put some gold and some health in the world and we just randomly came up with this game like two days ago so like yeah we'll probably iterate on this there we go oh look at this so there's some gold just south of me so if i hit the down button it will make a transaction and i should move down one and uh hopefully could collect some gold here let's see man rinkaby 15 second block time so slow oh yeah all right so now we're on the gold yeah yeah let's collect it let's collect it okay so you notice each time i want to make any action i'm getting this pop-up it's having me confirm we're like waiting for the block to mine very very clunky game process let's do the same thing but as this character right here i'm going to try to go get that gold like pretty quickly let's see what i need is i need a [Music] yeah i need this right here so what do we want to do we want to go up one and then to the right a bunch right i'm just going to hit up right right right right look at all those transactions getting fired that's what's nice oh already known not already known there we go i'm just making a whole bunch of transactions and it should in a single block there we go so we made like a huge amount of movement there how that guy moved there that's kind of the the nice thing about having burner wallets or session wallets where you have transactions getting signed kind of quicker without all the prompts your main wallet would fund your burner wallet and then your burner wallet would make a lot of fast transactions look at that i got all the way to the gold now to get that gold i'm going to have to oh no our contract oh yeah no collect tokens it's that dude right there right let's see this works so you as a contract developer will be building this but instead of just clicking the buttons like hopefully you'll automate your contract and we're going to make it so as you move there's some attrition that happens based on the block hash so there's ways that you can watch the block hash and only make moves when it's more efficient there we go so we collected gold so this will be the game it's it's cool when i'm just clicking around but it's going to be a lot harder and more interesting when you're not allowed to do what i'm doing here where i can just click around and play the game you'll actually have to like get in and code up your contract and so like maybe one thing that we could do is we could write multiple steps into the contract right and i don't want to totally show let's see what's a good way to go oh here we go here we go this is what we're going to do it's about getting you guys to play okay so i'm going to do a yarn surge domain play demo dot surge i'm going to grab that and i'll jump over to yeah get your get your laptops ready get your phones ready we're going to play this i'm going to go to eth build real quick and get a qr code for you all all right it's text if you haven't used each build it's great for showing off things like key pairs and hashes and mnemonics you can even use it to build blockchain dashboards i need a qr display https all right so if i do everything right you should be able to hit this qr code and it should give you the app and you'll connect your wallet and you'll use rinkaby to register and technically you should show up let's let me make sure this works see if i get a play demo you could even do it on your phone if you have a mobile wallet or you could use the burner wallet and send some wrinkly into your your mobile wallet but if you go to what's that uh oh it's because it's not deployed yet here yeah yeah here we go the we're still invalid api key oh no no not that not that uh this right here it's going 41 uploaded oh boy come on west water gas what is it western gas let's go wester gas free wi-fi okay so i have to upload the site before that will work okay uh let's see other cool things okay so we're talking about game fire right as we get into uh composability and games and like i'm imagining what defy summer was like when all of those like d5 platforms and liquidity and pool 2 and all those cool things kind of happened within a few months my assumption is that's going to happen as l2's cool as l2s heat up and get more usage i think we're going to see that with games we're going to see i i don't really like the whole like play to earn or whatever i'm not a big fan of that but i think there's going to be markets and there's going to be kind of money at the at the protocol level for a whole bunch of games and it's going to be really interesting to see how that plays out uh the composability layer of nfts the fact that anyone can just deploy a dex like there's going to be so many really fun things that come out of being able to deploy quick and fast on l2s with the same security concerns 67 percent well here before my five minutes are out let's find out 69 nice here we go here we go so yeah eventually that's gonna come up and then you will get uh this page when you land okay you'll get this and it'll look like this so you'll go over here and you'll either send rinkaby to this address and use a burner wallet to register and move up and down or you can connect in your here let's let's connect in my wallet oh man what am i doing don't use the internet right now don't move don't touch anything but you can connect your meta mask there and put it on rinkeby and make moves with that also but the goal would be if we could get some more folks to show up on this map before uh my talk is over and we're at 87 percent 88 any questions i could like answer any questions about games or blockchain games or anything while we're letting for this load or burner wallets or scaffolding dark forest have you played dark forest yet do you like it awesome heck yeah okay our app just deployed okay let's go back to the qr code now now let's see if you go to play demo oh man here we go let's see if this opens now playdemo.search.sh and you connect your rinkeby wallet can i keep this qr code up and jump over to the map oh man sorry y'all because i want to be able to see the map too and see if anybody gets into the game there we go so we got two things here if you can scan in that qr code how many what do i have one minute left where are we at five well let's see let's see if we can get anybody in on this game my my internet's not loading but oh looks there's somebody or there's already one person in there who did it yeah my man good work let's see where where are you at you need to move south a whole bunch to get some here let me drop some more gold and stuff in here let me get something close oh actually the front end doesn't have collect gold or collect tokens you would have to do it from the debug but you could you would go to the debug contracts tab and call it but uh this this game will be played tomorrow and we're going to be doing a lot of other games like this so uh hit i'm at austin griffith on twitter if you follow me i'll just like be posting like crazy whenever we do one of these games but it's for smart contract developers so if you're already a smart contractor developer uh hit me up and pay attention because we'll be doing a bunch of games and it's just a good reason to kind of get together and build some cool stuff and and try try some new things uh and if you're not a smart contract developer but you are a developer or you know developers if you're a web 2 developer don't forget to speed run aetherium that will uh help you get your skills we got four players in the game now good job good job all right so players are in the game you should be able to move around a little bit let's see if i go to the right one i think i can collect some gold here uh that's that's basically what i wanted to show off this game will be you know hopefully a lot bigger and more complex tomorrow when we get a bunch of coders in playing around with it we'll probably be live hacking the game contract also so some there we go we got movement going on we got five players in here it's working it's working so how do you how did you guys walk how did you wallet connect in did you use wallet connect or metamask or metamask mobile on rinkeby oh he's got his laptop down there okay cool yeah i was like wow metamask mobile that worked for you that's pretty neat all right i think that's i think that's all i think we got five players on the screen i'm gonna take a screenshot this is a victory lap oh yeah good work all right cool sorry about the technical difficulties earlier thank you for having me speedrun ethereum uh look up uh look watch for these games we're gonna be playing a lot of like games for smart contract developers and speedrun ethereum thank you [Applause] [Music] you
Automatic transcript — names and jargon may be misspelled.