Published in


How to Create and Deploy ERC-721 NFTs

  • name: Used to define the token’s name, which other contracts and applications can identify.
  • symbol: Used to define token’s shorthand name or symbol.
  • totalSupply: This function is used to define the total number of tokens on the blockchain; the supply doesn’t have to be constant.
  • balanceOf: Returns number of NFTs owned by an address.
  • ownerOf: This function returns the address of the owner of a token. As each ERC-721 token is unique and non-fungible, they are represented on the blockchain by an ID. Other users, contracts, and apps can use this ID to determine the owner of the token.
  • approve: This function grants or approves another entity the permission to transfer tokens on the owner’s behalf.
  • takeOwnership: This is an optional function that acts like a withdraw function since an outside party can call it to take tokens out of another user’s account. Therefore, takeOwnership can be used when a user has been approved to own a certain amount of tokens and wishes to withdraw said tokens from another user’s balance.
  • transfer: This is another type of transfer function; it allows the owner to transfer the token to another user, just like other digital tokens/coins.
  • tokenOfOwnerByIndex: This is an optional but recommended function. Each owner can own more than one NFT at the same time. Its unique ID identifies every NFT, and eventually, it can become difficult to keep track of IDs. So the contract stores these IDs in an array and the tokenOfOwnerByIndex function lets us retrieve this information from the array.
  • tokenMetadata: This optional feature is an interface that lets us discover a token’s metadata or a link to its data.
  • Transfer: This event is fired when the ownership of the token changes from one individual to another. It emits the information on which account transferred the token, which account received the token, and which token (by ID) was transferred.
  • Approve: This event is fired when a user approves another user to take ownership of the token, i.e., it is fired whenever approve function is executed. It emits the information on which account currently owns the token, which account is approved to take ownership of the token in the future, and which token (by ID) is approved to have its ownership transferred.
  • Digital art (or physical art): Art pieces are the most popular use cases of NFTs. Digital art auctions were the first application of NFTs and continue to grow.
  • Gaming: Providing in-game purchases and collectibles of games.
  • Real estate: Tokenizing properties and smart contracts and carry buying and selling.
  • Finance: Financial instruments like loans, futures, and other responsibilities.
  • Software titles: Software licenses to ensure anti-piracy and privacy.
  • Concert tickets/Sports match tickets: To ensure that no fraud happens in ticket selling and fans can have a single place to view past experiences.
  • KYC compliance: Creating a token for a specific user’s KYC.
  1. Add your Ropsten address in the _to the field.
  2. Enter any Big number value in the _tokenid field (we suggest 1 since it’s the first).
  3. Add URI of JSON file in the _uri field, which we obtained in the previous section.

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also, Read



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

Lunaray takes a leading position in smart contract auditing and consulting service for blockchain security.