Hot answers tagged

9

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 implementation of ERC-721 is maintained by 0xcert. It is free/open source and you can use the Metadata Mock contract as a starting point. You will simply add a public ...


9

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 every address and saves this into a database where it's quickly accessible for every request. The transfer events to index for ERC721 is the following: Transfer(...


7

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, bool approved) : By calling this method, the sender authorizes the address to to transfer all his tokens. to is then called an operator of the sender. In these ...


6

The problem of this standard is that it would not allow multiple owners of a token because each token is not divisible. Is there possibly confusion between the idea of divisibility and fractional ownership? They're quite different concerns. Divisibility is about division. For example, you can divide $100 into two $50 but you wouldn't want to saw a kitty in ...


6

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) and destroyed /// (`to` == 0). Exception: during contract creation, any number of NFTs /// may be created and assigned without emitting Transfer. At the time ...


5

The ERC721 Metadata standard does not enforce uniqueness of the returned tokenURI. It is allowable for two 721 tokens to return the same metadata. Whether this is appropriate is up to you to decide as you implement the 721 contract. Most likely in the code you run during the minting process you will assign the metadata and decide whether or not you want to ...


5

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 currently ~100 Gwei. That's 100 x 20,000 Gwei per 32 bytes, which is 2,000,000 Gwei, which is 0.002 ETH, which is $3. 1 GB is 1,073,741,824 bytes, so there are 33,554,...


5

So the question was an underlying question while trying to understand how all these platforms like OpenSeas are identifying all of the minted tokens for standard ERC721 and ERC1155 contracts. It was perplexing because there's no "getAllMintedTokens()" method in the standard smart contracts. So without further adieu, the answer is by searching for ...


5

According to https://blog.openzeppelin.com/workshop-recap-building-an-nft-merkle-drop/ Lazy minting uses cryptographic primitives, the artist can sign “minting authorizations” that later allow a user to do the minting themselves. These signatures are free to produce, as they do not require an on-chain transaction. They guarantee that the artist or system ...


5

If you have some kind of server (which you likely do if you want users to download something), you can accomplish this by having the user sign a message. A basic authentication mechanism looks something like this: Sign a message saying "I, user A, have access to the NFT with id B." (for example, EIP-712 may be useful here). Send the signed message ...


5

To my knowledge, none of the marketplaces have this functionality of the owner being able to edit the metadata. But with that being said, there is nothing stopping you from including this functionality in your token contract. But it also depends on what you mean with metadata. Usually, with metadata, we are referring to the name and symbol of the NFT. That's ...


4

The uri need to point to a json file. The json file works with IPFS but over HTTP they usually add the ID of the NFT at the end of the URI which the IPFS Json file will no handle. Json file = IPFS (one file per NFT) <-- Decentralize API = HTTP request a DB by NFT ID. (one DB for all NFTs) <-- Centralized The Json format is used in all cases. This ...


4

UPDATE: Now you can use the Moralis API /nft/{token_address}/owners to get this directly. This is quite difficult, as Anupam pointed out you would have to go through all the transfer events and save them to some sort of database. And this takes a lot of effort when you want to do it with a lot of big NFTs. I've never found an easy solution myself. Full ...


4

The common way to know the number of token types (aka. tokenId) is to have a counter inside the ERC1155 contract, for instance: uint256 private _currentTokenID = 0; This way, whenever you need to create a new token, you use the current one and then increment it by one. It also allows you to do a loop in case you need to retrieve a list of all current ...


4

Seems like you have two problems - the first is ownership verification and the second is trusted exchange. The first is pretty easy to solve with the OpenZeppelin docs for ERC-721. Looks like you're looking for ownerOf(tokenId), which assuming you know the address of the ERC-721 contract and the tokenId should return the address of the owner which you can ...


4

First, you can't do this in a general way. In my speech presented at NFT.nyc, I deployed on Ethereum Mainnet a smart contract which created 2^255 NFTs using the ERC-721 protocol. (Thank you, work sponsored by NFT.nyc and Chain 76. Link at http://nft.life.) If you were planning to make a general database which held like (contract address, token ID, owner) ...


4

The Ethereum blockchain is an entirely separate system from IPFS, it does not understand what IPFS is or what it does. In most DApps, what usually happens is that the file is uploaded to IPFS via the UI, and then the resulting IPFS hash is fed to the smart contract as a string for on-chain storage and aggregation. That should be enough to cover most ...


4

I was also struggling with this previously. This error occurs with users using Metamask with Ledger/Trezor. It appears that more recent versions of web3js is requiring Metamask to strictly send txs as EIP1559 txs, although Ledger does not support EIP1559 txs with Metamask just yet. Metamask have rolled out EIP1559 + Ledger support on version 10.1.0 (https://...


4

A common problem in the traditional web2 art and trading card world is the transparency of randomness and scarcity. If you buy a trading card, like a Pokémon card for example, you have no way of knowing how rare it really is without talking to the company that printed it. There is a centralized component to the scarcity of the card. They could have printed ...


3

Just create a JSON file following the "ERC721 Metadata JSON Schema" specified at https://eips.ethereum.org/EIPS/eip-721 Here is one simple example that meets the specification: { "name": "Square #00050", "description": "CoinGecko", "image": "https://tenthousandsu.com/erc721/00050....


3

Let's take the open-zeppelin implementation of ERC721: _mint() function /** * @dev Internal function to mint a new token * Reverts if the given token ID already exists * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted by the msg.sender */ function _mint(address to, uint256 ...


3

I have requirement to create a platform on which users can register and create their own token with passing token name, price and so. Is it possible to develop such contract to create different token for different users? Using OpenZeppelin you can create either a fungible token ERC1155 or a non-fungible token ERC721. In case you want each platform user to ...


3

Interface support is advertised using ERC-165. This is documented in https://eips.ethereum.org/EIPS/eip-165 There are two cases where this is useful and these reasons motivated adding the feature as a requirement for all ERC-721 contracts: 1) Allowing off-chain entities (wallets, block explorers, Web3 clients) to recognize abilities of a contract. For ...


3

If you want an ownerOf in ERC1155 youll have to implement it yourself. rarible and opensea use indexing services like thegraph.com to keep track of transfers and who currently owns the token.


3

If contracts is an ERC721 then you can query how many tokens a user owns with balanceOf uint count = token.balanceOf(user); if (count > 0) { // User owns at least 1 index } If the tokens implements the optional ERC721Enumerable interface you can use tokenOfOwnerByIndex to retrieve the tokenId of owned tokens by a user. try token.tokenOfOwnerByIndex(...


3

Cheap/simple -- use the OpenSea API. Robust/exhaustive -- you'll need to write your own client. 0xcert has one we might be able to share. And it will monopolize a full server to run + stay synced.


3

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) and check the owner of each and every token, which is quite cumbersome. Alternative, more convenient approaches would be to use third party APIs like Alchemy's ...


3

The short answer is that it looks like the latter, unique id for each NFT, regardless of grouping (eg stadium). But to have NFT-like grouping there are a couple of considerations: The nft example implementation uses an IS_NFT bit for id's with single supplies. Notice that mint uses a packId. Perhaps this can be done more simply for your use case, or you can ...


3

The original thought was this would be used mainly for passing a price to a marketplace contract. Everyone using it (just a few people) are using it for that. I don't know of any wallets that support arbitrary data. In my experience, wallets are VERY slow to add features, so it might come some day.


2

Take a look at ERC-1155, https://github.com/ethereum/EIPs/issues/1155. This was designed by the Gnosis Team to address the problem of using ERC20 and ERC721 tokens in a case where when unique tokens would emerge. You can do that, and decompose/recompose according to rules to configure you will have the problem of gas cost for deploying a new contract each ...


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