# Creative Constraints for Dapp Development by Ann Kilzer (Devcon5)

- Channel: [Devcon](https://streameth.org/devcon)
- Date: 2020-10-09
- Duration: 1:23:15
- Topics: blockchain, smart contracts, distributed ledger, ethereum
- Watch: https://streameth.org/watch/yt-J5G0REDc_Xw
- YouTube: https://www.youtube.com/watch?v=J5G0REDc_Xw

## Description

Can the challenges of blockchain development — gas limitations, storage scarcity, and decentralized computation — create conditions for creative DApp development? Are the parts of Solidity that often confound developers actually starting points for creative thinking?

20 minutes: Survey of Creative and Whimsical DApps

We will review games and whimsical DApps, from CryptoZombies and CryptoKitties, ERC721 collectables, to some of my personal projects, including a fruit-backed cryptocurrency, and a blockchain treasure hunt.

20 minutes: DApp Idea Generation

We will brainstorm how to make fun and whimsical DApps. The room will break into small teams and draw random cards as idea prompts. One set of cards will contain Solidity features, others will contain game types and themes.

80 minutes: Build-a-long

The next 80 minutes will be a hands-on DApp build-a-long of a Japanese-style treasure hunt known as a “Stamp Rally” in Solidity. (Sample code: https://github.com/ann-kilzer/blockchain-stamp-rally). Participants will build key parts of the app in Remix, and interact with a publicly hosted version of the UI. If participants want to continue learning and experimenting afterwards, there will be extensions in the repo. My goal is to show participants that blockchain development can be fun, creative, and approachable.

## Transcript

[Applause] thanks for attending my workshop my name is Dan yeah again a little bit about myself is I'm a software engineer and visual artist I'm from Montana in the United States sale of spies in Tokyo now and weeks up for engineering courage and this is a picture of me in the real Yap so and yeah perfect we ready to start up in Tokyo or 10 engineers now a couple part-time staff and we're going to be middle of where layer or aetherium we're trying to make walk to you easier to use so this is a workshop it's going to be about 90 minutes it's going to be a lot of different components to this workshop so I want to set some expectations first of all so I pitched this talk and is beginner-friendly and it's a mix level audience its DEFCON so I'm sure there's people in the audience that can probably code circles around me to Livity there might be people that are writing their first smart contract so if you're in the former category maybe you can help your neighbor out help them learn something or maybe you see a way of writing solidity that's different or or a unique and you can make a pull request against my open source code fork the repo you know get creative with it if I mentioned something that he worked on that where a project that you really like feel free to give some small golf bus I'm going to cover a lot of different creative projects in the crypto space and you know hopefully I think there's just a lot of really exciting stuff out there so let's get it next I want to talk about what I mean by creative constraints and there's a couple more seats at the premise will be a welcome so in university I studied fine art and I still study computer science math and my dirty secret is my art quests were harder but I continued to study free baking and painting in Japan and this is a woodblock print that I'm working on it so in printmaking might think about okay a one image here of this train and cherry blossoms and I have to think about the technical parts of separating it into different blocks and getting some colored layers so I was thinking a lot about the connection between art and science and how technical things can be very creative I think art has a lot of process encoding as a lot of creativity so that's one thing that I think about the other thing is that sometimes in art and technology we encounter a roadblock so here this man is running into the door it can't unlock the door and in sometimes if we take a step back we can see a new way forward I find solidity challenging but I also find it exciting and interesting and there is you know new ways of thinking that can be brought about when you encounter a challenge that have to be creative to get around it so in the second part of the talk I want to do a survey of games and creative projects in a theory [Music] so first of all it's ERC 20 tokens so this is probably one of the most common terms that we talked about it's a fungible token can anyone in ten words are fewer give me a definition that was fungible yeah they're always call the same it sounds pretty good any other combinations invincible I think that's a separate a separate one so basically one unit is exchangeable for another unit of the same thing they think and be interchangeable so in currency we can swap one for the other and traditionally in video games there's often Indian currencies but they're hosted on a particular server so in second life you have linden dollars but that's all centralized being a second life's databases so now currencies in games can actually live in their own world and it'll be traded in the open market so a couple examples would be decentralized product and the loom token in contrast we also have ERC 7:21 which are gone flexible and great for collectibles so they illustrate you for this picture I took is from a shop in Shibuya Tokyo called my maracas there's also a store in Osaka as these you know vinyl collectible figurines that are very popular in Japan and around the world and they're actually quite expensive maybe tens of thousands of yen hundred US dollars and they're all one-of-a-kind and so we're seeing something that long chains like let's make some one of the kind of it's so I have a lot of examples to share this one is super cute they love these little round rights they're actually infinity these are based off of axolotls the Japanese word please it's the poetry book but society but basically they're generated you know code and they have different features this one's for you turn up and a carriage another one here is a watermelon on its head and what they're useful for its assembling in small pond squadrons at fighting in battle so you basically collect these things and then the game is making the fight [Music] you can also breed them and so that would combine some of the code and mix them together so here a clover and baby and sort of this stage of it growing up into a weird little bird yeah another example of the are seats of 21 is more just of a collectible but there's this kind of fun experience when you get to create a new building so you take something easy to the smart contract and it generates a one-of-a-kind building you know it has different features like a different background the Eric laws there are different heights some of the members top pools I was lucky enough but those are meaningful curved okay T's is probably the most famous ERC 721 and this is let's see I mean there's a lot of delight in just what you might find so there's all these features of cats and as you know new cats are bred and generated you know you can discover interesting mutations that adds a lot of whimsy and delights these contract so you know it's kind of fun to see this cat with the jungle background and demon horns and flame fur and this other orange one that kind of looks like a seal so this you you know there's a ton of popularity and it's pretty fun crypto kaiju combines these real world by over big arenas using NFC and blockchain so there's some neat mashups of the fiscal world and the digital world and another example not a game but still really cool the Austrian Postal Service issued this crypto stamp that's both a collectible and because you can mail someone you cared about a really cool letter the other nice thing about ERC 721 is they can be just swapped at trade it into print marketplaces there's a couple more seats at the front so feel free to step inside so open C is a very popular marketplace that has a lot of crypto collectibles box web allows trading of item to item codex is interesting that they're actually taking things that are not on the blockchain like real world art and assets and trying to connect it to ERC 721 and there's plenty more that are not interesting but what's neat is it's not locked into in particular marketplace okay gonna step back into features of solidity that we might see in games so payable functions this is really integral how do you buy your card okay you send money you send your ease to a smart contract maybe you're playing a betting can you said you know ease to some betting pool time stamps are pretty interesting too FOMA 3d is just fascinating because it's based on the concept of fear of missing out so the basic rules are when the timer ends the last player to enter the game wins the pot that's cool and anyone could pay to join the pool and extend the game by two minutes the Green has described it as a psychological social experiment in Korean I did a fun project its timestamps when I was doing my consensus project so my co-workers created as one of our first demos a Diamondback decrypted currency and there's a lot of projects that are putting assets in you know backing things and I thought well what's valuable in Japan and you think that's valuable in Japan is free you go to any department store you might find a fancy muskmelon that's worth maybe $100 this is pretty normal in Japan there use this gift greeting on the site I think the most expensive ones went for to 27,000 usl is purchased a pair and they have nice stems and they have a little bow on it so I thought this would be really fun to make a cryptocurrency but the thing is fruit goes bad so what do you do that use the timestamp and when the fruit Roz we can't trade it anymore so we use the now keyword in solidity and you have to be a little careful with now solidity consensus is giving a a security best practices later this week and they also have a lot of sunlight but keep in mind that with the now keyword planner schemes sort of punch it a little bit and not get caught so just it's better to use whiter time spans with doing comparisons it's an open-source project it's not a real IC o---- it's a satire but I read the logo it's like the enduring logo it's split it's just some elements of broken and so here's a little bit of the code in the transfer function here we have this is expired helper function that basically compares the current time to now hash functions will you see hash functions in the workshop at the end the day we're building register reminder and hash functions we take a string or a bit of memory and run it through a function like ketchup that's the famous one in solidity and we you know get out some bytes summary transactions it's not just a particular theorem but I think it's really interesting and the actually infinity of folks did a really cool job with this so with Assyrian transactions you're paying gaps and you're also paying in time and in a game you know that delay there's people getting impatient one I don't want to wait 15 seconds for an action to happen so axiom Finiti has a lot of gameplay and that happens off chain and then you can summarize it by clicking the sync impending experience sign a transaction and send it and then you know then you're incentivized to do this to level up your little critter at certain levels they can breathe or you know grow and so it's a nice balance of putting things on the blockchain but not slowing down games play and keeping the incentives he's also possible to use summarization and side-chains so rather than just putting things on the server you could put it on a separate logic you could you know choose a blockchain that's more optimized for speed computation or scalability and I'm just going to name drop a couple put a couple people versus people that work in the space loom especially is really in the gaming space and they're all about side chains so they have a like a developer SDK that helps set up side chickens and I think actually actually infinity is working the flute now Omi's ago was one of the first developers in the plasma it Syrian side chain and then you know there's other companies to be more general side chain things like off chain labs is doing server privacy-preserving such an arbiter so this is concept of burning which would be maybe sending a token to the zero address and you know maybe even use that in the game we could say high stakes cryptic ad bedding and now we locked up our kitties forever and this hero XM it's also possible to layer and mash up smart contracts because contracts are public anyone can interact with them and that's just a really fascinating thing with blockchain so does anyone know who's maybe done crypto zombies tutorial does anyone know what Curtis hobbies eat yeah they eat crypto kitties I found one unit shaped like a pickle it's very funny and it's fun because while it can't actually destroy the crypto Kitty it doesn't hurt it it does take the information and use that in their game and it's a fantastic tutorial it taught me to live again so I had never committed Kittyhawks is pretty fun it's an ER c 721 on another ER c 721 it was a Google from plugin and although I think it's not in the Chrome story or unfortunately but you could have taken your crypto kt and given it you know a very dapper patter the moustache and if you're obsessed and then there's many verses which are just ecosystems that you know combine different blockchain technologies so just a central event is a big one where you get parcels of land and you could put some of your crypto collectibles in there and they're partnering with different companies different startups so they just had a really big game jam and this was one of the demos you know some of the video assets and things which are different they make it a little character yeah I definitely want to explore this someone okay so the first part it talked a lot about things in salinity in the second part I'm going to move a little bit talking about some of the challenges but with the caveat that challenges often bring us new ways of thinking and I you know opportunities for creative problem-solving so one of the challenges is that there's a lot of different tokens out there here's a couple that are just in the game space just that's just a handful you might have to use if you play some of these games and it's not always easy to get those tokens so I'll give you a case study for my personal life I am a US citizen residing in Japan and I wanted to get my token so I can play to central and and I have to complete the know your customer or kyc process so I go to an exchange in Japan and say I'd love to sign up it looks really cool and say well you're use this and maybe should do it in the United States so I you know the US side sign up to their website say well you don't have a u.s. mailing address where you're getting your bills paid we can't don't know if you are where are you so thanks I go to another exchange what they said it's very difficult for us to verify US citizens and our government doesn't make it easy so you know I'm Nuria so thankfully coinbase I can after a couple failures coinbase lucky its etherion celebrate partially the way there and then I turned my aetherium into wrapped etherium or wet this token makes the theorem behave more like the ERC 20 spec and so the next step is just get some rana okay so I go to the relay order book and I put in a buy order for a hundred mana and nobody saw maybe five days later somebody sells me and I go to decentralise and claim my out of turn game and because of rounding error I of 99.995 that's not enough mana okay back to the order but one mana please somebody couple days later somebody gets it I can register my datum so story has a happy ending but it's not the easiest onboarding process - okay when you have to wait like 10 days another challenge is setting price and this is really personal to creators there's always a balance to be making a profit on something and then buy it at lowering barriers to entry and that's no very personal thing but it's just there's a trade-off there the price also changes dating so gas fluctuating here's an example from sorry this is how small that goes from June of this year to mid-september you can see at towards the end of September that gas prices are quite a bit higher meanwhile the underlying currency is quite volatile as well so we just and here's an another example when I went to generate my block city little building in Atlanta notice I'm calling the same smart contract here at 0 2 for a same smart contract three days apart same cost in ethereal but the underlying cost in u.s. dollars is totally different so on the first day it's 8 dollars and 97 cents for the price and then the Gaspee is $3.75 three days later the transaction fee is $11 and 10 cents and the Gaspee is only a dollar twenty four so the overall transaction or contract fall is cheaper but it's interesting how these variables move get very independently there's also been a shift in just how games are played in terms of how to be charged for games when I was a girl you know you could get your you get your box your game and you get your Fordyce gets your mom would install it all day and then you play it over and over you play it as much as you want now games are they often have micro transactions it's no longer no longer a flat cost so yeah my calculator you know you've got to keep clicking on that cow and you you pay to turn that count with a beef later but it's no longer a flat price and then that you know some people like that in games some people don't it's just practice it can work well in cryptocurrency those who see pay in small chunks of our economy but people might you know print of ability to pay there's also a time delay I talked about this a little bit when we were talking about summary transactions and how actually infinity solved it so there's this you know wait for it waiting for transactions to be mined and I think the crypto phase team did a nice job of having some cute animations and building suspense I kind of have this ghost cat while you wait for your cat to load and that can be a little exciting like what am I going to get so it can give me an opportunity blockchain also is very at risk to security exploits fomo 3d and I mentioned before let's review the rule so when the timer ends the last player will win the Google and anyone could join the pool and extend the game by two minutes however this team at SEC bit wrote this really awesome article I highly recommend and they figured out how to exploit the whole aetherium network to win the game they basically sent some very high cost transactions that used up all the gas and ultimately failed but they were able to prevent anyone else from calling that smart contract in the next few blocks so reborn secre it's article if you're interested it's it's very interesting another consideration is you know how decentralized our games the etherium wasn't made to support - le potato like images or you know large objects that's not what strength is it's more about establishing trust and so some of these things it's like where do you put the artwork where do you put any cache data before you loaded it onto the blockchain sometimes things go sour despite the best intentions you know if a development falls apart or their servers go down how easy easy is it for another party to come and recreate the game one example you know I think the kitty hats project would be awesome but it's no longer available in the Chrome Web Store so it's very hard to play this game now that Google said I'm not sure circumstances but it's not really playable so this is not a game but this is an art project that does a really good job of putting a lot of the data on chain it's Auto black cliffs by a group called larvae labs and these are ERC 7:21 collectables and these patterns are generated through a smart contract and you know not too hard for someone to build the image or the image is not stored on the spar contract but the data is you could add a couple text characters and just use some code that you'd run to regenerate the image if you need another consideration is that in theory in this public so who's playing Dungeons and Dragons before I look like you it's a lot of Dungeons and Dragons you want to think about information lighting so we have this character community's got the game master screen screen and he's you know if you're a game master you're often hiding information for people that's slowly revealing it to build storage drive area maybe create some dramatic tension so you might want that in your game you know contract calls are public and people can read those people can go and read events and see the data in there even your ID is a pseudonym it's not truly anonymous so it just might consider that ok this next part we're going to do a little bit of a hands-on activity and first I'm going to explain the rules so yeah we'll use some of the ideas that we thought about solidity and we're going to take those and make our own games so in for our purposes we're going to think about three characteristics of games so we already talked a lot about see the features of solidity that might incorporate in games and I want to dive into the detail of what the other two categories are so this is we're going to do it a little bit of a card game it's going to be kind of like apples to apples or first against humanity okay so game categories what type of game are we playing I'm going to name a couple that might not be common knowledge just in case you draw the card so you know what it is so one category of game is called a god in and this is not in any specific religious sense this is more than Aaron Tom depression entity that can control a world so in some cities you have this sky view you know of this world that you can build things and you know decide how your citizens work and creating these things roller coaster tycoon me it's just focused on the theme park and building roller coasters one of my favorite games sitting up from 1991 since anyone played it so good but you're basically an ant a you manage an ant colony and you can become any and you can become the Queen could become a worker ant or a soldier and you're fighting for control of the back yard against rival ants and humans and Mars another category of game that you probably will see any nosaka is it not Japan this is a castle dispenser dispenses a toy it has a little bit of randomness because there's usually six different types of toys and there's even a big point when I saw you can patriot again to get a plastic Bitcoin see if you can find it this one has a negotiation saw and drill and then some some like Queen Yoshi Castle famous artists in Japan they're really fun and interesting but it's just a bit of grand on the Grand Tour sensor okay let's talk about theme or setting this type of card fever setting is critical to a game and a lot of story told without even any human presence so I think all my favorite games are from the early nineties my other this is probably my very favorite computer game but it's missed cinnamon play missed yeah there's little channel wood there's no people in it it's just this abandoned place it's miss and kind of dark and you can see that people may have lived up above and you're just curious about how do I get in there how do I fit into that world so even setting is very important we can draw inspiration from the world around us so Osaka has lots of fun neon and giant giant puffer fish of things to see there's the world of Japanese mythology you know Kuniyoshi prints and boys fighting fish and samurai writing totes it's pretty serve you okay so I'm going to go through a couple examples of how the games played so we're going to have different types of cards and there's different colors and their symbols on them too if the colors are icy green stars in the game category we're going to draw two of those and discard one blue cards have moved on them we're going to draw three and discard one so you have two cards left and salinity features are going to draw two and discard want II and so maybe you're gonna keep a hand like this and you decide to pick your favorite okay I'm gonna choose a racing game the features the theme is that it's post-apocalyptic and it's about ducks and I'm using the burning functions on setting things to the zero address so maybe I make a game called bat cracks to the pond warrior and you know it's someone hostile world or ducks have to fight for survival or get sent to zeroes another example here let's take a roleplay game and we take trains and Japanese mascots and we're using layering of smart contracts so perhaps I decide to use PRC 7:21 collectibles and layer them together to build a Japanese rail network featuring cute mascots and wonderful trains that try to entice people to come ride my railway okay so now we're going to play it first what we're going to do is break into groups of maybe four to five people and you can move your chairs a little bit as long as we move the chairs back at the end of the workshop and some of us will be around the handout of death [Music] [Music] they're young to go ahead [Music] the chair the discarded [Music] you say we go [Music] don't [Applause] [Music] right [Applause] nation [Music] protectors yeah [Music] vitality plastic managing another critic is talking facility workshop that's ofx place and this has been awesome the dates for making these great ideas some of the things I turned were like a yak princess betting arena and capybara racy where the losers character is burned so there's a really wonderful ideas that you can feel free to take your cards or play more later if you'd like and I'd like to move into the events up here with people to move into the next part of the exercise where we'll build a game in salinity together and maybe you can take some of those ideas yeah this one is really cool I mean we've done some sort of fairy tale with Kirsten first clothing objects and treasure tons of this is like TNT level so yeah we'll save this one because this game seems to happen so if that's alright with you let's go maybe flat or rock tops and move it to the next part [Music] Oh [Music] that arcing solidity for the first time around try to help you if you have questions together stavroula is a game with that often companies so when you're on tradition this is when you go to Shinto shrines and who these symbols is really beautiful stamps and only contains about 300 yards per page to get this written and well this stamp is actually not holding objects and something that should be stated not mix with this type of stamp this is thought to be one of the origins of this fire game so because I wanted to make my book workers laugh and do something fun I thought it would be really fun to build stamp rally on the blockchain we're in Sybil's thank you to address you and enter a passphrase or you know in a virtual world and for some language on coordinates you're a pyramid dress as your clearer idea many people if you collect all stamps you can win a prize so here's a little bit of what friend looks like step on stamp around age it's an open-source project on github and yeah you know there's a button read click to collect the stamp and the crepes pass phrase correctly it will load the picture so first let's make sure that we all have some material so does anyone not have to test that rinkeby testbed etherion doesn't go not know what that means like so and that's okay because we can go through it together if anyone doesn't have you'll need that a mask okay so yeah we'll go through this and for those of you have been doing this a long time you please mutation or maybe you can help out your gamers but you'll want to go to metamath CO and download let's see download this tool I'm on slide 81 by the way people are people able to access the slides yeah you up you holding each other creating public accepted tablets or things so much so yeah we want to install that about and that is 12 years and so we'll follow on our slide so again who doesn't have a betta basket sucks okay so yeah yeah yeah I had to be honest [Music] No [Music] but you can pull on on the slide which slide hawk so hopefully people yeah and make sure to use zeros not the letter O it will leave so that you can get the slide extra both be zero so let's set up so this is basically a tool that lets the scanner affricates hearing block table so we'll want to install it it's a bet amount that I owe and I'm on slide 8 so with your new meta mask you'll point yes let's get set up to create a wallet if you already have a seat trace then probably used it before but it's easiest it's just like yes let's get set up and there's a point to set a secret backer phrase and this is a really important step but for the purpose of getting through this workshop we're going to return to this later or you might use your account forever so it's important there's a link on this slide slide 83 but it's really important to use your backup phrase because in a centralized ecosystem you can call your bank I forgot my passport that doesn't exist I grabbed my password okay it should look like this [Music] okay so the next step would be to get a summary could be test network and Canaan would tell me what the difference was we will test that work in the main that is there's no value there's so many things yeah there's a lot of things whether it's different probably a little more things but one of the purposes is you know just gives us a way to try things about them before making our team life so that's a that really short versions that I'm sure there's a lot more depth there and use an option if you have a Twitter or Facebook account if you don't have one of those ask your neighbor to send you something we're going to go on the readme test now that's one of the best that's out there and so this is my carrot faucet that brings me that I Oh come around to help [Music] well my slides are also there public and that tutorial don't github - so sorry cut the Wi-Fi but it is possible to sort of follow along this material after so I'm going to we're seeing you know how you get freaking these has to eat their gear needs you to click in that box on the little box and make sure you're up to reconvene networking select that in the top and click on the account copy the address so slide eight seven pair shows gonna pop it up and then you look into Twitter or the base above them and you would make a post with your address and then you would click on the share button to share that copy the link to the tweet I don't have facebook so I don't waste it you to that option and you select hippie ether and choose how much ether you want and you know in a little while we'll get money to the blockchain I think three is probably but we want one sufficient don't need much but yeah if you already have some rapini you're good so any questions on this stuff so far all right okay next let's talk about remix so remix is an in-browser editor for solidity who sees remix before yeah so most people great it's changed a little bit the last few months there's a new UI so I'm going to review things just in case you haven't seen the latest and greatest but one of the big changes is because these features called modules on the sidebar so it's best when you get to the main page to click this environment button here and choose solidity and we'll load the Pilar and the deployment modules and the file editor so you have all the all the tools we need so if you haven't got we say it's remix dog theory org and I'm on slide 94 if you're following along with the death okay so you have to make something we're going to create a new file we're going to call it stamper le sol and actually in the file explorer that's the icon all the way over on the top and then you'll click the plus button to make a new file and you can give it the name sol is for solidity and let's get into the code so there's a August like 98 here's a link to a gist that has some of the code here let me just show you what that looks like [Music] there are some bits of code that you can copy and paste into your solidity and repair and let me make this a little bit bigger so that and copying it into and copied it into um I select the other with things still fighting the Internet so sorry this might be a demo my most interactive [Music] yeah [Music] yeah [Music] you don't have a Twitter um can you know if I guess I just yeah it's the time here we'll send you some of this [Music] [Applause] music salinity vs. live and we've got our staff le contract and it has a couple different variables that are set in the constructor so we'll have the number of stamps in the game it's how might you know spots there are to collect so we're not going to do 30 for us there's a return address that owns it and can control it and change the pictures there's a struct that we use that stores the hash passphrase so the secret code that they need to enter and we put it 0 1 wave function so that it's fast what is it and then we'll have a URL that moves the image or stamp and the prompt that might give us a little hint - 1 x - 1 and then we have an array that's eternal of all these communities so we emphasize that all the consciousness story so the first up we'll be doing is riding instructor and that's form is a copy it in from the gist but it's a good exercise and actually making sure that your remix and Pilar works so if you go to the gist back here and sorry [Music] you get a full screen that's good [Music] and we go to section 1 of the dish for the constructor to do and we'll copy that in copy that into remix paste hundred into do here we can see that X instructor is taking some parameters unsigned integer like 8 8 bits of a number of stamps and a name and it's a public function so what we do is we assign some of these variables and the caller becomes the owner of the contract [Music] [Music] okay so in remix if we click the second icon which is sort of a solidity out condoms like these to share rooms will want to make sure that Auto compile is selected and this was really important because when you make changes to the code it will keep compiling it so this is a nice code to use after we've selected Auto compile amongst like 100 by the way then we'll move towards the third icon from the top which is the in theory Lobos little arrow when we go to the side and just lets us deploy and run transactions so we'll click on our stamp rally which should be compiled and then you can click on the little drop down arrow right here on deploy and then we can enter some routers so maybe we say we want three stamps we're going to call it steam locomotive brother [Music] and then once you complete it you should see this gray bar here you can do the drop down we should be able to see the name the number of stamps and our address of the owner so if you want to be able to get there catching up okay [Music] [Music] want to paste in the constructor so you give back a few slides it seems like people are still just a photo base with let's go back to just pasting in the temporarily so copy it for the dish and paste it into solidity and then make sure and I've pasted in the constructor problem here I've taken that and paste it in where it says to do one actress director and this is sort of just the hello world of getting my uncle Carlos checked run here and then I'll click the boy and I'll see it down below and I can verify oh I just give it any parameters so yeah let me give it [Music] so I have to quit oh yeah cool so we have people getting the constructor instructor is not [Music] yeah great and then actually like the drop down thanks to the point and fill in some little fields here and you can click transact - here to play contract remarried to play fetch the little arrow on the left and then yeah nice yeah it works deploy you [Music] [Music] yes nice great thanks Rebecca challenges thanks we've got about 10 minutes or so is it where to oh really okay the only thing about go we have some time okay good doesn't like to do okay Lera okay so yeah any questions on that so far okay I'm gonna move apart and we're going to talk about function modifiers so here's an example of a function line of the fire it's pretty common one and basically function modifiers are syntactic sugar that let's check some preconditions on the function or change the way the function behaves so this one is called on the owner and it means that only the owner can call up to our contract or that method basically here they were going to have a require statement and look at message sender messages on sender's a special reserved word or reserved sequence and solidity that means this is the address that's calling the contract and we can check it against the owner that we've registered in the constructor and make sure that you know who's changing the stamps we only began a manager we don't want Outsiders messing with their game and then it's really important that modifiers have this underscore and a semicolon because that's that means the rest of the code in the function body will be run so it's actually the point but the only owner is equivalent to writing code where there's a require statement at the beginning these are two ways of I guess yeah two ways of doing the same thing so it's your turn now we want to write a bonfire and we call the valid position it's going to take a unit page of underscore position and we want to check that the position in the stamp is greater than or equal to zero and less than the number of total stamps in the game so you can copy the template or just type it from the gist from the function modify start copy this here and I would recommend looking at only owner as a reference so we'll paste that in under to do it too and you know you might get a little red pop up that your compilers angry and I'll let you figure out how to make it happy again so yeah let's I'll give you about five minutes to work on that feel free to work together if you're having trouble with your internet and I'll come around [Music] every story needs to be actionable sometimes you Toria [Music] but ours Oracle's rising what does I think it just sends it zero yeah yeah huh both down [Music] there's a lot of okay so then from the gist of you copy and that functional on my part [Music] you just adjust coffee from [Music] peace the link for you to generate arbitrary no it's a link to it I'll just yeah there was never a way to stick in your copy buffer footing [Music] there okay yeah we copy this part the constructor you've already got and we'll go to the function modifiers let's copy this section okay before the end of it make sure you inside the race yep all right does anyone want to share their answer people get people get close creating a function modifier okay yeah I need the underscore this one because that's the placeholder that's all the function where are the rest of us after just a coffee 132 cool does anyone want to share their answer yes Maya just like require expression position greater than equal to zero position less time yeah yeah so it's totally fine compared to zero it's also equivalent that onions cannot be negative so it can be like this but both are valid solutions so feel free to copy this in and then we got this part okay next we're going to talk a little bit about storage of memory so in solidity and we've seen just talked about on tight ends certain simple types with more complex types such as stranger structs need to be stored differently and we need to tell the compiler a little guideline about how we store things so storage and is a key word that can be use for things that are persistent and this is great but it's more expensive to store the blockchain because you're making this data feed point into this permanent record and hosted on other people's computers so very important for state variables anything's boggles the contract state memories for things that are not persistent there's local computations or temporary variables if you're moving the data around so here's an example where we are storing stamp key and we can use the storage keyword the permit variable and a sign that stamp key to a permanent variable on the larger verses in memory where we have temporary variable and it's just that keyword it's all that you need so we go to code store the players cards on the blockchain it'll copy some of this here from the gist we've got the Raleigh card which is a struct with the number we're in a store on the first again and we have something that links to a rally card and this lookup table between the player yeah it might be easiest to just kind of copy the code from the gist we're gonna have this function here that kind of dealt with some of the code on the other slide and actually I'm sorry this is an example I wanted to show the user having a stamp and because this is just a check of data that's already on the blockchain when we were treating the user card we can use the memory keyword because we don't need to store it again we're just looking it up and returning for that data to the user we return the boolean value of whether or not take medicine and so a memory example would be the users hazardous down and we're trying to get the stamp image if they have the stamp then we're going to also using losing memory here returning it or it's just making a temporary copy in a center function though we'll needs a persistent things so yeah let's see this one will copy and I'll let you fill in the blank on this code how do we assign the staff key even a question marks here to be a storage 30 videos memory and so yeah your exercise will be right to Saturday so let me go to the gist here and we'll copy this section 3 here code to store players parts a bit of code here but we'll copy it into remix and they'll see that's to write B and there's a hint that the first line the look of this form so I'll give you a couple minutes to work on that [Music] [Music] I was a little coffee [Music] [Music] so that's the she gets one matches are this is [Music] check so I think that's I see the creation is not animation [Music] music machinist [Music] [Music] does anyone have the answer or it's closed remember your story Jewish storage why right because we want to persist that these are going to expand so we'll use storage and then give you an assignment here where we assign to be the parameter variables to the local storage object here ok so the last I think we have maybe 10 minutes left and I want to make sure that we actually get to play the game at this time so let me skip ahead a little bit I'm going to just jump into and yeah if you like this or want to keep playing with it it's on github you can make a pull request you can follow along you know it's a work in progress a little bit about web 3 so this is one of the libraries available for connecting connecting to the Nerium blockchain so we'll put some JavaScript and some fun pictures on the front of your smart contract and so we'll be using metamath to side transactions so if you could go to and - pills or github data i/o slash watching that stamp rally I'm on slide 125 and it's linked then we can actually see it in action here it is again so people will load that up and have your mana mask while it's ready look like this so you might need to make sure that it's connected and click on meta mask and make sure that you might give a pop-up about connecting and please allow it and then you let me choose in the browser actually [Music] and then respect the stamps the password is octopus all lowercase and then you click Submit she's gonna pop up to sign the transaction click confirm and yeah make sure you want repeat and you'll have to wait a moment and it should lower this down it takes a little while if you mind just clothing here on a pool you've got the public excitement possible yeah this is kind of we get right in the watching yeah Oh Ruffman here I was I Oh actually if you go to this page and look here probably access [Music] okay the octopus on our case mistakes [Music] that was just a joke people are interested like the unemployed on strategies in the slides actually because leads to it on either scan if you want to it's a coincidence yeah oh you can't actually see that people are calling the contract and we've got momentum scams and stamp collecting okay a couple you know that past branches make sure mom's bus all our case - the password here we can't run or something try to give up try to get them on [Music] a home [Music] and you can make your own and make your own artwork if you want to share it it's on github yeah does anyone have any trouble getting the stamps to submit to each other okay it usually takes about a minute but yet tried to bother melet I think with the voice but although okay I don't know today that's okay the time I mean I guess I'd like to just say in general that block team has a lot of you know we talked about creative constraints we did in the age of activity we did a exercise of building some things in solidity and so we covered a lot of ground and sort of unifying theme is that I think there's a lot of potential for creativity here even though these tools are very new and novel and sometimes always changing and so I hope you enjoyed it and I yeah if you have any questions email me and curved great calm or you know ask questions now thanks for attending [Applause]
