"Gas Estimation Failed" on mint function ERC-721 contract

Deployed an NFT contract at:

Was able to mint 1 NFT successfully but looks like I may have formatted the IPFS link wrong.
The same contract deployed on Ropsten works well and mints without issues.

After minting once on mainnet, the second attempt gave a "Gas estimation failed" error

I'm sure I screwed up something basic here but can't figure out why it worked once & then started giving this error.

VERY basic contract:

:1234: Code to reproduce

// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol";
import "https://github.com/0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol";
contract SenecaNFT is NFTokenMetadata, Ownable {
  constructor() {
    nftName = "SeNFT";
    nftSymbol = "SEN";
  function mint(address _to, uint256 _tokenId, string calldata _uri) external onlyOwner {
    super._mint(_to, _tokenId);
    super._setTokenUri(_tokenId, _uri);

:computer: Environment

Hi, welcome! :wave:

I just deployed your code and had a try, it worked well, just called the function mint twice

mint(Account, 0, "test link")
mint(Account, 1, "test link")

you can find all the transactions all at here: SenecaNFT | 0xdFd5D67e46C80c4c9537039ea19e428E27C7777c (etherscan.io)

So I am not sure what is your problems, so could you please share your failed transaction?

This is the error I'm getting in Remix. I'm very novice at this. It seems that I've likely inadvertently changed something locally in Remix but I can't figure it out.

Emmmm, so could you please share your parameters when you try to call mint() again?

Just filling in the 3 inputs:
to: 0xf53BCD08714938E53CC04b937434BA7063a3e839
id: (putting in any number string)
uri: This time I'm trying an IPFS link hosted on Pinata

Regardless of how I enter (or even leave blank), it pops this same error:

OMG... I fixed it. I knew I was doing something STUPID...

I was entering in the same "Token ID"...making a duplicate, essentially.
The error was telling me right there that the transaction would fail (in addition to using up gas).

The interesting part that screwed me up is that I was able to mint multiples with this contract on Ropsten using the same Token ID. It just added them as additional holdings under separate ERC-721 entries (different entry for each token ID it seemed)

It seems like there are small differences in the way Ropsten & Mainnet behave

1 Like

Realizing now that I'm STILL stuck though with my original issue I suppose, although a much simpler one I think:

The input for "uri"

I had assumed this was a simple URL link to an image, but it seems not. If I'm understanding right, you need a .json file linked with your ipfs image that has your metadata & such...

I'm not trying to do anything complicated here, just give an image a title and get it to display on Opensea, Mintable, etc...

What is the input format for that uri part?

Emmm, I think this can be an API, such as https://my-json-server.typicode.com/abcoathup/samplenft/tokens/, and maybe you can have a look in this tutorial, it explains about the MetaData