为什么不可见nft图像?

问题描述 投票:0回答:1

I为多边形区块链创建了薄荷8 NFT的ERC721型智能合约。 NFT图像存储在我自己的服务器上(对于此项目,我不使用IPF)。我还创建了相应的JSON文件夹和文件。

表示,我通过de remix平台编译并部署了Polygon上的合同并铸造了8 NFT。一切顺利,但是(就像我以前的尝试一样)NFT图像从未显示(导入合同地址后,不是在MetAmask中,而不是在Polygonscan中,也不是OpenSea)。 below是我使用过的智能合约代码:

// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract WatergunsV3 is ERC721URIStorage, Ownable { uint256 public currentTokenId; uint256 public constant MAX_SUPPLY = 8; string public baseTokenURI; event NFTMinted(address indexed recipient, uint256 tokenId, string tokenURI); constructor(string memory name, string memory symbol) ERC721(name, symbol) Ownable(msg.sender) { baseTokenURI = "https://13.39.73.207/json/"; } function mint(address recipient) external onlyOwner { require(recipient != address(0), "Recipient cannot be zero address"); require(currentTokenId < MAX_SUPPLY, "Maximum supply reached"); uint256 newTokenId = ++currentTokenId; _safeMint(recipient, newTokenId); string memory tokenURI = string(abi.encodePacked(baseTokenURI, Strings.toString(newTokenId), ".json")); _setTokenURI(newTokenId, tokenURI); emit NFTMinted(recipient, newTokenId, tokenURI); } function setBaseTokenURI(string memory newBaseURI) external onlyOwner { require(bytes(newBaseURI).length > 0, "Base URI cannot be empty"); baseTokenURI = newBaseURI; } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } // Function to receive Ether. msg.data must be empty receive() external payable {} // Fallback function is called when msg.data is not empty fallback() external payable {} }

请问有人会鸣叫吗?

我希望NFT图像出现在MetAmask,Opensea和其他平台中。现在我只看到一个占位符图像。
	

溶解感谢:

最终解决了问题。部分要感谢 @petr-hejda:我的自我签名证书没有解决问题。我必须将域将域链接到我的IP,并使用certbot作为不错的证书。

另一个问题是在我的薄荷功能中两次连接基本URI。 校正语法:
blockchain solidity smartcontracts nft erc721
1个回答
0
投票

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.