How to Build Your First NFT on StarkNet

ETH Vietnam 2022 · November 2022 · 21:02

Seabook Chen of Starkware leads a workshop on building a first NFT on StarkNet, the zero-knowledge rollup on Ethereum. Developers learn how to write and deploy an NFT contract on the network and what differs from building on Ethereum mainnet. Recorded at ETH Vietnam 2022.

Speakers

Topics

From ETH Vietnam 2022, hosted by ETH Vietnam.

Transcript

change it out there yeah my name is I'm the dev advocate in Stockbridge so today my talk is a bit different I saw a workshop supposed to be Hands-On get your hands dirty write some code it's going to be fun so actually my session on my talk involves some coding so it will be fun all right so uh let me give you guys a quick intro about stockware and stocklands stackware is actually the company in the stock world we have a we provide Layer Two Solutions under the stock where we have a layer 2 public

chain called stocknet we're using our Cairo language it's our invented language to build smart contracts so today I'm going to give you guys a taste of how you are development [Music] of Stockton all right so what will you learn today right after today's talk you will learn how to send a Dev environment how to use the postman collections to get some tokens and how do you use the wallet also I will explain what's the product starts and we write a bit of code hello on Cairo so you know what's Cairo about so how many deaths are here can you raise

your hand if you're a developer please erase your app also not too many but it's gonna be fun and then you can deploy your Smart Country on your local devnet and this interaction with your smart contract so what's a Dev dance it's actually a local starting environment I cannot do these live because the Wi-Fi is not good enough our test lab is not fast enough so we will use the local standard environment so it's a bit like ganache right if you're coming from the ethereum world you probably know the match for sure because

Now using every day makes your Dev experience more pleasant so how do we install after a lot of research I recommend you use the Nile abundance I will I will show you guys in a bit so another world by mode hello all right let's do this all right time [Applause] good enough so first we need to do is [Music] that's all the projects it is inside right so

um all right first like I said you have to uh open up your local test lab so you do not know you can see this World local government you can see they're already pretty prison accounts they're just in the public Keys they're the private Keys other stuff once this is open you can see okay you can have a postman collections to interact with your local testing it's big enough

should be a big enough right so first you check once it's live you can check this endpoint is live okay this means the testing is up and running right it's a lot thank you chapter three deployed accounts because there are lots of three deployed accounts as correspondents you here then you can check the like account balance what's the free token and check this is the fee token we use serum as a fee to take the fee and you can also bring some tokens I will show you guys later but if that's the postman

collections how do find this it goes to the postman budget and search stat line edu I'll come up with this we just clone the collections and you can play around okay let's go to next now I'm gonna introduce you one of the most popular World institutions or problems okay why we choose Bravos Bravos is a native important for the test I use the standard open zapping account contract standards I can't find you different than me Romans it's all sorts of things which is

crucial okay let's do this so how do you install the problems it's actually a Chrome extension search Chrome extension Rivals Bravos wanted this number but luckily I'm already installed after you install this you will see this little icon it's like I told you an icon or some Soldier right now obviously wanted I'm pretty sure you

guys can use water all the time you need to back up your C phrase so it will come up with this URL then we need to create a new account first and new account you guys can see this video it's gonna take a while so now to avoid to my local tester devnet you can see on the right top corner there's an icon it's a small but I'm sure you guys have a very good eyesight alright so how do I get some free ease then we go to the postman collections choose this meet endpoint put your wallet address in let's do one is first second all right

seems successful so we go back to wallet I have one thousand bucks [Music] foreign [Music] [Music]

[Music] foreign [Music] work it's very easy to customize to your different configurations and support profiles out of the box I will show you those profiles and it's quite fast it's under the hoods it's from python uh it also disappoints greatest sweets easy to use and sell out all this stuff so all you have to do is just install

and prepare a cheat sheet for you by the way I will share this channel you can just follow the steps to set up your local environment so that's how you install the product start once the product style is installed you can start to relate your project mysterious we're gonna open our new console and here that's a protocol star and that is all right now that's how you start a

project Rising let's have a look at the Cairo code so when you have this photo structure other parts there is a sauce folder and the source obviously is writing a smart contract right if it's a serum and probably a rice reality at the start now you have to write a write kind of that's the code also other boxes of course tests so let's do the chiropra lots of people complaining about wow a Cairo is so hard to learn we we have why do we have to learn a new language to do the stackness

stuff is Cairo is not too hard to learn after a session you can assess yourself the second question is why do we have to use Cairo because it's more efficient right a ZK is a so before you do the circuits right the people have to hand wow the circuits now our team invent Cairo so under the line this this while we compiled to the circuits which can be easily approved very easily and efficiently okay let's unlock this code that's a hello world Cairo so this is smart contract right so

based so basically the first line say okay I'm gonna write some stock net code statistic language that's just some important packages which is not that important okay we're gonna Define a storage file what's a storage bar storage bar is uh parameter or it's a field will be persisted on the blockchain right so this is actually well be persisted on a blockchain another statins it's about balance so we have two uh simple function when one is called increased balance for this you can smoke don't you don't worry too much about from here to your current events

it actually removed this next a lot easier to read this card has to be here because from some system check so yeah if you remove it then some much easier to read okay basically there's one parameter called the amount you need to you need to about right so you have the amount you can write your balance you read first so you write back into the balance all right that's increased another function called Gap balance obviously when you write it to the balance you want to retrieve the balance right doesn't get balance another very

important is Constructor okay so at the very beginning when the contract is deployed the balance the value of wealth is zero okay now let's do this in action right how do we deploy this into our standard first we need to configure the prolong start project so follow star project we use this homo configuration file are you from Memphis so this is the total uh

profile which basically saying okay our Gateway is 1550 and our chain ID is just like this I just copy this long integer so yeah I'm gonna once this is set up then we then we point this to our local adjustment but first we need to compile the code all those stuff oh sorry for those protons that's how you compile the color once it's been used if you go back to

here you can say okay there's a view folder right there's a beautiful the second step is we're gonna Define this to the local tester what we do is this [Music] the bunnies that's down that profile volume notches okay you can see now everything is working because the local test is super fast we have a control address by make sure you remember this concept what I normally doing is here I have a little like cheap sheets whatever it is that's

in the contract contract address right as a contra dress which is really important to remember so we are going to interact with this contract first we I want to retrieve the balance for this there's something here all right can you guys guess what's the balance now what's 100 everything working and the response is here why because if we go back to the

code we can see the Constructor sets the balance to zero right now I'm going to increase the balance to call this method to increase balance and we're going to call this amount of the office obviously we have to put the right smart contract addressing you have to have a contract address to initially this account just say obviously if you want to send a

transaction you have to have the PK private feedback I'm gonna give you guys a little bit of my project I'm pretty sure I want to do this very fast and no one can remember this all right this is my problem I want to show you guys [Music] all right you can see here of the inputs what's the inputs in coach just correspond to this amount so there's one parameter one I'm gonna point is right okay let's run

this okay it's working okay since everything else is working now let's retrieve the balance again used to be sorry used to be zero now it should be straight line if you guys follow me yeah the response is Right indeed but let's just give you a chiral call works but we talk about how you configure your

protostart automo which is really important it's a configuration and we talk about the build right how are you feeling you build your trance how you deploy smart contract how you interact with your smart contract there's a call right you basically retrieve a value involved basically uh you will send a transaction but when you do the invoke you need to have the private key value right all right further readings obviously this will be see the sheet the sheet is here is everything if you guys get interested in doing yourself in your local machine just follow this guide this is based on the Mac OS but if you use the Linux

should be fairly simple if you use the windows please come to me after the talk we have a Discord Channel thank you probably have a disco Channel called stagna uh just uh come to our standard Discord Channel we have Carolina land support we are starting to have bug report one job boards review jobs you can come here as well [Music] also um definitely follow us on Twitter that's

my personal tutor crypto leak uh if you want to team here you can or you can stay quick you guys take the picture [Music] that's me and the stackware stuff where is accomplished with it sure you follow stock all right this is the cheat sheet if you

want to if you want if you guys want to architecture you can count down to five so I'm gonna move to the next slides five four three two one our next slide is a comprehensive reading test there are so many resources where I cannot cover for the day but definitely goes to here I'll start but i o on the left there's a developers right if you have developers definitely check this out there's so many information here you guys can go

that's the QR code if you want to if you guys want to take a picture all right that's for everything I know this talk is uh a bit different to other talks other talks probably just give you fancy beautiful PPT slides this goes for some high level stuff so I thought this is a workshop we need to do some demo or some code it's going to be fun hopefully give you a little taste about Cairo about about connect if you want to be a developer definitely reach out um yeah thank you [Applause]

an amazing Workshop you know like we're step by step tutorial on how to deploy our style and everything was like easy to understand so devs and Builders here please take advantage of it and join the star and Discord for more help in the future okay