Understanding The Web

Road to Web3: Week 1

Posted

DEVELOP AN NFT SMART CONTRACT (ERC721)

The online world can take many forms based on user preference.  A very natural form the world wide web tends to take is an educational platform.  As blockchain technology gains adoption, an abundance of educational resources and blockchain development tools follow suit.  Web3 University is an educational resource that teaches web3 development. A 10 week course guides students in building various web3 projects.  Week 1 teaches students how to develop and deploy an ERC721 (NFT) smart contract.  Read the Ethereum post for a brief understanding of Ethereum Request for Comment (ERC), smart contracts and other Ethereum blockchain basics. Learners are introduced to many components that will produce the final result: OpenZepplin, Remix, Metamask, Filebase, Alchemy, and Ethereum Goerli.

CREATE CODE

The first step to creating the ERC721 smart contract involves using the service OpenZepplin.  OpenZepplin creates code for the blockchain through options that are presented as shown below.

By clicking on ERC721 on the top tab and clicking mintable, OpenZepplin generates the associated code.

OpenZepplin is convenient resource to produce code that follows cybersecurity standards which helps greatly reduce the risk of exploits.

TRANSFER CODE TO AN IDE

The next step in the process is to transfer the code to an Integrated Development Environment (IDE).  OpenZepplin has an option to ‘Open in Remix’. 

This option transfers the code to the Remix IDE which is an online environment where the code created thus far can be further modified.  Another important step at this stage of the smart contract development process is connecting Remix with the browser extension wallet Metamask.  Read the article Keys to the Blockchain to learn more about cryptocurrency wallets and Metamask.  Once Remix and Metamask are connected, the next step is to make sure the correct network is being used. 

TEST NETWORK

Smart contract blockchains have test networks in which developers can trial their applications without having to pay with main network tokens for gas fees.  Test networks will have a faucet in which developers can acquire free tokens that will simulate gas fees that would occur on the main net.  Read about gas fees in this article about EthereumThe following image shows various test networks available for Ethereum. 

At the time of this post, the Goerli Test Network was the only one that was not deprecated due to the Ethereum merge.  At this point in the tutorial Metamask is connected to the Goerli Test Network, connected to Remix, and has test net Ethereum from the Goerli faucet to simulate gas fees.

DEPLOY TO BLOCKCHAIN

Another integral piece of the puzzle is the Alchemy Software Development Kit (SDK).  After creating a free account with Alchemy, users can create an application.  On application creation, users have the option to choose the network for application deployment.  Choosing the Goerli Test Network connects everything completed at this point.  From here, the application can be deployed to the blockchain through Remix.  When the app is deployed, the next step is to create necessary information necessary to define NFTs.

METADATA

Outside of the code created with OpenZepplin, this project requires metadata for third party NFT marketplaces.  This project will be using OpenSea as its NFT marketplace.  In order to create the metadata, users will have to created a json file.  The json file will need to hosted somewhere that OpenSea can pull from.  This project uses Filebase, a decentralized storage solution.  Along with the metadata, Filebase also hosts the image of choice for this ERC721 token.  With the proper files hosted through Filebase network integrations such as ifps, preparation for the final step is complete.

INTERACT WITH THE CONTRACT

With all of the pieces in place, the final step is to mint the NFT.  Using Remix, it is now possible to interact with the previously deployed contract.  Linking the metadata hosted on Filebase is an important step just before minting.  Once the interaction is initiated, Metamask will again initiate a transaction to pay gas fees.  If all the steps have been completed, the NFT will be viewable on OpenSea by connecting with the same Metamask account.

CONCLUSION

Getting started as a developer on the blockchain has become an accessible endeavor.  With many resources available for aspiring developers, the blockchain aims to become inclusive in the truest sense.  Through the use of various services available online, creating a smart contract is a simple task.  Web3 University offers a 10-week course that teaches important concepts necessary to excel as a developer on the blockchain.  Week 1 teaches students how to write, deploy, and mint their first ERC721 NFT smart contract.