I used the code from openzepplin. It is okay to deploy on public chain and test chain but failed on private chain. Is there any smart contract I hv deploy first ?
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Mintable.sol";
contract MyNFT is ERC721Full, ERC721Mintable {
constructor() ERC721Full("MyNFT", "MNFT") public {
}
}
Hello Aizea,
Yes, the code can be deployed and work in public chain and test chain- ropsten, kovan, and Rinkey, But cannot deploy on my private chain so I doubt whether any contract address in openzepplin contract should I hv to deploy on private chain like ERC820
Can you share the errors that you get when deploying to your private chain and also give some more information about your private chain?
What tool did you use to deploy? What EVM version is your private chain?
I generally wouldn’t expect issues deploying a contract extending from OpenZeppelin Contracts (the only exception is ERC777 where you need to deploy the ERC1820 registry first).
hello abcoathup,
Thanks for asking , I use remix to deploy ERC721. I only get transaction failed no further information. I deployed EnumerableMap, EnumerableSet, SafeMath successfully on vm and privatechain, only deploy ERC721 failed
My dev environment as following :
geth - 1.7.3-stable-4bb3c89d
hello @abcoathup ,
Thanks for asking and reply , I use remix to deploy ERC721. I only get transaction failed no further information. I deployed EnumerableMap, EnumerableSet, SafeMath successfully on vm and privatechain, only deploy ERC721 failed.
I doubt three points.
ERC165 - _registerInterface do I need to deploy any contract for this ?
constructor(string memory name_, string memory symbol_) public {
_name = name_;
_symbol = symbol_;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
secondly - abi in ERC721 contract. it looks like a feature in solidity, right ? Is abi internal variable ? if yes, which version of geth support this new feature ?
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory _tokenURI = _tokenURIs[tokenId];
// If there is no base URI, return the token URI.
if (bytes(_baseURI).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(_baseURI, _tokenURI));
}
// If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
return string(abi.encodePacked(_baseURI, tokenId.toString()));
}
thirdly - enable EIPs what eips I missed in genesis.json
hello @abcoathup I resolved. This is because we don't enable istanbulBlock EIP in genesis.json. However, I don't understand why istanbulBlock EIP will cause this issue.