Hot answers tagged

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 ...
Filip's user avatar
  • 921
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 ...
user19510's user avatar
  • 27.9k
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 ...
clement's user avatar
  • 4,292
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: ...
Ismael's user avatar
  • 31k
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 ...
William Entriken's user avatar
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, ...
William Entriken's user avatar
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 ...
AnAllergyToAnalogy's user avatar
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 ...
Giehl Man's user avatar
  • 246
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 ...
AnAllergyToAnalogy's user avatar
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 ...
Maxareo's user avatar
  • 633
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, ...
clement's user avatar
  • 4,292
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}
pguardiario's user avatar
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 ...
Sergi Juanati's user avatar
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 ...
pbsh's user avatar
  • 2,391
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 ...
Dan-Nolan's user avatar
  • 261
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 /// @...
Elifarley's user avatar
  • 191
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 ...
Shawn Tabrizi's user avatar
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 ...
Richard Horrocks's user avatar
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) ...
clement's user avatar
  • 4,292
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 ...
AnAllergyToAnalogy's user avatar
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 ...
Qwerty's user avatar
  • 221
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 ...
Roman Frolov's user avatar
  • 3,167
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, ...
xpepermint's user avatar
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 ...
Richard Horrocks's user avatar
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 ...
AnAllergyToAnalogy's user avatar
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/...
Shawn Tabrizi's user avatar
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 ...
William Entriken's user avatar
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 ...
MAHENDRAN KANAGARAJ's user avatar
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) ...
pwagner's user avatar
  • 890
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) ...
William Entriken's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible