Home >web3.0 >ERC721, IPFS and OpenSea: Understand the production and transaction process of NFT

ERC721, IPFS and OpenSea: Understand the production and transaction process of NFT

PHPz
PHPzforward
2024-01-26 17:21:39814browse

php editor Xiaoxin introduces to you the working principle of NFT casting and sales. NFT (Non-Fungible Token) is a digital asset based on blockchain technology, which is unique and irreplaceable. In the process of NFT casting and sales, three key technologies are mainly involved: ERC721 standard, IPFS and OpenSea platform. ERC721 is a smart contract standard that defines the basic properties and functions of NFTs. IPFS (InterPlanetary File System) is a decentralized file storage protocol used to store NFT metadata. OpenSea is an NFT marketplace platform for displaying, trading and selling NFT assets. By these technologies working together, the process of minting and selling NFTs is enabled.

Let’s dive into Opensea:

Explained in order:

ERC721 tokens, also known as non-fungible tokens (NFTs), have a unique identity. Unlike other common token types such as ERC20, which are somewhat homogeneous. In other words, 1 Bitcoin is equal to 1 Bitcoin, and any other token is equal to an equal amount of the same token. However, one ERC721 token is not equivalent to another, which is why Bored Ape artwork cannot be exchanged for Crypto Kittens. Simply put, NFTs are different from each other, and each NFT has its own unique value and characteristics. This makes NFT of great significance in fields such as digital art, game props and virtual assets. Hope this explanation helps you.

The most common examples of ERC721 tokens are:

  • BoredApe
  • CryptoKittens
  • Cryptopunk Crypto Punks)

These are very common NFT projects, and each of them is different from the others.

ERC721, IPFS and OpenSea: Understand the production and transaction process of NFT

How does one own an NFT?

Well, by taking ownership of the NFT

So, in order to take ownership of a specific NFT, you need to mint it.

Minting Process: ERC721 involves ownership, where one typically gains ownership of a token by minting (like buying in ERC20).

This process is implemented through functions in ERC721 smart contracts, usually using the OpenZeppelin standard.

So, how does all the minting and NFT related stuff work behind the scenes? Yes, we are going to talk about smart contract code.

In the smart contract code of NFTs, there are many functions that can be implemented into ERC721 tokens/projects. Some of them can be seen in the ERC721 documentation, for example:

  • balanceOf
  • ownerOf
  • SafeMint
  • TokenUrI
  • BaseUrI
  • setApprovalForAll
  • transferFrom ...etc

In most NFT projects, after minting a specific token, you can usually trade it on a marketplace called OpenSea Check it out.

Well, this has to do with some functionality in the ERC721 smart contract that allows OpenSea to access the file and all its related information.

  • name => This function returns the collection name of the item.
  • symbol => This function returns the collection symbol of the item.
  • baseUri => This function returns the base URI for all tokens.
  • tokenUri => This function returns the URI of the specific token that was minted.

ERC721, IPFS and OpenSea: Understand the production and transaction process of NFT

The tokenUri function combines baseUri with tokenId to get the specific uri of the token.

The returned Uri is usually the location of the token metadata.

Metadata represents a json file containing information about a token.

This is where IPFS comes in, since most NFT projects want to be completely decentralized, their file storage must be too, and IPFS covers this perfectly.

IPFS (InterPlanetary File System): IPFS is a distributed system for storing and accessing files, websites, applications and data.

IPFS uses content addressing, hashing, etc. You can get more information in their documentation.

IPFS is a peer-to-peer storage network that allows IPFS nodes to store files and connect to its network. Individuals can run nodes to communicate with the network.

However, since [Alchemy] (alchemy.com) and [Infura] (infura.io) are node providers for decentralized applications, so are Pinata, Filebase and some other NFT projects. So, because running the node directly (to IPFS) can be cumbersome.

Files uploaded to ipfs have a hash called a CID (Content ID) that is unique to each file uploaded.

Each file uploaded has a unique CID, which can be obtained directly through the ipfs node or Filebase / Pinata, etc.

Therefore, the token's metadata is usually uploaded to ipfs and a CID is generated. This CID is used as the token URI, which is what OpenSea accesses to get the token information. Something like

  • Name of the token,
  • Description
  • Features
  • Image file location (this is also the CID of the image that has been uploaded to IPFS)

Json format is as follows:

ERC721, IPFS and OpenSea: Understand the production and transaction process of NFT

looks like this on IPFS:

ERC721, IPFS and OpenSea: Understand the production and transaction process of NFT

OpenSea: The world’s first and largest cryptographic collection and non- A digital marketplace for fungible tokens (NFTs)

ERC721 The contract specifies the tokenURI of each token in the collection, which is directed to a metadata file uploaded to ipfs. Metadata that follows opensea requirements, i.e. contains information about the token. It can be viewed on OpenSea after minting through the account.

OpenSea takes some time to show NFTs minted to an address, sometimes around 24-26 hours.

So this is how all this technology works, on how NFTs are given to you in your opensea account.

This content ends here. I hope you now understand how these three technologies work together to give us NFTs like BoredApe and Crypto Kittens, and if not, I hope you at least learned something.

The above is the detailed content of ERC721, IPFS and OpenSea: Understand the production and transaction process of NFT. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete