How to NFT
Tags: nft, blockchain, ethereum, solidity
Published: 2021-12-14 17:46:09

## What is NFT

**NFT stands for Non-fungible token**. Piece of any data (art, audio, video, document or even real object) with unique identifier stored in blockchain.
It is a token assigned to the wallet address. Can be traded using cryptocurrency (ether, tezos, solana) on digital marketplaces (Rarible, OpenSea).

The majority of NFTs are held on Ethereum blockchain, but there are other ecosystems that supports them (Polygon, Solana, Tezos etc.).

The interesting part is that blockchain due to its decentralised nature is very immune to attacks or being shut down. That means the person who owns NFT, may be sure it is going to be assigned to its address for a very long time (until the blockchain ecosystem lives).
 [More about blockchain](https://ethereum.org/en/developers/docs/intro-to-ethereum/#what-is-a-blockchain) 

## Minting

Minting is the process of including digital asset into the blockchain.

The result is information about the asset (NFT) and the owner (wallet address).

So by minting the NFT You add the information to the blockchain that Your wallet address owns this particular NFT.

## NFT creator identity

You can create NFT anonymously or by associating it with Your name. 
Creators of one of the most popular NFT collection Bored Ape Yacht Club are identified by their nicknames. 

But if You have some reputation as an artist and want NFT people to know You created it, there are some ways to do so:
- If You are selling NFT directly, outside the marketplace (more on that later) - You should probably announce Your public wallet address. That way it will be easily identifed on smart contract.
- If You are using marketplace You can link to Your marketplace account or particular NFT collection. Take a look at Lana Denina twitter profile [https://twitter.com/lanadenina](https://twitter.com/lanadenina). In the account description she has linked her OpenSea profile proving she is the creator of the particular collection.

## How to create NFT

There are few ways to create NFT collection, here are 2 that makes most sense to me:

### Easy way
On the NFT marketplace (OpenSea, Rarible etc.) there is an option to directly create NFT or entire collection by uploading the asset (music, picture, video). You just have to link Your wallet address (using for example Metamask), upload art and add some info about it.
Then You can choose whether the art should be open to bid or sold by fixed price. 
There are few details:
- You have to pay one time initial fee to initialize account. More info on that [here](https://support.opensea.io/hc/en-us/articles/1500003246262-What-fees-do-I-pay-for-my-first-listing-) .
- After setting the price, You still need to pay gas fee (more info on gas [here](https://ethereum.org/en/developers/docs/gas/)), to set the ownership of the art You just published to Your wallet address.
- Marketplaces usually have commission fees and/or minting fees paid by buyers and/or sellers.

For test purposes You can use [OpenSea testnet](https://testnets.opensea.io/) to go through the entire process. It uses fake ETH which you should request from [faucets](https://ethereum.org/en/developers/docs/networks/#testnet-faucets), that way You will not use any real money and see how the process looks like.

I used that way to publish photo of my cat ([LINK](https://testnets.opensea.io/assets/0x88b48f654c30e99bc2e4a1559b4dcf1ad93fa656/114843971092706458663467244611519273191415456962500201496962118017698079178753)) as NFT and set the price to 0.1 ETH.

More:
- [More info on ethereum testnets](https://ethereum.org/en/developers/docs/networks/#testnets)
- [Step by step guide to create NFT on OpeSea marketplace](https://decrypt.co/resources/beginners-guide-to-nfts-how-to-mint-a-non-fungible-token-on-ethereum)
-  [https://visionaryart.io/nft/marketplace-comparison/](https://visionaryart.io/nft/marketplace-comparison/) - a nice comparison of major NFT marketplaces with fees.

### More difficult way
Create smart contract, deploy it to the public blockchain and let people mint the NFT with price You set on the contract.
It requires smart contract coding and creating user interface to allow people to see the art and mint it. 
- Smart contract - the program that runs on the blockchain and has all the logic that describes collection name, how many NFTs will be minted, who is able to mint the NFT and what is the price of minting it.
- By creating the smart contract - You sign it with your own wallet address, proving that NFT was created by You.

I found  [nice basic guide by Alchemy on how to set a price of NFT](https://docs.alchemy.com/alchemy/tutorials/how-to-create-an-nft/nft-price) 

## How it looks

- The NFT standard is known as `ERC721`
- OpenZeppelin essentially implements the NFT standard for us and then lets us write our own logic on top of it to customize it
- NFT is actually a JSON file with the `metadata` that looks something like this.
    
    ```jsx
    {
        "name": "Sleeping Cat",
        "description": "He is liquid. He fits everywhere",
        "image": "link-to-the-image"
    }
    ```
    
Almost every **NFT** has a name, description, and a link to something like a video, image, etc. Additionally we can add custom properties if we want to. This is all part of the `ERC721` standards and it allows people to build websites on top of NFT data
    

## Digital art format

The main idea behind NFT is to store information about ownership of each piece on decentralised database (blockchain) forever (or until blockchain is alive). 
But knowing how the NFT looks like - we see that its just an object pointing to the values. So the asset itself also have to be stored in decentralised database to make sure it will not disappear one day. 

When creating the JSON object of NFT, make sure the link to the digital asset is not a link to uploaded image on sites like "imgur.com" or any other centralised data storage. 
Why? Because its using normal servers, so when the service will disappear one day - the NFT object will point to non existing asset.

There are few ways to make sure Your NFT asset wont break:

### SVG

Scalable Vector Graphic - vector image format for two-dimensional graphics with support for interactivity and animation.

[Here](https://www.w3schools.com/graphics/svg_intro.asp) is a w3 schools tutorial on how to create SVG.

How we use SVG to store simple images:

1. Create SVG
2. Encode SVG to Base64 format here [https://www.utilities-online.info/base64](https://www.utilities-online.info/base64)
3. Check if its working. Paste `data:image/svg+xml;base64<INSERT_YOUR_BASE64_ENCODED_SVG_HERE>` into the browser and see if its showing the same art You encoded before.
4. Store the link You just tested in NFT object

### IPFS (larger assets)

**IPFS is a distributed system for storing and accessing files, websites, applications, and data.**

You can use [Pinata](https://www.pinata.cloud/) service to store NFT art on IPFS decetralized data storage system.

It supports multiple file formats so You can upload audio, video, picture, doc etc.

More info on IPFS [https://docs.ipfs.io/concepts/what-is-ipfs/](https://docs.ipfs.io/concepts/what-is-ipfs/)


Please be aware that IPFS is a public network! This means anything uploaded through IPFS will be accessible by anybody on the network

## This is it

I guess this is it when it comes to my basic understanding of how to create NFT, how it looks like and what the fresh NFT artist should be aware of, while creating first collection.