Guide to creating your own NFT with Javascript & Solidity — UPDATED to include video guide – 🚀 (Part 1 of 3)

Gary George
Coinmonks
5 min readSep 6, 2021

--

What is an NFT ?

NFT stands for non-fungible token. Non-fungible is an economic term that you could use to describe things like your furniture, a song file, or your computer. These things are not interchangeable for other items because they have unique properties.

The NFT world is relatively new. In theory, the scope for NFTs is anything that is unique that needs provable ownership.

For a deeper explanation check this [LINK]

What is A Crypto Wallet ?

A blockchain/crypto wallet is a digital wallet that allows users to store and manage their Bitcoin, Ether, and other cryptocurrencies.

When creating a website that allows users to interact with NFTs , you will need to connect your wallet to the website.

The most popular wallet used is [Meta Mask], this can be used as a browser extension for Chrome and Firefox.

See [HERE] for a more in depth explanation of blockchain wallets.

How do you create an NFT ?

There are many ways to create an NFT without needing any development experience, A great example of this is [Opensea].

You can create an Opensea account link it to your crypto wallet (MetaMask) and create NFTs simply by interacting with the website as you would any other web app.

While this is a good option , we wont be doing this in our example, we are going to go deep in the rabbit hole of becoming a blockchain developer 🚀.

We will need to do a few things in order to create our NFTs:

  • Write a smart contract in [Solidity] (this is the language used on the blockchain)
  • Deploy your contract to your chosen network
  • Create your NFT asset
  • Create your corresponding metadata file for your NFT
  • Mint your metadata file to the blockchain using your contract

Writing your own NFT contract

The great thing with smart contracts is that there are lots of boiler plates that you can leverage off. The biggest provider of these is [Open Zeppelin] .

“OpenZeppelin Contracts help you minimize risk by using battle-tested libraries of smart contracts for Ethereum and other blockchains. It includes the most used implementations of ERC standards.”

This is great for us as developers as we can get our contracts created with much ease.

An NFT contract aka a [ERC721 Contract] allows us to create/mint and purchase/transfer ownership of digital assets/NFTs.

Here is a complete solidity example for a real world NFT contract:

The above example extends 2 existing openzeppelin contracts to enable you to fulfil the entire required spec in place for [ERC721].

The main thing to take note of is the two strings passed into the constructor the first “YOUR TOKEN” would be the parent name for all of your tokens created with the contract, the second argument “TOKEN” is the short code that will be used for your Tokens.

Deploying your first NFT Contract

Once you have written your contract you will need to deploy it to test it out, One big thing to note about the block chain is that all contracts are immutable , this means that a bug will forever live in your contract , you can not make changes to a contract once it is deployed 😢.

Thankfully we have test environments available to us ,There are multiple test nets available. My preferred test net to use is Rinkeby, Here is some further reading on [Test Nets].

A massive benefit of the test nets is that you can reset your contracts and overwrite mistakes. Which means you can test out your contracts until you are happy and then deploy to the main net (where it is immutable)

To get your contracts on the test net you will want to use [Truffle], Truffle is an excellent tool which allows you to easily deploy.

Im not going to go through truffle deployment but [THIS VIDEO] will give you all the information you need.

Free Video [Code Walkthrough]

I have recorded a video walking through the boilerplate code [LINK]. I really hope this helps other developers out who are looking to go into Blockchain development.

Crypto Ghoulz

For research into this topic i created my own blockchain based website on the polygon network, which allows users to purchase NFTs, check it out and if your feeling spicy purchase one of my NFTs. https://cryptoghoulz.com .

If you have any questions surrounding [Crypto Ghoulz] get in touch via [Twitter].

Project Code

If you want to get started on this you can find a boiler plate repo [HERE].

This is a good to go project that can help you get a real feel for how everything works.

--

--