Comment on page
Create, deploy & mint a non-fungible token (NFT)
A step-by-step tutorial on how to create, deploy and mint a ERC-721 NFT with VORJ.
To follow this tutorial you must have completed the following:
The objective of this tutorial is to provide a simple jargon free step-by-step guide on how a user can create, deploy and mint an NFT collection.
To answer the question of what is a ERC-721 NFT let's first break this question into two.
A NFT is a unique digital asset that is not interchangeable with any other asset because it has unique characteristics and properties that make it different from all other assets. The most common NFT standard in use within the blockchain ecosystem is the ERC-721 standard.
Unlike fungible tokens, which have identical values and can be traded interchangeably, NFTs are unique and often represent one of a kind items such as digital art, collectibles, music, videos and other forms of media. Each NFT has a unique identifier,
tokenID, that distinguishes it from all other tokens and represents its unique value and properties.
For example, image you have a digital painting. While you could create multiple copies of the file, each copy would be identical and thus not unique. However, if you create an NFT of the digital painting, it becomes a unique asset that is represented by a specific token on a blockchain. This token can be bought, sold or traded just like a physical painting.
An Ethereum Request for Comment (ERC) is a document that outlines the rules that determine how data is formatted, transmitted and also what actions will take place when an event occurs.
The ERC-721 standard, which is one of the most popular token standards, determines the standards / rules that determine how data is formatted, transmitted and what actions will take place when an events occurs.
As vechain is compatible with the Ethereum Virtual Machine (EVM) and the ERC-721 standard is used across all EVM compatible chains for interoperability across chains it makes sense for vechain to use the ERC-721 non-fungible token standard.
If you are on another page other than the Dashboard page, which should be similar to the image below, navigate to the Dashboard page by selecting the top left icon on the navigation bar on the left.
Dashboard page with one testnet project.
Select the project that you created by pressing on it. This should redirect you to the project space. Your screen should now look similar to the one below.
Project page with no smart contracts.
To create a non-fungible token we must first assign some resources to the project. Select the Allocate Resources button. This will bring up a modal similar to what is show below. This modal allows you to assign resources to your project. Let's just max out the resources for this project. We can always reassign unused resources across projects.
Assign resources modal screen.
After having assigned all of the available resources to a project we should see a screen similar to the one below.
An example of a project with assigned resources.
From within your project space press the Create Smart Contract button in the top right hand corner to start. This will open a modal requesting you to select the smart contract standard that you want to create. Select the second option Non-Fungible Token.
Smart contract options in VORJ.
After selecting the Non-Fungible Token option you should now see a screen similar to the one presented below. This is the non-fungible token form. There are two fields that must be populated, five optional features and two file upload components. While there are information icons available on the page which should help you understand what is required for each item let's quickly talk through each of the nine items.
ERC-721 Non-Fungible Token form.
Populate the two required fields with any values that you want and select the features that you would like for your specific smart contract implementation.
Once you have populated the form press the Deploy button or if you prefer press Save and come back later and Deploy another time.
Once you have pressed Deploy you will see a screen similar to the below which is informing you that there will be a minimum of a two minute wait until your contract has been deployed and indexed by VORJ.
Deployment and indexing taking place.
Once the contract has been deployed and indexed by VORJ you can perform some Actions with your smart contract.
Once your NFT smart contract has been deployed you should see a screen similar to the below.
Deployed NFT action tab.
There are some elements on this screen that we should discuss. The long hexadecimal string starting with 0x is the contract address of your deployed smart contract. Next to the contract address are three icons. The first icon copies the address to your clipboard. The second icon links out to the explorer to view your smart contracts transactions. The third icon, IPFS, links to the VORJ IPFS node where your media has been uploaded to.
The form elements on this page will depend on the features that you implemented as part of your contract. From the image above we can see that the contract was deployed with the pausable feature. This means that the contract can be paused and unpaused with the press of a button.
The primary function on the Action tab is the ability to mint tokens. You can mint tokens from your NFT smart contract to any address. In this particular contract we set the minting approach to selective. Selective minting means that we can choose which tokens to mint to which address and we can mint any amount by populating the TokenID cell from the dropdown list. We have provided a useful balance counter for the smart contract to inform the user how many tokens remain un-minted.
Double check that the address is correct. Once a transaction has been submitted it is irreversible and the NFT cannot be recovered.
To do a test transaction you could send some of the tokens to the burn address
0x000000000000000000000000000000000000dEaD. This is an address which is used to burn tokens, the funds in this address are lost forever as there is an almost zero percent likelihood that the key for this address can be generated.
You have successfully created and deployed a NFT on the vechain blockchain.