I am creating an NFT app. I know how to implement a "create a NFT Collection" & "Create NFT" from scratch.

I am trying now to implement a " Import an existing Collection" feature like some NFT MarketPlaces such as Opensea, Rarible, Montable

To do so,my process is:

1- I let users enter the remote smart Contract address

2- I check if smart Contract exists by checking the bytecode through provider.getcode()

3- I would like to check if that Contract implement basic ERC 721 functions, like mint, ... to ensure it IS a Erc721. And because i will call the mint function of that contract later when users will purchase NFT. But i notice that the mint function is not the same in all Contract. It is a customized function over an internal _mint function. For exemple the mint function can be mint(amount), mint(to,tokenId), etc.

How Can i check the mint function in the bytecode when I dont't know how it's implemented in that contract?.

Any suggestion to implement this feature " Import Existing Collection" will be appreciated. Or What is another pattern to do that ? Please help

1 Answer 1


You should not check the mint function at all, just check if the contract is compliant with the ERC721 spec (which the public mint function isnt part of). Also, why would you want to call the mint function on your marketplace?

  • Hi @Foxxxey, thanks for the answer. I Can check if the Contract is compliant with ERC721 spec. But, if someone imports an existing Collection , i think all new minted tokens from my app and belonging to that collection must be done in that remote contract. To do so, i need to interact to that remote contract when users will create New NFT( Not in lazy mode). Or do you think the import existing Collection must not work like that ?
    – Rehum
    Commented Sep 20, 2022 at 11:55
  • Well look at how existing marketplaces work. You can't mint directly from them (when you import an existing contract).
    – Foxxxey
    Commented Sep 20, 2022 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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