Deploy Your Own NFT with Infura, ConsenSys NFT and Replit - Kristofer Shinn
web3con 2022 · 6 Mar 2022 · 16:41
Kristofer Shinn gives a hands-on tutorial on creating an NFT project. The session defines NFTs through the ERC-721 and ERC-1155 standards, surveys use cases beyond collectibles, and weighs centralized, on-chain and IPFS storage for metadata. A live demo uses a Replit Solidity template and Infura's IPFS API to upload images and metadata, deploy a contract to the Goerli testnet and mint a token, followed by a look at ConsenSys's upcoming NFT API platform.
Speakers
Topics
From web3con 2022, hosted by Developer DAO.
Transcript
and api access so builders can build their projects easier um just connecting to us you don't have to worry about running a node and i'm here to talk to you about nfts this is a little bit more developer focused but what i hope to cover here is a little bit of background and use cases with nfts and describe some common project concerns if you're building an ftp projects we'll use a tool called replits and inferior's ipfs api to deploy and mint an nft do a bit of live coding and finally we'll introduce the consensus nft api something that's up and coming that's uh pretty exciting all right so nfts why are we talking
about nfts as as people in this room probably know they're pretty popular right now um whether you know their headline news with people and like 100 million dollar sales the marketplaces like openc are starting to get more into the public consciousness traditional auction houses like christie's is auctioning off nfts so they're really starting to enter i think grow outside of just a web 3 circle so what is an nft um if we if it hasn't been covered before i'll try to define it here right so fungible is something where you have a set of like objects or a set of like items and you can exchange them for like for
like value so coins fiat currency eth um bitcoin those are all fungible tokens non-fungible tokens then implies that you cannot trade them for like for like value right so there's a uniqueness there's a rarity among the nfts amongst the tokens where i can't just give you my token you can give me your token and it's a fair exchange of value diving even lower at the developer level what defines an nft is simply conformance to one of these two standards that i have on the screen here erc 721 or erc 1155 right if you implement those interfaces congratulations you're an nft simplifying it even further down
the way that i defined an nft is basically metadata that saved on chain right with this token uri the token uri points to metadata which defines the nft and there's an address that owns that nft right this is really all that that we're talking about today all right so allow me to get on my soapbox for just a second while the dominant use case of nfts is digital collectibles and digital art right now um i wanted to point out some use cases that kind of make the case that nfts are so much more than just digital collectibles right ens domains as an example they conform to the 721 interface therefore they're an nft they can be transferred and traded just like any other nft
other use cases are like real world deeds there are projects out there that are trying to take real estate deeds and sort of real world property and tokenize them on the blockchain using nfts and finally the one that i think is a little bit more interesting and maybe a little bit esoteric is this idea of negative value assets like there there's an idea that you can take an nft and represent like say debt paper with it or or loans in which case it behaves like an nft right you can't trade it like for like but the holder of that nft could have all of the rights and privileges associated just like in traditional finance holding that paper all right now that i said all that this this talk is going to be about digital
art so if you're doing a digital art or a digital collectible project these are the kinds of concerns that might be floating through your head as you're putting your project together right what contract am i going to use this is a 721 is that 11.55 do i need to use extensions like am i going to have royalties on this sealed metadata there's a ton of extensions that you can also implement around nfts and if you're rolling this yourself do you need to be an expert at security at auditing your contract or do you need to hire you know something like consensus diligence to do a an audit on your contract how comfortable do you feel with real world value flowing through the contract
you just wrote another aspect is around the metadata how do you generate and store all the metadata that is um attached to your nft i'll dive a little bit uh further into that in just a few moments and finally when you're minting or dropping the nft like what are the mechanics around that how are you going to do it are you going to script it are you going to create software to script it are you going to do it by hand are you going to use a platform like openc or a marketplace where you can just do it through the interface all right so let's talk about storage for storing the metadata and storing the assets there's basically three methods you could use right you could do centralized storage
which is your traditional web hosting you're going to get a [Music] digital ocean droplet or a heroku and host images and um from a web server right extremely easy flexible low cost problem is is that it happens to be censorship prone you know what if your hosting provider isn't welcome in certain geographies what happens if somebody doesn't pay the bill what happens when your web server goes offline so generally not recommended on-chain storage is an interesting idea so that token uri that i was talking about can be any uri including a data uri so you can encode all of your metadata and save it on chain this is great because it's simple
not a lot of moving parts but it's expensive because you're basically taking all of this metadata and using the chain to store it right it's something that you'll have to weigh the best the best option in my opinion is decentralized storage something like ipfs right it keeps your on-chain storage down so that you are you're only saving a url it's decentralized and has content id so you know it's immutable and it's not going to change and while there's some additional moving parts like you have to find an ipfs provider or host a node yourself i think it's worth the additional complexity all right so let's make some nfts this is the general thing we're going to
be stepping through today storing we'll have to collect our assets and store them on ipfs we'll generate the metadata store that on ipfs we'll use replit to deploy a contract to mint an nft and then we'll make millions of dollars um so let me talk about replied for just a second so replied is a company um that produce that makes these sort of online coding environments it's a really great and easy way to to set up right it's free xero setup zero config browser based platform all you have to do is all you have to have is an internet connection and a browser and
you have a you have an ide that you can collaborate and share with right they launched a solidity template four months ago which is the basis of this of uh the repli that i'm going to use today and this is what it's going to basically look like we'll start from that general solidity template i've added some tooling for ipfs and some integration with infuria so that if you wanted to play with it all of these tools that i'm doing today are out of the box the basic work around this is you connect the reple with your metamask wallet you modify the contract solidity file with any custom logic anything you want to do there manage the assets on infuria's ipfs api
and then deploy and mint it's pretty pretty easy and then if you're working on a team you can share you can share the url of your reple and you can collaborate all in real time all right so let's go to demo time this is the usual warning of live uh live coding demos all right so let me just make this bigger all right so if you can see on the screen this is what replit looks like um you can see there's a code editor here on the left um there on the right we have a ui this is where you would connect your wallet i've already connected my my metamask wallet so
if not you would see a connect wallet here um something to deploy although the contracts all the nfts and then once you've deployed an nft you can just call functions within this ui on the bottom panel here um there's a shell that we can use to interact uh with the environment and this is how we'll be managing the ipfs assets now before we get too deep into the live coding we have to do a little bit of setup so what you want to do first is either sign up or log into your inferior account by the way everything that um that we're doing today qualifies under the inferior free tier including all of this ipfs works so if you wanted to play around with it
there's no charge for any of the stuff that i'm doing up here so once you log in you'll want to create a project up here select ipfs name the project since i already have projects created i'm just going to use one of one of my pre-baked projects you'll be dumped to a settings page here where you'll see the project id in secret so you just copy these project ids and secrets come back to the secrets manager in your reple pretty cool right secrets management and then you'll want to create these two uh two secrets right project under id project c under secret um these
case and and words matter here um input your project id and project secret and then you're ready to go by the way in this readme all of this stuff that i'm doing is it's here in this readme in case you want to look at it later all right so back to back to live coding this contract sole is what gets compiled and what will get deployed right anything to find here you can choose to deploy so i'm going to choose i'm going to start with this nft 721 contract and since i used a bunch of sort of like badly made badly made memes for this presentation we're just going to use that as uh as our nft source so we'll
name this a bad meme token you can give it an nft name and a symbol which is part of the spec so bad meme token and the symbol let's just say it's bm um right so now you see it compiles it saves and compiles automatically i didn't have to hit save and you see the bad meme token listed here in the drop down all right i'm gonna try to deploy this all right great live coding give me just a second
nobody look at my password by the way if you don't use one password you should it's a great tool that is not my password all right let's try this again and if i can get this reworked give it a second to boot up
all right one more time confirm all right so while that's deploying and we'll wait for that transaction to get confirmed i'm going to drop in over here to the asset so let's look at the ipfs part so i've created in this folder assets these are all my images and all the metadata that describes that images those images the metadata adheres to it the openc metadata standard so if i wanted to hawk the stuff on openc it's completely compatible openc should be able to read it and make it freely tradable right take a look at that standard if you're diving into openc type
projects so the ipfs npm run ipfs directory is assets jp images and this is pattern match so you could uh just use a glob everything that ends in jpeg i think that looks good i need quotes here all right now while that's running it's going through this directory and uploading it to ipfs so you can see all of the images that i that i have in this directory now are now stored in ipfs you'll want to pay attention to this
http link if i were to click it it opens the image in ipfs getting served out of inferior's gateway so now that we have all of the image urls we have to make all the metadata i cheated a bit and i did all this beforehand so i have all the metadata in the json file so pretend that i copied and pasted all of these um all of these urls into this uh this metadata json or i was clever and i made some script to do it now we need to sync this metadata json to ipfs easy enough oops
i have to change it to the json directory [Music] live coding all right so now all of our json files are now stored on ipfs and i can start minting tokens so while i was talking you can see that badm token has now deployed onto the gurley network i can now run uh transactions against this contract so we'll come over here let me just get this down a little bit here's our mint function so this is basically how you meant nfts i'm going to come up here and just grab my own address to as a recipient i am going to grab the token url of where our metadata json is
i'm going to run that transaction confirm and it's on your way that easy we have now accomplished nft thank you thank you thank you yeah thank you it's for q a i have one more thing before before we kick in the q a um let me just go [Music] so we did this at a very low level right we're talking about contracts we're talking about ipfs deployment we're talking about like deploying in transactions well let's say you don't got time for none of that well
consensus uh is not is going to be releasing a consensus nft uh from from our nft group and what it will be is a full cycle sas platform powered by apis sdks cli tools it's going to come out of the box at the white level a white label market front a storefront that can store that can support primary drops and secondary trading normie buyers can redeem nfts through email it's got stripe integration so you can pay in fiat it's a basically an out of the box solution for nft projects if you're interested this qr code goes to this presentation so all of the links all of the tools like everything that you need you'll have access to it's it's
a public presentation thank you thank you
