1

Do NFT marketplaces need their own Solidity contracts? Or can they rely on the contract of the NFTs they are selling?

I'm asking because I was following this tutorial, How to Build a Full Stack NFT Marketplace on Ethereum with Polygon and Next.js - [2021 Tutorial], and it adds a a contract for the marketplace.

It has functions like this which facilitate listing items.

contract NFTMarket is ReentrancyGuard {
  ...
  function createMarketItem(
    address nftContract,
    uint256 tokenId,
    uint256 price
  ) public payable nonReentrant {
    require(price > 0, "Price must be at least 1 wei");
    require(msg.value == listingPrice, "Price must be equal to listing price");

    _itemIds.increment();
    uint256 itemId = _itemIds.current(); 

    idToMarketItem[itemId] =  MarketItem(
      itemId,
      nftContract,
      tokenId,
      payable(msg.sender),
      payable(address(0)),
      price,
      false
    );
...

Why not just store this listing and sale information in a regular database? And then call functions on the NFT collection's original contract when ownership needs to be transferred?

The performance will be way better at scale, and most NFT marketplaces are not autonomous anyway.

Wondering if the tutorial is just making the arbitrary decision to manage everything on the blockchain, or if I'm missing something.

1 Answer 1

0
  1. Yes, NFT Marketplace need their own Solidity contract. Inside are functions that facilitates the exchange of NFTs between buyers and sellers.
  2. Marketplace is used as middle man to provide trust between buyer and seller. Anything stored outside the blockchain can be manipulated/altered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.