Hot answers tagged

7 votes

Metamask - "Params specify an EIP-1559 transaction but the current network does not support EIP-1559"

According to a post here, the solution is surprisingly simple. One can switch back and forth between the Ethereum main network and another network such as Polygon or Avalanche, and then the issue just ...
Maxareo's user avatar
  • 633
4 votes

How to use Open Zeppelin subgraphs to query ERC721 balance?

As an alternative to the graph, you can also use API providers to query the ERC721 balance from EVM blockchains. For example, you can use Moralis getWalletNFTs API to do the same thing in a few lines ...
Yoseph Kurnia Soenggoro's user avatar
3 votes

How to get all the owners from an NFT collection?

All other answers give valid suggestions. If you are interested in how to query directly from the smart contract, you can leverage ERC-721's ownerOf methods. This is a sample script base on web3JS: ...
Wuzhong - Chainstack DevEx's user avatar
3 votes

How to find total value in ETH of all NFTs owned by a user

If you like to get the user's NFT portfolio value, then you can use Moralis to provide you with such data. Simply sign up to Moralis to get the API key and install the SDK: npm install moralis Then, ...
Yoseph Kurnia Soenggoro's user avatar
3 votes
Accepted

Why am I not able to deploy ERC721 contract to Avalanche Fuji?

Solidity 0.8.20 introduced the PUSH0(0x5f) opcode which is only supported on the ETH mainnet and not on any other chains. That's why other chains can't find the PUSH0(0x5f) opcode and throw this error....
Zartaj Afser's user avatar
  • 2,215
2 votes

ERC721 Minting Randomness

I wrote a post using three different alternatives to create vrf numbers (Chainlink/API3 or Witnet). There is also a repo with the demo code. https://medium.com/coinmonks/schedule-randomness-with-...
donoso.eth's user avatar
  • 1,383
2 votes

ERC721 Minting Randomness

The best practice you can implement Is to use Chain Link VRF V2 , for creating randomness. It will help you to create pure random numbers. But remember it will cost you link token as gas-fee. Bcz ...
Umar Raza's user avatar
2 votes

my nft image not showing in opensea testnet

In metadata, you gave image attribute the wrong value (x.png). If you want Opensea to find your image you should provide a public uri to your image as the value. Usually you first upload the image to ...
Nal Luksic's user avatar
  • 1,069
2 votes

How to get all the owners from an NFT collection?

You can get all the owners of a collection using Moralis NFT API. Here is a tutorial step-by-step: https://docs.moralis.io/web3-data-api/evm/how-to-get-the-owners-of-an-nft-collection And this is an ...
Iulian Novenschi's user avatar
2 votes

Calling "balanceOf" in a contract from another contract that imports it. Expected 1 Got 0

The problem is how you defined instance of nft contract in constructor. Your Code: NFT public nft; constructor (NFT _nftAddress) public { nft = _nftAddress; } Try this instead: constructor (NFT ...
Alireza's user avatar
  • 350
2 votes
Accepted

I have an existing ERC721A smart contract deployed but how can I change public mint price and open that contract?

There is a function in your contract named updatePublicSalePrice(), which lets you update the price of your public sale. function updatePublicSalePrice(uint256 _newPrice) public onlyOwner { ...
Shubham Sharma's user avatar
2 votes
Accepted

Is it possible to track marketplace sales for an ERC721?

Here is an example code on how you can track NFT transfer events on a smart contract using Moralis streams API. import Moralis from "moralis"; const addStream = async () => { if (!...
JohnVersus's user avatar
2 votes
Accepted

When someone sends me a erc721, does my wallet actually receiving it?

Yes, the same happens with the ERC721, you simply become the owner of that NFT in the contract. As you can see in the contract below from OpenZeppelin, the transferFrom() function calls _transfer(). ...
0xheartcode's user avatar
2 votes
Accepted

The redundant `_from` parameter in the `transferFrom` function of an ERC721

Great observation on the _from parameter! I never noticed this before. Here are the two key reasons for its inclusion in the transferFrom() function in ERC-721: As you know, ERC-721 is strongly ...
Adam Boudj's user avatar
  • 2,331
2 votes
Accepted

Expected an event but reverts with reason `ERC721: caller is not token owner or approved`

This error happens because the owner of the token 0 must approve the NFT Marketplace and not the NFT contract. Change this line: await basicNft.approve(basicNftContract.address, TOKEN_ID) to: await ...
Adam Boudj's user avatar
  • 2,331
2 votes
Accepted

How is this solidity function calling another solidity function without referencing it?

mintSurfaceReacher function is called when you invoke requestRandomSurfaceReachT1 function is because the way API3 Airnode is configured to handle the requests. When request is made to API3 endpoint ...
Naveed Ali's user avatar
2 votes
Accepted

How to identify baseURI?

The baseUri would be the CID of the metadata folder. Your metadata folder contains the metadata of each image or NFT. And every metadata further contains the CID of the image. Thus, use the metadata ...
Shubham Sharma's user avatar
2 votes

No field for creator in ERC721?

There is no notion of original creator in the ERC721 spec. The creator could be considered the first person to mint a particular NFT, which you can get by looking for the Transfer event that had the ...
Travis Jacobs's user avatar
2 votes

How to get ERC 721/1155 and ERC-20 data?

You can get all the information you are looking for using Moralis API. Here is an example of getting all the NFTs using moralis. const Moralis = require("moralis").default; const runApp = ...
Iulian Novenschi's user avatar
2 votes
Accepted

Trying to get txn hash

You could use a WebSocket from a node provider to track the transfer event that all ERC-20 and ERC-721/1155 smart contracts emit when there is a token transfer. Check this example in ethers v6: const ...
Sahil - QuickNode's user avatar
2 votes
Accepted

Getting trading data efficiently

This data is not available readily on-chain, so it becomes difficult to get this kind of data. QuickNode has this data available via their Graph API You get historical NFT Trading data, marketplace ...
Sahil - QuickNode's user avatar
2 votes

How to retrieve all ERC721 tokens of a certain collection what a wallet ownes?

In order to do it without using the likes of Moralis. You need: An RPC node The contract address The wallet address The contract ABI Then you can write a function like this: async function ...
Filip's user avatar
  • 931
2 votes

Deploying a smart contract without private key

Short answer: You can't deploy on their behalf if you don't have their private key or their signed tx. You can achieve similar to what you describe by either one of the two methods: Two ...
minhhn2910's user avatar
  • 1,690
1 vote
Accepted

using image_data for opensea's metadata instead of image

Your assumption is correct; you don't need to encode more of the SVG, just the raw data. My only additional suggestion is to put everything on the same line, in case you edited the SVG manually, ...
Giuseppe Bertone's user avatar
1 vote
Accepted

Decoding logs of Approval event with web3js results in error

dev advocate at Chainstack here. When you retrieve the logs, you receive an array of different elements. Let's take the Approval event from an ERC-721 contract as an example since it's what you need. ...
Dave Dev Advocate Chainstack's user avatar
1 vote

What to choose between memory and calldata for parameter of type bytes?

If you wanna save some gas and you know that the parameter won't get altered along the way, you can use calldata. Otherwise, go for memory.
f22daniel's user avatar
  • 313
1 vote

How do Opensea competitors (like Blur) subscribe to new NFT for-sale listings?

They are likely using the OpenSea Stream API. There used to be public documentation for it, but the link now gives a 404. However, there is still the GitHub repository for it, it seems that it is ...
SanLeo461's user avatar
1 vote
Accepted

Is it safe to use ERC 998 now?

Not safe to use. Please see this page https://eips.ethereum.org/EIPS/eip-998 and the STAGNANT warning at top. This means there is no consensus on this protocol and it is very unlikely that if you ...
William Entriken's user avatar
1 vote

How to Check if an NFT belongs to an address in solidity using only the address of the NFT instead of the tokenId

If I understand correctly, you wish to get tokenId that belong to some owner? Most NFTs follow the ERC721 or ERC1155 standard, so you can check out which functions are supported here. TO sum it up, ...
Nal Luksic's user avatar
  • 1,069
1 vote
Accepted

Contract mints token id 0 ERC721A

NFTs always go from 0 and then usually to 9999. Take BAYC for example: https://opensea.io/assets/ethereum/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/0 But if you wish to start with id = 1, then theres ...
Nal Luksic's user avatar
  • 1,069

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