How to create an NFT collection - Masterclass

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today we're going to be creating an nft collection from start to finish looking at the artwork generation the contract as well as a mintingdap it's going to be the ultimate guide of creating an updated nft collection v2 because i've made this before but this video is quite different [Music] hey how's it going guys my name is daniel aka hashtag and in today's video like i said we're going to be looking at how to create an nft collection from start to finish it's very important to know that we're going to be using a low gas contract for this it's going to be super efficient and we're going to be starting off with the artwork creation this video is coming out right before our master classes which are going to be live the 8th to the 10th of march and that's next week or maybe it's in a few days depending on when this video comes out but go and participate all you need is a sketchy a book club nft and you can get them off open c i'll leave a link right below and then you can participate live with me asking questions but that being said i want to create this video so that we're going to create everything we will be doing in the master class but with the added benefit of in the master class doing stuff a bit different this will show you everything that's involved in creating an nft collection so that you as an artist a developer or anyone really interested in nfts gets the chance to have your own collection let's jump right in and see how we can start off creating the artworks we are starting off with the artworks now generative nft collections usually consist of a bunch of different attributes in single files bundled up together to create new types of artworks what do i mean by attributes well on photoshop over here on my layers section you can see i've got different color backgrounds simultaneously i've got background props such as these aliens then a light as well as a none attribute which is empty then we get to the fir and the fur is basically the base of our character we get a skin so as i add the skin you can see it all starts building up you have to think about this process beforehand before you start building out your collection separate your layers into the different elements that can change for instance the mouth the eyes and so on the program that we're going to use are going to use these different layers and then generate new images for us so step number one would be to create all of your different attributes such as a few different variants of backgrounds then a few different variants of whatever attributes you want to place on think of the layer order making sure that you arrange them properly it doesn't help that you have some kind of background attribute such as this light and then put the fur below it i mean it looks quite cool but if this is not the desired effect this won't work the same can be said for the skin if we place that below the fur as well you simply won't see it so keep the order in mind it's not so much important in photoshop or the image manipulation tool but when we get to the program this is very crucial design everything and we should end up with something looking like this how cool is that now the program will be able to generate thousands of these images along with metadata if you don't understand the concept of metadata don't be scared basically it's extra information about the image it shows things like the description the name and where that image is located on a different server this is pretty cool and the program will generate something like this for each image automatically so it's not something you need to worry about just know that this is going to be generated with our nft collection it is crucial extra information for marketplaces to make use of marketplaces can read the extra data on our image and display things like the properties as well as the name that this image has this is very cool and it usually comes in the form of json now let's jump back into the creation of the art jumping back to the artworks i'm ready to export everything i've selected all the layers and made the ones visible that i'm going to export one by one now here's a neat trick you can go to file then go to export on photoshop and select layers to files once you've done this select a location i'm going to save it on my desktop under a new folder called raw in here i'm going to click on open no prefix for the name and very crucial you need to keep the layers not trimmed so make sure trim layers is deselected we need these cubistic kind of images to be the exact same size even if the eyes look small it is crucial because these layers will just simply overlap in the program click on run and have photoshop export each layer individually here is my raw folder now and inside i can see all the attributes that we have this is pretty cool so now everything is in one folder it is my job to go and organize these into the respective folders that they fall into so let's go and organize after going through the files one by one i came up with this structure i made a folder called master class and in there have another folder called layers all lower case then inside layers i can open it up we've got the background background props eyes fur mouth and skin so i took the images and placed them all in their respective folders all the background props or the eyes and all of the furs in a folder of their own so at this point you should have something looking like this with all the respective items in their respective folder these are going to be our traits the namings are very important and will show up in the metadata so keep in mind that for the background this will be the title and then whatever background was selected this will be the traits title so keep them like that now it's time for us to go ahead and install our program that we are going to use and generate our images we are going to need a few prerequisites and one of them is an ide so i prefer this code editor visual studio code and go ahead to this link up here to download it for your operating system after that make sure that you have node.js installed on your operating system too you can go to this link up here but i found that works best is not the latest version go ahead and go down to previous releases once you are here you can see all the node versions because of the canvas api what i've realized is that a previous version and the specific version is node 14.18.2 works the best so go to downloads and then go and download it here for your operating system and for the right architecture now it's time to get down to business and download the hashtags art engine you can go to github.com forward slash hashlips and search for this repo i'm going to click on it and you can also go directly to this url over there but then important is keep your eye on the release i'm going to focus on downloading the release version 1.1.2 i'm going to click on releases over here and then once i get to this page i can simply click and download the zip source code unzip this and place it inside of the folder that we just created we are now back at the master class folder and then here is our zip i'm going to double click on this to unzip it and then i can remove the zip file this is the art engine and you don't have to worry about all the things happening inside here we're going to open this folder not here but instead we're going to use visual studio code once you've opened the ide visual studio code you can either click on open over there or go file open i'm going to click on open then go to the folder master class select hashtabs art engine and then open it should look like this and you should have all the folders and files of the art engine on the left hand side this means that you are now in the root directory and we need to be in the root in order to run the program's executable scripts the first thing we need to do is test that we have done everything correctly up until this point so go to the top tabs where it says terminal click terminal and new terminal this will bring up the terminal screen like this and now we're going to validate if we have node installed correctly so in the terminal run the command node space dash v when you click on enter it should tell you the version of node that you have installed at this point if you do not see the node version 14.18.2 you have done something wrong so please go and install nodejs again if you are more experienced developer you can go ahead and play around with different node versions but make sure that you see this version the next thing is to install the dependencies and we can run the command npm install and then hit enter this will install the canvas dependencies that we'll need to generate the artworks give it some time to do its thing and then once it's done we can start generating artworks it looks like our dependencies have installed you should see a screen like this depending on your node version it might look different but if something completely went wrong we will find out in the next step so after this you're going to run this npm run generate and hit enter if you see this where it says node index.js and it created five nfts all their images and metadata then it means it worked the program is ready and we can start generating your artworks you will also see a new build folder up here on the left hand corner in here are the actual images that just got generated from the base project as well as a json folder with the respective json metadata in it so i'm just going to collapse the build folder but if this didn't work for you and you got an error over here usually if you are using a mac with an m1 chip running the arm architecture this could create a problem there have been many who struggled with this and coincidentally i am running an m1 chip but i got it to work and there is a workaround it is just very extensive and i will make an updated video on how you can get this to run on the m1 if you want to try it yourself you can go to this article which is an issue that was raised and here a community member actually brought out a solution which you can try i'm not going to discuss it here but still don't get discouraged if you are using a mac with an m1 try it first out and see if it works for you but i can say to make it work you need to run rosetta in your terminal and just make sure that you're running on a lower note version like explained in that article the reason why i don't want you to be discouraged is because after this whole process i'm going to show the mac users or anyone else who just wants to use and generate images from photoshop directly a different way that you can do that too and that definitely works for everyone if you are not using a m1 chip on a mac and you got an error at this point please just follow the previous steps and you should be good let's carry on and now import the rest of our folders so that we can generate the new artworks if you're really stuck at this point and you don't know what to do go to the hashtag online website and join the discord you can click there and join the discord there's over 21 000 members and i'm sure everyone in there has experienced what you have and can help you out people have been known to come up with nice solutions over there and i urge you to join the discord channel anyway and become a part of the hashups family we always learn and innovate and it will be exciting to have you there as well let's now look at the program briefly the only folders that you need to worry about are the layers folder as well as the source in the source file the src you can open it up and it has a config.js file this is the configuration the brain that you kind of go and manipulate kind of to generate your collections we can choose between solana and ethereum or polygon metadata i will get to this in a second the other folder like i mentioned are the layers coincidentally we already have this layers folder that we've set up in the beginning of this video i want you to pay attention to this config.js file the one that we've just opened if you scroll down you see a section where there's layers configuration these layer configurations tie directly with exactly the same spelling i have to add in the layers folder over here we've got a background an eyeball and so on we're going to replace the folder structure over here as well as the entire layer folder so let's go ahead and do that change you can make this change in visual studio code or i'm going to do it in the folder structure over here if we open the art engine we can see there's the layers folder i'm going to close this and then drag my layers in there replacing all the contents inside of the hashtags art engine if i now go back to visual studio code we should see our new layers over there remember the eyes defer the mouth and the skin well here they are now it's up to me to go ahead and create the respective folders over here as well i can remove these and just start off by the background this is already there for us but this is a lowercase background and it has to be the exact same spelling the next attribute is i'm going to copy and paste it in there keeping the commas at the end and now just adding the second one in this case the order is very important so first it needs to be the background then the prop then next should be the fir so i'm going to copy this paste it over there and then replace it with the fur currently we've got the background background prop and fur popping up we technically now need the skin to come in so let's go and add the skin and then next we will need the eyes so the eyes and lastly the mouth once you save this i press command s but you can also say file save we can go down to the bottom over here and then simply run the command again in the terminal you do not need to reinstall node you can only run npm run generate so you can either run it like this click and then it should start generating our new collection or in a terminal you can always click on the up arrow and it will run the previous command or place the previous command in there that you've run so we can just press up and then enter again you can see that we are generating 5 nfts and that's because the grow edition size is set to 5. i'm gonna create a collection of 20 so i'm going to change the growth edition size to 20. save the file and in the terminal i'm going to press up arrow or type that in and then press enter now it's going to generate 20 nfts basically it's not any of these yet it's just images with metadata but you get what i'm saying in the builds folder over here at the top we can now open the images and there are our brand new generated images how beautiful you will notice that in the json file if we click on json1 and image one you will see that the attributes follow along so what i mean by that is if we click on the metadata json for image one you can see that we've got a teal background a back light the fur artist canvas and diamond skin and indeed this is a teal background with the light and a diamond skin this reflects what the image holds and like i said the open sea or marketplaces for that matter will be able to read this there's a few attributes that i would like to change like the name of my collection as well as the description we can go back to the config.js file over there and here at the top it says your collection so i'm going to change this to the maybe cool ape and then obviously you can change this too so i'm just going to say this too i don't know um perfect so we're going to change cool ape and this 2 and going to save it and run so up arrow on the terminal make sure i've saved the config.js file click enter and now we can see it being generated if we click on a json file we can see we have a new name as well as a new description currently we are generating nfts and that's pretty cool we get the images and the metadata but what if i want to make certain attributes more re for instance what if i feel like this ultimate script background should be the rarest of the three backgrounds this is where rarity traits come in and it's basically just a weight how weights work is at the end of your file's name for instance the steel background we're going to add a weight keep in mind by default the weight is always one so if you start adding weights you need to start adding them to this folder and weights are associated per folder basis so each folder has their own weight group so let's say we want to make the ultimate script the most rare we are going to give this a weight maybe of hashtag 2. then the rest for the teal background i'm going to add a hashtag maybe 20. and for the yellow the sunny yellow that's maybe the most common so i'm gonna add hashtag a hundred i'm gonna click and we don't have to save but what i'm going to do is just go and regenerate the collection now if this is correct the bold folder should have a lot of yellow backgrounds and only sometimes a bit of teal and then on a very rare occasion and i'm not even sure if this is going to show up in this small collection we'll have a ultimate script oh and there it is what a perfect example so only once out of the 20 the script showed up the teal background showed up a bit more but the yellow is overpowering and that is how the rarity weights work you can set these like i said on each of these folders if you like to keep in mind the base rarity trait to the rarity weight is one so there we have it our collection is now generated the only thing left to do is basically to upload this now to ipfs a decentralized storage network i'm going to show you how to do that keeping in mind i did mention that i'm going to show you how to do this exact same generation process but i'll do that after ipfs because that process has its own ipfs way as well we are not completely done in the sense that the json files if you look at the image over here it says ipfs and then new uri to replace we need to replace this but in order to get this uri or the c id as it's known is we first need to upload the image set so i'm going to i'm going to go ahead and do that and then once we've done this we need to run a simple command once we've done that our collection should be on ipfs and then we can get to the contract part before we continue i would like to mention that this is just the tip of the iceberg of generating artworks with the hashups art engine there's a lot more that you can do generating different types of metadata doing configurations mixing up configurations generating gifs text and even pixelating artworks just to name a few this is a growing product and we are in the process of redeveloping it but for now just know that my youtube channel is filled with examples tips and tricks where you can learn more on the different nuances that you can try with this art engine for now i'm focused on showing you the process of what you're going to go through when you are generating your collection so now that we have our image set with the json we are technically ready to rock and to go and our next step is ipfs if you really want to know how to do different generative things and it's not explained in my videos join the master class next week i will be happy to show you and answer all those questions then let's get to ipfs as you can see i've already downloaded the simple application that they provide ipfs is a decentralized network of storage you can store stuff in a decentralized fashion unlike centralized services so we're going to click on install over there and click on ipfs desktop we're simply going to use the desktop application to upload our content because we can upload bigger files and more files at once and then we're going to use pinata which is another service i will show you but our first step is to download this i'm going to click and download this for mac os so going down this is the release page and if i click there if you scroll down a bit more here you can see the different architecture downloads i just downloaded the dmg and i'm going to go ahead and install this right now while we wait for the ipfs application to install go ahead and go to pinata.cloud and sign up for a free subscription they also have payable plans but this is only if you upload larger amounts of data pinata is a pinning service which means that you don't need to run a decentralized node to store your data i am simply using the ipfs desktop application node for a temporary use so that i can upload larger and more files at once once you've signed up you can get to the dashboard like this and like i've mentioned you can do everything we're about to do straight from the browser by clicking on upload and uploading the folder but we are instead going to upload a cid directly a cid is an identity of the data and where it lives and the reason for that is so that you can in the future upload more files at once so i'll rather show you the correct way of doing it or how i am doing it at least just by the way you can see that i've got data already stored on my service now each data set comes with ac id and this will change if the underlying data changes so the cid never changes unless the data changes so these c ids are quite important and i'll get to them in just a second but for now understand that this is like an id to where that piece of data lives and what it's constructed of when you open ipfs it's going to look like this after the installation so now go ahead and go to the files tab and in here we're going to import the images folder it's important that we only import the images folder at this point so go ahead and click on import select a folder and then search for that folder that we've just created so inside the art engine in the bold folder here are the images so go ahead and click on upload the reason why we only would like the images to be here is so that we can actually use the cid and pin it or basically just point it to the json files i'll show you now what i mean technically behind the scenes what's happening is we are busy hosting the data live on ipfs but we are also hosting other people's uh files and it's running through this program as you can see on the status we've got incoming and outgoing traffic so that's the reason why i use a pinata so that i don't have to constantly keep this up and running you know at least for the time period before it gets replicated before we pin it to pinata what we need to make sure is click on these three dots and make sure that if we click on inspect that the amount of links is the correct size of your nft collection so we've got 20 images and i can see indeed we've got 20 links and it's linked up all fine now i can go back to the files go to the three dots click on copy cid and head to pinata over here like i said we can actually upload the folder if it's a small collection directly or we can now import it through a cid itself so to import the cid from the rpfs application we can click on cid and then paste it over there the one that we've just copied then give it a name gonna call it uh cool apes like that maybe cool apes a a because i just created a similar thing remember to call it maybe something that it is so i'm going to call these the images and then say search and pin once i've done this i can now go and refresh the page and we should see it's being queued now the queue should update and here we go it is pre-checking the images there we go and it's now starting to upload and that's how easy it is once this is done it should say searching and retrieving and then once it's done with its process we should see a link uh here at the very top the other way of doing this exact same thing is by clicking on upload folder select folder and you can now go and select it uh how we did with the other one as well images and upload i'm going to say yes and this might seem like an easier process and yes it does work fine for smaller collections so i can show you this maybe i'll call this the very cool apes and images and then say upload this will do the exact same process that we do throughout the ipfs but just keep in mind this will work because it's a very small collection bigger collections tend to fail because there's a lot of images so now it says it's successful you can see the very cool apes images are already here if we refresh and see how long our pinning is taking it's taking what longer because it needs to search for it but it's done over there and the reason why it is um not showing up is because it recognizes that it's the exact same data so it won't replicate you know the same data in here so that's why i'll upload on the folder you know won the race basically but you can decide which way you want to do either wait for the pinning to happen if you have many files or upload them directly the end goal is just to get the images over here with a cid of itself so like i mentioned before the cid is the dna the kind of id of that data and we can find it with this id so if we go and we click on this eye icon this week can open a page like this and you can see it's using a gateway by the way you can find this particular piece of data through any gateway it doesn't have to be through pinata now because it's being pinned however it's pointing to this folder over here so if i just refresh and try and retrieve the data i might not get to the main folder now but if i type in forward slash here at the end and i click let's say two dot png we should be able to pull in the number two image that we've created or the number two image of our collection and there it is we can simultaneously do this for each one of our images so this will be the how can i say the location of where our image lives on the decentralized storage and this is everything from here up until this point everything behind here is simply a gateway and can change but will retrieve the exact same data i hope that makes sense well the next thing we need to do is actually copy the cid and replace it inside of our metadata so let's go to pinata let's make sure we copy the correct cid once we've done that let's go back to our program the goal now is to go ahead to change this json metadata that's been generated we don't want to at this point create a new collection because we already have the data uploaded we simply want to replace this ipfx this part over there and how can we do that well if we go to the config.js file you can see there's the base uri we need to replace this part over here with lcid it still needs to have the ipface and look exactly like this apart from this should be your images cid once you have done this save the file and down in the terminal run the following command the command i would like to run is npm run and then update underscore info when i do that and click enter you will see that it updated the description as well as the name and this ipfs link this didn't regenerate the collection but simply updated the json files to point to this because remember marketplaces are going to read this metadata file and then look for the images in an ipfs link like so thus uncovering and discovering your image so each one of these files have been updated to have the correct cid at this point now we can go ahead and upload our metadata to ipfs in the json file of your collection basically there's this underscore metadata.json file go and delete this file because we don't need this basically that file consists of all the metadata and is not necessary and might break things if we do some executions on it with the dap so just delete that and then let's go ahead and see how we can upload this so the two ways like i've showed you before is you can use the ipfs desktop application upload it here first if there's a lot of files and then link it with a cid to pinata or what i'm going to do is simply upload it directly seeing that this file is not really that big i'm going to go and search for it so hash looks art engine and there's the json folder click on upload say yes and let's give it a name i tend to use a convention of calling it the same name so very cool apes and then underscore meta data like so now that we have this i'm going to say upload wait a bit and then we should have our content on the decentralized network this is very exciting and there we go we have our metadata and our images you can see that the metadata also has its own cid this is important because this is the cid we will put into the contract when we deploy it so just so you fully understand what will happen in the back our images are now living on ipfas and we have all of the metadata the metadata simply is there to provide extra information about the images and as well as a location to where they live that's why this was a two-step process if we go ahead and view the metadata right now this will load up the link and then we will get to go to any one of our images metadata let's give this a second to load up and there we go it's pointing to it here and you can see the whole folder essentially the contract will take in this folder and display and give us something back for instance it might search for the fifth nfte metadata so it will return to us number five and then dot json i'm gonna go ahead and just click on this to show you the metadata this is now the json file so this is what the marketplaces query from the contract they get back this and then they can display how they need to on the screen that nft it can display the name the description where the image is living and you notice that there's no gateway in front of this this is usually done so that marketplaces can put their own gateway for instance you can see here we're using um the gateway of pinata but if i had to copy everything from here to there and let's use ipfs directly so what we can do is just go to ipfs.io forward slash ipfx and replace this we should see that we get the exact same cool ape number five so here you can see it works with two different gateways and that is basically because ipfs doesn't live on the gateway the gateway is just there to basically serve the data and this is kind of it now if you want to see the image we can just copy everything from here to there and let's go and replace this at the top and click on enter and there's the image and that is why you will need to have metadata and images separately because one needs to point to the images and one is the metadata the extra data of your nft this is fantastic it means that you are now complete with your very first step there are three main steps and it's the art generation with ipfs creating the contract deploying it with the dap and then doing the discord and so on but your very first step is complete and at this point we are ready for the contract deployment on the blockchain but i do want to show the alternative way of also getting to this point from a photoshop script kind of view if you were struggling with the hashtags art engine and you didn't really understand how to get it to work then you can just watch this next section where i quickly explain how you can generate the images using photoshop directly and doing this metadata upload and how you can swap the metadata out as well and if you go out successfully to this point and you don't want to watch that section that's perfectly fine just skip ahead uh till we get to the start of the deployment of the contract now i'm going to quickly show you another way of generating the artworks and the metadata right through photoshop so go ahead and go to this url here at the top make sure you get to this repo and as always download the release that i show in the video version 1.0.1 it is a simple script so once you get here just simply click on the source code zip file once you have now downloaded the folder and unzipped it here it is open it up and save the photoshop file and this is very crucial inside of this folder in order to do it the photoshop route so let's go ahead and open photoshop click on file save as save to this computer then in the desktop i have this new folder that i've downloaded here you can see and click on save okay and now if we open it up you can see there's my test.psd and we have got a generate.js and an update metadata file i'll show you how to use these in just a second the next step is to actually organize these layers into groups in order to group layers it's fairly straightforward i've already grouped the background the background props fur and the skin for these eye sets i can just select them right click and then say group from layers now i can just say these will be the eyes the same thing i can do for the mouth select it all group from layers and call it the mouth group this is how your photoshop file should look like in order to use the script everything needs to be in a group otherwise this will not work you can just place it in the correct order for instance the background first background props fur skin eyes and mouth you don't need to unselect or deselect anything making it visible and unvisible the program will take care of that automatically the next steps are very easy simply go to file go down to where it says script and click on browse you get to search for the script now so go to desktop or wherever you've saved this folder and here it is there's our test.psd the actual psd file that we have opened i want you to select the generate.js script and if you cannot find it just make sure that you can search for js files click on open and this script will start to run here it will ask you some questions if you want to continue yes we do want to how many do you want to create and here i will enter 20 click on ok what is the collection's name in this case i'm going to call this the ps cool apes okay and then the description okay so blah blah blah perfect now it's going to generate 20 images and let's click on ok this process might take a while so just leave your computer depending on how many files you're generating you should technically be seeing them generating in real time so if we go there you should see them being populating and there we go but just leave it to run until it's complete and just like that the collection is now complete we also have a build folder with all the images in it as well as the respective metadata what we can do now is we need to upload it to ipfs and then remember we need to update the metadata to fit how we do it this time is a bit different so we can go back to the browser click on upload folder and in this case we need to go and find that images file click on upload this time i'm going to call it dps very cool apes images upload that and then let's just wait for the cid to be generated so that we can replace it in photoshop there we have our ps very cool apes much like before the images are now uploaded time for doing our second step copy the cid of these new images let's go ahead and go to photoshop click on file script and this time when you browse for script select the update underscore metadata.js file click on open is going to tell us to be about to update the metadata which is fine and it needs a prefix so the prefix in this case will be ipfs colon forward slash forward slash and then we're going to say this is the prefix with um the cid and a forward slash that is very important so it is ipfs colon forward slash forward slash the cid and a trailing forward slash click on ok then the suffix which would be dot png click ok and it's complete so now that that's complete we can go back to pinata upload folder select the folder go back to the desktop build metadata upload click on ok and again ps very cool apes and this will be the metadata so now we're uploading the metadata and how quick and easy was the photoshop way that is pretty cool and now soon we'll have our images as well as our metadata always test that your json file points to the right image set so here we can click on the metadata for the ps version now and then wait for it to load it is always important to test the metadata to see if it points to the correct image set so click on this little i icon and then we're going to go ahead and maybe select two dot json hit enter and let's see the metadata coming back it says there have been too many requests so we most likely want to use a different ipfs providers so let me try ipfs.io and there we go so trying a different gateway just shows you sometimes works a bit better and it works pretty well we can try another one so maybe 7.json perfect and everything changes i can go ahead now and copy this image and let's replace it just to see if we can actually find that image and there we have it beautiful that is the photoshop way obviously it has its drawbacks it's not as kind of fleshed out as the hashtabs art engine with all its features but if you need a basic generation with quick metadata this can be done too before we forget we actually need also a hidden image as well as a hidden metadata item why is this well you often see collections having a pre-reveal image meaning that we don't want to show this data to the world let's go ahead and create the image as well as the metadata item to create that data set for the hidden i would say data is i create a folder it can be called anything i call mine hidden inside we've got two subsequent folders hidden image and hidden underscore metadata in the hidden image folder we've got one image called hidden then this is how it looks it's a big question mark it can be a dot png or jpeg whatever you prefer we also have another folder like i said the metadata part where this is also called hidden.json now if i open this you can see that the json is very small all this is is a name a description and an image location you can see it also needs a c id and this is going to point to the fully qualified i would say ipfs url you will see what i mean in a second let's first go and upload our image and then replace the cid again for the single hidden file because we're only dealing with one file i'm going to upload it directly to pinata so upload a new folder go and select one go to desktop go to my hidden one and there we go to hidden underscore image and say upload that's fine we need to give it a name and this time i'm just going to refer to it to the very cool apes and then underscore hidden image and i am following no naming conventions but please do follow um but this is just for the tutorial so hidden image okay so now we've got the very cool apes hidden image as a single file and it's named as hidden.png so we need to go ahead and copy the cid go and open our folder and in the json file now i'm simply going to edit this with a text editor i don't need to use visual studio code always i need to replace the cid part so just make sure that your folder structure for the hidden metadata looks like this and that it also has the hidden.png here at the end because we are trying to grab this file go ahead and save this and then go back to pinata click on upload folder select go to desktop hidden and now we're going to upload our hidden metadata this is the metadata part so i'm also going to call it hidden click on upload and then once this is uploaded we now have the hidden metadata section which we first going to display to the user before we display the real metadata behind this hidden image let's go ahead and check it out click on this eye icon and then it should open something like this we need to now go and type in forward slash hidden and then remember jason so when we do this hopefully we get this back sometimes this gateway of pinata might be too slow so what you can do is instead type in over here ipfs.io and let's try ipfs and see if it's a bit faster and there we go there's our metadata to test the image i'm going to copy this part and replace everything here up until the qm now we are seeing the image that everyone will see before the actual metadata is revealed by the program and then the contract displaying actually the proper metadata so now it is finally time to move over to go ahead and deploy our contract now that we have all the links we need on pinata so the very first step is to have a profile on etherscan.io it's free so just sign up once you have signed up you can go to your profile up here in the right hand corner select api keys and then now we need to create a new api key it is free because we're not going to use it we're only using it to verify the contract so click on add then i'm going to make this my test key i'm going to remove this after this video so just to keep things secure but this is what you need and after creating it we will use this in the cli so just keep this page open for now for the next step we need to go back to getup.com forward slash hashtabs dash labs yes not this one this is the repo where the art engine lives but we need to go to this hashtag labs organization so type in this into the url go here and then click on the nft erc 721 collection repo once you do that we need to download the latest release it's crucial to download the release that i'm showing to you in this video so in our case downloading version 2. click on the release and then go and download the source code i just want to take a moment to mention that we are an educational channel and all the code we place out is open source that being said we do not take any responsibility for people using the code and something going wrong we do however test everything but we have to add that in our videos i also want to just uh take this time to thank you marco lyraco as you can see the contributor the creator of this cli he's an amazing dev so i urge you guys to go and check out his videos he's got a youtube channel too and we are going to be hosting the master classes together let's now go ahead and check our source code that we've just downloaded we have now unzipped the project and here it is this is beautiful but we need to open this in our ide before you have downloaded visual studio code or if you haven't get visual studio code and also make sure that you've got node.js installed now let's go and open visual studio code and here i'm going to say open desktop and point it to this project once i do that make sure that your visual studio code structure on the left hand side looks like mine because you need to be in the root directory of that projects folder to do the commands that we are about to input for the next step go and open a new terminal and let's go ahead and install the truffle framework globally so type in npm i g and then truffle once you run this command it may take a while but just let it be let it install and we need this framework to work together with our hard hat framework so that we can interact with the blockchain so once this is installed we can then go ahead and install the dependencies for each of our sub projects great so now we have truffle installed if you didn't get to this point just make sure that you have node.js installed and you can verify that again by just typing in note dash v now that we have truffle installed and everything is going well the next thing that we can do is type in truffle so truffle dashboard and then hit enter truffle will open up the browser automatically and at this point you need to have metamask extension installed on chrome and then what you can do is open metamask and just make sure that you are on the correct address that you want to deploy this contract from and on the correct network this is very important for testing we are going to be on the rinkeby test network but if you want to deploy your contract on the main network then you simply have to switch your network pointing to the ethereum main network so keep this in mind i'm going to go and switch this back to rinkeby because we simply want to deploy this on the rinkeby test network once i'm sure i'm on the right address and on the right network i can go ahead and click on connect metamask will open and i can say next connect and then once it's connected it will say please confirm and i'm going to say confirm once you've confirmed truffle is now waiting for incoming request where are these requests going to come from well it's going to wait and see if anything of our program is trying to interact with the blockchain and then once it does it's going to pop up the data here that we want to pass and this is where we have to come back and confirm it so we can do that interaction on meta mask and confirm it you'll see this happening throughout the video okay so we are on the rinkeby connected to my address we're ready to go back to visual studio so the next thing that we'll need to do is install our dependencies i like using yarn for this because it just installs it way more smoother so to make sure that you have yarn installed firstly we need to make sure what node.js version we have this is because depending on what node.js version you have you can install yarn differently for everything greater than 16.10 you can do it this way or for anything below 16.10 you can do it this way let's go and verify which version we have and which command of these two you should run currently we are running our server so here it's waiting for our request so we can't really use the same terminal to check our node version usually now we can use a new terminal while this is running and do the rest of our application but i just want to show you that you can still stop this by pressing ctrl c and now it's out of this execution what this means is if i refresh this page it's now closed i want to show this because you will need to have this running to interact with your blockchain but while this is now down i'm quickly going to check the node version and we have node dash v and we can see that i'm running 14.18.2 so to install yarn we are going to use this one over here because it's below 16. so just go and do that and i'm just going to install and maybe enable yarn to run on this machine once that is done i can clear the terminal to clear the terminal on a mac you can press command k now let's get back and how do we get truffles dashboard back up well it's very easy you can just simply run the command again so truffle and then dashboard once you do this again truffle will spin this back up and you can simply connect to your wallet and then we back to our waiting for the request screen it's important for you to see this so that if you don't know how this got closed that you can just simply run it again in another terminal i'm going to leave this running and now create a new terminal because next we will need to install the dependencies of the smart contract project over here you can see my terminals on the right hand side so our node terminal over there is still running truffles dashboard and that's why this is still waiting and now we're going to go to this new terminal you can create new terminals by clicking on the plus icon so now that truffles dashboard is running we are connected to the meta mask side we need to go ahead and install the dependencies for the smart contract you can see our folder structures have a minting dap as well as a smart contract these are technically two different projects and each one has its own dependencies so we are first going to start off with the smart contract in the terminal we are currently in the root so we need to move inside of this folder so type in cd smart contract and hit enter now we in the root of the smart contract folder we can now go ahead and run yarn so just type in yarn and hit enter yarn will go ahead and install all the dependencies needed for the smart contract project now that our dependencies have installed let's look at the folder structure so in the smart contract project the one that we are now pointing to and have stored the dependencies for we can go ahead and see that the config file is one of the most important ones this collection collectionconfig.ts we're going to update the collection's details how we want it in just a second there's also a whitelist.json and you simply append and change the addresses that you would like to be whitelisted during your mint in our masterclass we will be showing you how you can adapt this list even during the mint is taking place so be sure to visit the masterclass then we've got this.env.examplefile we're going to now duplicate this so copy and paste it then you need to rename it to simply say dot env previously this file you had to import your private keys and now it's simply not necessary anymore it even says this here in the little commented out sections to prove that you do not need your private keys anymore i'm simply going to remove this section altogether we do however need to fill in our collections prefix the cid from pinata as well as our block explorer and this is the api key that we created on ether scan now it's time for us to update these values so starting with the cid we can get this from pinata and this is not the hidden metadata this is actually the real metadata so this one i'm going to go ahead and copy the cid go back and simply replace it then i need to get my block explorer which we have the api we can go to ether scan and copy this value yours will be different once you've copied it go back and replace it save this file by pressing command s on a mac or just save it by going to file save there we go our dot env file is now set up and ready to go we can now close this because we're done with the env files and go back to the configuration file at this point you can probably fill out the whitelist addresses like i said or you can do it on a later stage as well i also before we going to go and continue just want to mention this is the contract that we will be deploying it is the erc 721 a contract and reduces the gas of minting tremendously scrolling down in this contract this is something i want to mention is that right here at the bottom with the withdrawal function here is a little thing that we've implemented in all of our contracts and this is a five percent fee that goes to the hash flips organization for producing this code it is optional however and if you do not want to contribute to five percent you can simply remove this section over here keep this section in here and it clearly states to not remove this otherwise you will not be able to withdraw the funds from this contract so but that being said if you just don't want to touch this contract and just deploy it as it is and contribute five percent to our cause that is awesome so that being said let's go ahead and configure the configurations file apart from the dot env file this configuration file is extremely important to put in the right details before you deploy the contract now the very first step is to run this yarn rename contract command why is this important well it will rename the files to make it custom to your project notice how it says here your nft token this will all change so let's go ahead and run it in the terminal be sure to be in the smart contract terminal and run yarn rename and we're gonna rename this to say very cool apes a and then hit enter this will go through its stages and rename everything as you can see now we no longer have this contract saying your nft token but it says very cool apes aaa and that's the very first step the rest of the configurations are pretty straightforward for the token name i will just call these very cool apes and then maybe a a like so and then for my symbol i can call it v c and keep it all caps v c a a a like so now we need the hidden metadata uri we can go ahead go to chrome go to pinata and there it is copy the cid and i just want to move back to truffle and then here we go and replace it in the cid notice how it says hidden.json giving it the fully qualified uri for the max apply i'm going to make it now 20 seeing that we have 20 tokens that we've generated then the white list the pre-sale and the public sale are all self-explanatory each of them takes an ether price and a max mint amount per transaction you can play around with these configurations yourself for my collection i'll just leave it like this now we get down to this part over here you can see that the contract address is null that means it's because we don't have a contract yet we're going to now deploy the contract and once it's deployed we get to replace it here once we have a deployed contract we will still be able to use the cli to change things like enabling the whitelist enabling the pre-sale public sale and revealing as well as verifying the collection to deploy the collection all you need to run in the terminal now after filling in the details is yarn and then you're going to say deploy dash dash network and then the network we want to deploy too because we have truffle setup we can use truffle so we're going to say truffle hit enter and now it's us waiting for this to deploy what we need to do is now go back to the browser and you will see this request coming in this basically shows the data that we want to push to the blockchain so if i say process it's now going to deploy on the actual rinkeby test network how cool is that keep in mind that this cli has a timeout so because i'm recording this video i'm taking way too long to approve this and it will fail so just to show you in the code again here it is failing because of a timeout that's why i need to do it a bit quicker i'm going to reject this and then go back to visual studio code this time enter yarn deploy network truffle hit enter and without talking too much wait for it to come up here on the request here it is click on process and then confirm now this is going to kick off and deploy our contract we can open metamask and see it interacting over here we can just give this some time and wait and go back to visual studio code here it says deploying contract and it's successful here we have the contracts address now that we have the contract address in hand we can simply replace this line over here where it says null paste it over there and then we can say save just remember to put it as a string so with these quotation marks hit save and now we can actually verify the contract but first let's go ahead and go to rinkeby.ethereum.io seeing that we've deployed this on rinkeby search for this address and there we have it we have our contract but it's not yet verified because we can't read the contract itself we can do that too from the cli after clearing my terminal let's go ahead and verify this contract so now that we have our contract address over there we're going to use it so if you want to know all the commands that you can run through the cli you can simply go to the package.json file down here here's all the commands and with them is verify so let me just go and run this all you'll need to do now is run yarn verify the contract's address remember to add dash dash network and truffle then hit enter there is no need to wait for the truffle to respond here it will interact directly with the contract so hopefully if this went well and i refresh ether scan we can see the green tick and we can go ahead and read the beautiful contract and what's nice is that it's all in separate files this is so cool and that's all you need to verify your contract if you run the command again it will tell you that you have already verified the contract so what is next i guess now that we have a contract on the blockchain and we can see it here in all its glory we now need a mintingdap and this is what the program also provides before i mention that there's two programs in here basically the project that is the smart contract that we are busy with now as well as the mintingdap let's go ahead and navigate to the minting dap in another terminal install the dependencies and actually launch the project because of how this project is set up the mintingdap will already know about this configuration and everything should work in order to do that go ahead and create a new terminal i'm going to click on that little plus i still want my previous terminal there as well as my truffle dashboard so in my new terminal i'm gonna go ahead and say cd mintingdap forward slash and now i'm gonna run eon this will install its own dependencies and then we can spin up the dev server once the dependencies are all installed all you need to do is run yarn dev dash server hit enter and this will spin up a local dev server and you can simply click on this link over there the host so let's click on that or let's right click and say open follow link and here we go it's running on port 8080 and this is our mintingdap it is beautiful and basic and you can customize this because it's purely a react app now we can see my wallet address that's connected the status as well as the supply because this is closed we need to open it and the first stage is to open up the white list but before i do that let me go and add my address to the whitelist json file i'm going to go ahead and copy that go back to visual studio code this time i'm going to move back to my previous terminal because we want to open up the smart contract then we're going to go ahead and go to the configurations whitelist and i'm going to replace my address right here at the top save this and now i can open up this contract for the whitelist sale this is where things feel like magic let's go and interact with our contract and have the dap updated remember we are now changing things in the smart contract project they are already linked so all we need to do now is let's go ahead and check the package.json we can see all the scripts that we are able to run and the one we are looking for is this whitelist sale open you can open the whitelist close it open pre-sale close it public sale and close that too as well as reveal but we have to start with the white list so let's go ahead and type in yarn white list open dash dash and truffle hit enter and now something interesting will happen it's going to tell us to verify a few things it's going to say we need to process this one first say confirm then it's going to try and complete this basically this is setting the price or setting the merkle root then the price and then it's going to unpause the contract so let's wait for these things to finish we can also keep an eye on this on visual studio code there we see enabling whitelist let's just double check here accept this one as well and there we go in the terminal it says it's done so basically it updated the proof and then opened up the contract for whitelist sales so now if we go back to our dap and we go ahead and refresh this this should tell us what the state currently is and there we go we can see that it's now whitelist only the supply is 20 but because i'm a part of this whitelist merkle tree basically i can mint so i'm going to go ahead and actually mint and i can't click up or down because remember the white list meant per transaction is one so i can only mint one i'm gonna click on mint and there we go let me confirm this i think this is cool that the minting dap reflects now the total supply and everything is working whitelist only so let's go ahead and see if it shows up on openc and indeed it does here it is the very cool apes aaa but it's the hidden metadata we are still in the process of doing our whitelist sale so let's go back to the dap and let's go ahead and maybe mint another one so i'm just going to mint another one and it says address already claimed how cool is that it knows that i already have minted my one so i'm going to close it and go back to visual studio code and now close the white list i want to open it up for the pre-sale so just change the previous command which was yarn whitelist open to white list closed and then network truffle running this you need to go back to the browser go to your truffle and wait for the incoming request so here's the first one accept it and it's important for you to be on the account that you have launched this contract from it now says that a whitelist has ended so if we go back to the minting dap and we refresh we should see these status also being updated so let's have a look and yes sale status is closed and 1 out of the 20 have been sold and this is the process of how you would handle your collection the next step would be to instead of opening the white list you would open the pre-sale so you'll type in pre-sale dash open and then enter go back to truffle and like i said if truffle doesn't spin up you can always type in truffle dashboard and then run it again here we can say process and now we're going to open the pre-sale so let's go back to visual studio code wait for it to do its thing you can see that it's updating the price so in this stage we might need to do a second incoming request just depending if we need to unpause and pause it updating mint per tx so let's go in here and yes now we need to click process again confirm and let's go back to va studio and let's see what the next step will be the last step is unpausing the contract so this will be our third request this time so process and confirm it's doing these things step by step to make sure that each transaction is successful before moving on to the next one once this is complete and successful our mintingdap should now be open to the public in its pre-sale form so in visual studio code we can wait for this transaction to be successfully done and there it is it's done we can go back and refresh our dap and now we should see that our pre-sale is running and people can now mint anyone should be able to mint right now not only white list members and that's basically how it works now you've seen me open the white list close the white list you can do the same with the pre-sale open and close and the public sale until your whole collection is complete i'm gonna skip ahead a bit and let's reveal the collection so at the very end what you probably want to do is say yarn reveal dash dash network and then truffle go ahead and execute this command to reveal your collection at the very end so we can go to truffle and there's the request process it click on confirm and wait for it to reveal the data hopefully if we lucky we will need openc to just be a bit faster today but if we are lucky we will be able to see our revealed nft so i have noticed that i should have accepted this request from hot at going through truffle but because i didn't it timed out which like i said is not a problem all you need to do is if it timed out just reject this request go back to visual studio and re-run the command what this will do is it will skip the initial one that it's already run so you can just wait for this revealing the collection again process and then do the last step because it will fall in a queue so don't worry if you miss the step just let it do its thing and you can always rerun the command if you need to do it in due time now let's wait for this to complete it is done it says it's revealed so technically if we go to open c and refresh the metadata over here and we refresh the browser we should see our nft and fingers crossed yes we do this is the first time this worked that quickly on openc so i'm very happy and we've got a revealed collection that is how it is ladies and gentlemen to work with the collection through the cli and i need to show you the very last little step just to keep in mind the last important thing that i have to mention is that in our third terminal over here where we are running the dev server we need to stop this and actually do a build you need to build your dap and host it on a live server for people to use so let's go and open the minting dap just to see what happens and in the terminal with with this process being closed so ctrl c will close it off just to make sure we can even clear the terminal but make sure that you're in the minting dap and run yarn build and once you do that this will compile webpack will compile this and it's very crucial to drop the public folder you know straight in the root of your server so now that it's done you will see in this public folder over there copy the build and the index and just drop it in the root directory of your server of your web server then everyone will have access to your beautiful mintingdap you probably don't want to deploy the dap as is because there's a lot of hash flips all over the place so what you can do it's a normal react app in the source you can change the images you can also if you know development change the actual style of the app and how it works and how it looks we'll go into depth in more upcoming videos on this on how to style and change it but just keep that in mind the last thing that i would like you to keep in mind is whenever you go to truffle over here to make sure that your metamask is on the right network here you can double check if it's on rinkeby on the main network as well as here now keeping that in mind if you have struggled throughout this tutorial you're more than welcome to go to the hashlist.online and follow these links the discord is a great space for developers and artists to come together and solve problems if you still have more questions don't miss out on the master class and hope to see everyone there the 8th of march so that being said please leave a like a comment in the video on what you would like to see next and give me a follow go and check out marcus channel as well we hope to see you guys next week and till then have an amazing day cheers for now
Info
Channel: HashLips NFT
Views: 68,246
Rating: undefined out of 5
Keywords:
Id: Zhmj4PiJ-GA
Channel Id: undefined
Length: 82min 47sec (4967 seconds)
Published: Sat Mar 05 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.