I made NFT's, following this tutorial
I deployed the smart contract via Remix to my Metamask on the Rinkeby Testnet. OpenSea detected the assets in my wallet after they were minted, but the pictures and metadata in the json files was not there. Here is my smart contract:
// SPDX-License-Identifier: MIT
pragma solidity ^ 0.8.10;
//import Open Zepplin contracts
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol";
contract NFT is ERC721 {
uint256 private _tokenIds;
constructor() ERC721("Name", "Symbol") {}
//use the mint function to create an NFT
function mint() public returns (uint256) {
_tokenIds += 1;
_safeMint(msg.sender, _tokenIds);
return _tokenIds;
}
//in the function below include the CID of the JSON folder on IPFS
function tokenURI(uint256 _tokenId) override public pure returns(string memory) {
return string(
abi.encodePacked(
"ipfs://QmYiWynKnLwAPPEYdEhtPH5YhqKhq8wsnXZ6FKFBoi2G5t",
Strings.toString(_tokenId),
".json"
)
);
}
}
The ipfs URL contains the CID generated from the JSON files on Pinata. I am sure I did not use the jpeg CID. When I tried to debug my data via OpenSea's tool, I got the following:
HTTP 200 OK
Allow: OPTIONS, GET
Content-Type: application/json
Vary: Accept
{
"valid": false,
"token_uri": "https://ipfs.io/ipfs/QmYiWynKnLwAPPEYdEhtPH5YhqKhq8wsnXZ6FKFBoi2G5t/2.json",
"errors": [
"TokenUrl404ResponseException: Received 404 response for: https://ipfs.io/ipfs/QmYiWynKnLwAPPEYdEhtPH5YhqKhq8wsnXZ6FKFBoi2G5t/2.json"
]
}