Built your NFT on POSI Chain
What is NFT
Non-fungible tokens (NFTs) are assets that have been tokenized via a blockchain. They are assigned unique identification codes and metadata that distinguish them from other tokens. NFTs can be traded and exchanged for money, cryptocurrencies, or other NFTs — it all depends on the value the market and owners have placed on them. For instance, you could use an exchange to create a token for an image of a banana. Some people might pay millions for the NFT, while others might think it worthless. Cryptocurrencies are tokens as well; however, the key difference is that two cryptocurrencies from the same blockchain are interchangeable — they are fungible. Two NFTs from the same blockchain can look identical, but they are not interchangeable.
NFTs were created long before they became popular in the mainstream. Reportedly, the first NFT sold was “Quantum,” designed and tokenized by Kevin McKoy in 2014 on one blockchain (Namecoin), then minted and sold in 2021 on Ethereum. NFTs are built following the ERC-721 (Ethereum Request for Comment #721) standard, which dictates how ownership is transferred, methods for confirming transactions, and how applications handle safe transfers (among other requirements). The ERC-1155 standard, approved six months after ERC-721, improves upon ERC-721 by batching multiple non-fungible tokens into a single contract, reducing transaction costs.
How NFTs Work
NFTs are created through a process called minting, in which the information of the NFT is recorded on a blockchain. At a high level, the minting process entails a new block being created, NFT information being validated by a validator, and the block being closed. This minting process often entails incorporating smart contracts that assign ownership and manage the transferability of the NFT. As tokens are minted, they are assigned a unique identifier directly linked to one blockchain address. Each token has an owner, and the ownership information (i.e., the address in which the minted token resides) is publicly available. Even if 5,000 NFTs of the same exact item are minted (similar to general admission tickets to a movie), each token has a unique identifier and can be distinguished from the others.
Built your NFT
Creating the Contract
In this step, we will code a smart contract NFT with the name Position Exchange NFT. This contract base on contract ERC721, the contract ERC721 is already audited and used by most of the developers on ethereum.
In this example, the IED online remix ethereum will be used (https://remix.ethereum.org/).
After visiting remix ethereum, you need to create a file named PosiNFT.sol.
In this file, we will implement the code of our NFT below:
import
"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
import
"https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
contract PosiNFT is ERC721, Ownable{
constructor() ERC721("Position Exchange NFT", "POSINFT"){}
function safeMint(address to, uint256 tokenId, string memory uri)
public
onlyOwner
{
_safeMint(to, tokenId);
}
function _burn(uint256 tokenId) internal override(ERC721) {
super._burn(tokenId);
}
function burn(uint256 tokenId) public onlyOwner {
_burn(tokenId);
}
}
This contract provides the function mint, burn, and tokenUri.
With the function mint, it can only mint by owner of contract and the NFT will be sent to owner
With the function burn, the NFT will be destroy forever
Deploy to POSI Chain
Before deploying to the POSI chain, we need to set up POSI chain network information to Metamask.
After setup POSI chain network, return remix and inject network.
When the metamask inject network successfully, just click the button deploy and confirm transaction on Metamask
Our contract will be shown below
The address is 0x8474D2A4be0A574bf20F27Fd6360c8eb1107187a , you can go to explorer of POSI Chain to view the contract