34
votes
Accepted
How to find all ERC721 compliant NFTs owned by an address? (Web3 JS)
In order to get all NFTs of a user, you need to have an indexed database where you save this data. Then you index all Transfer events of ERC721 contracts and eventually calculate the balances for ...
27
votes
Accepted
ERC721: How to get the owned tokens of an address
Per https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md, there's an optional "enumeration extension". If this is implemented for the token you're interested in, then you can just call ...
26
votes
Accepted
invalid arrayify value while using bytes32 array
The problem is that you populate the params array with uint and string arguments whereas it only accepts bytes32 values.
Basically a bytes32 is an hexadecimal of length 64 without the 0x prefix (1 ...
19
votes
Accepted
TypeError: different number of components either side of equation
Operation push has changed behavior since since solidity 0.6. It no longer returns the length but a reference to the added element.
You can solve this by splitting the assignment in two operations:
...
15
votes
Accepted
Updating ERC-721 Token's Metadata after it was Minted
Is it possible to somehow update an existing ERC-721 Token's MetaData after it was already minted?
Yes. This is not disallowed by the standard and so you are free to do this.
The official ...
15
votes
_mint vs _safeMint, which is best for ERC721?
I am familiar to which implementations you are referring. (As this is not a specified ERC-721 feature.)
The _safeMint flavor of minting causes the recipient of the tokens, if it is a smart contract, ...
14
votes
Accepted
How to get metadata from ERC721
The other answer is incorrect.
See the ERC721 Standard for exactly how to do this. If a token contract properly implements the ERC721 Standard and the ERC721Metadata extension, it will always ...
13
votes
Accepted
What does ERC721URIStorage actually mean?
It means that the tokenURIs are also stored in "storage". The base implementation in ERC721.sol reads the baseURI in memory and concatenates the resulting String on-the-fly, without storing ...
12
votes
Accepted
ERC-165 query on ERC-721 implementation
supportsInterface shouldn't be used to check individual functions. Each interface should have a single interfaceID which, as you can see in the ERC-721 implementation you posted, is constructed as ...
12
votes
What's the point of ERC721Receiver.sol and ERC721Holder.sol in OpenZeppelin's implementation?
I know this thread has been here for two years, but I think the question has not been fully answered. See another post I put up here.
The real question is even having this onERC721Received function ...
12
votes
ERC721 Token Transfers and Approvals
To summarize :
approve(address to, uint256 tokenId) : By calling this method, the sender authorizes the address to to transfer one of his tokens with the Id tokenId.
setApprovalForAll(address to, ...
12
votes
How to find all ERC721 compliant NFTs owned by an address? (Web3 JS)
Assuming opensea is aware of the tokens you could use their api also:
https://api.opensea.io/api/v1/assets?owner=${address}
11
votes
Accepted
ERC1155 name and symbol
The ERC1155 standard interface has a URI (Uniform Resource Identifier) that can point to a file where you can specify all the characteristics of the token (name, symbol, description, size, color or ...
11
votes
ERC721 NFT minting to accept custom ERC20 token as payment
You can edit the mint function require the user to transfer certain ERC-20 tokens in your mint function. You can define a price for the ERC-721 tokens in terms of the ERC-20 token, and perform a ...
10
votes
safeTransferFrom is undefined in buidler test
Ran into this myself as well. Are you using ethers.js with Buidler?
The safeTransferFrom method is overloaded and generally with ethers.js the bare definition is the default method used.
If you run ...
9
votes
List ERC721 tokens owned by a user on a web page
You could add a function to your smart contract that mimics what the CryptoKitties contract does in function tokensOfOwner, which
Returns a list of all Kitty IDs assigned to an address
/// @...
9
votes
Accepted
How can there be a balance for an ERC721 contract?
balanceOf does not return the number of a particular token. It returns the number of tokens that a particular user owns.
For example, if you want to know "How many CryptoKitties does Jane own?", you ...
9
votes
Accepted
Can we mint 5 gigabyte video NFTs?
I'll come at this from a slightly different direction...
The current price of ETH is ~$1500.
The Yellow Paper states that storing a 256-bit (32-byte) word costs 20,000 gas.
Average gas price is ...
9
votes
Accepted
Why does ERC721 have transferFrom and safeTransferFrom?
There is an explanation in the original Github ERC721 thread about keeping the "unsafe" transfer function (comment from Dieter Shirley, alias "dete", one of the authors of EIP-721) ...
8
votes
Accepted
Conformance test suite for ERC-721 smart contracts
I'm currently developing my own implementation of an ERC721 compliant token.
I wrote a number of tests for it, which I have added to my Github so that you may use if you wish.
The test file was ...
8
votes
Accepted
How to override supportsInterface() function if contract needs to support many interfaces?
Your code already overrides the supportsInterface() method well and will cause all the extended contract's methods to be called. This method is also used by the OpenZeppelin Contracts Wizard.
If you ...
7
votes
Accepted
How to create your own ERC 721 NFT token
The most official documentation for this token is the request by itself on GitHub.
The author of Non-fungible Token Standard is Dieter Shirley. He was first to implement it on 20 Sep 2017.
I am ...
7
votes
Accepted
Can erc721 belong to another erc721 token?
The ERC-721 standard only describes the smart contract interface for a non-fungible token on the Ethereum blockchain. It provides basic functionality to track and transfer NFTs. A token, in this case, ...
7
votes
Accepted
What is the difference between an approved address and an operator address?
Here's the relevant code:
/**
* @dev Returns whether the given spender can transfer a given token ID
* @param _spender address of the spender to query
* @param _tokenId uint256 ID of the ...
7
votes
Accepted
What's the point of ERC721Receiver.sol and ERC721Holder.sol in OpenZeppelin's implementation?
When using the safeTransferFrom function to send ERC721 tokens to a contract address, it will fail unless the receiving contract properly implements the ERC721TokenReceiver interface. (See the ERC721 ...
7
votes
How etherscan.io is able to track ERC721 tokens on the blockchain
From the Etherscan support center:
Etherscan tracks all ERC-721 (https://etherscan.io/tokens-nft)
compliant tokens as per the finalized standard at
https://github.com/ethereum/EIPs/blob/master/...
7
votes
Store ERC721 token metadata
You have a lot of questions in there. Let's find the relevant references first.
Specification
The standard is specified at https://eips.ethereum.org/EIPS/eip-721
The specifications are the tokenURI ...
7
votes
Undeclared identifier _setTokenURI in ERC721
Yes, you are right, the function _setTokenURI() was removed in pragma 0.8.0; and you have imported the updated ERC721URIStorage.sol.
But, you need to use that in your smart contract by using ...
7
votes
How to find all ERC721 compliant NFTs owned by an address? (Web3 JS)
No, web3 doesn't know about all ERC721 token contracts, which would be required to call ownerOf() for each NFT.
What could be done: take a list of popular ERC721 contracts (like this one from Bloxy) ...
7
votes
Accepted
Why are all NFTs created from Null Address on Opensea?
Because the standard says so.
https://eips.ethereum.org/EIPS/eip-721
/// @dev This emits when ownership of any NFT changes by any mechanism.
/// This event emits when NFTs are created (`from` == 0) ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
erc-721 × 948nft × 375
solidity × 372
erc-20 × 110
tokens × 102
erc-1155 × 90
contract-development × 65
opensea × 61
openzeppelin × 57
blockchain × 54
web3js × 48
openzeppelin-contracts × 48
mint × 47
go-ethereum × 39
etherscan × 36
remix × 34
dapps × 25
ethers.js × 25
meta-data × 25
contract-design × 24
hardhat × 22
polygon × 20
truffle × 19
contract-deployment × 19
metamask × 18