Hot answers tagged

9 votes

Trying to understand the difference between trace_call and debug_traceCall methods

API methods trace_* namespace was originally used in the openethereum client (which is currently unmaintained), some other clients such as erigon also provide this namespace. While debug_* namespace ...
hack3r-0m's user avatar
  • 1,909
4 votes
Accepted

StateDiff in trace_call report invalid balance

Alchemist here. Thanks for asking the question! We've checked your queries internally and it seems these responses are coming directly from our Ethereum client. So the incorrect numbers are not due to ...
A. Gupta's user avatar
  • 308
4 votes
Accepted

window.ethereum.isConnected() always returns true

window.ethereum.isConnected() not refers to connection about user account! In details, this function refers if the provider can make RPC requests to the current chain. From documentation: Note that ...
Antonio Carito's user avatar
4 votes
Accepted

How to use the alchemy api on a local hardhat node?

You can't use Alchemy as your local hardhat node. There are a lot of things that Alchemy does, but it would have a really hard time indexing your local hardhat chain, especially since it doesn't have ...
Patrick Collins's user avatar
4 votes

Trying to understand the difference between trace_call and debug_traceCall methods

trace_call is an API method that allows you to execute the given call and returns the number of possible traces for it. These traces include transactions that have been mined or hypothetical ones not ...
Yongjian P.'s user avatar
  • 4,140
3 votes
Accepted

How Can I Connect Alchemy as a Custom RPC Node Provider in MetaMask?

First, you'll need to sign up for an Alchemy endpoint, and hit "create app". Set it up as a polygon network. Once up, you can click on the app and hit "view key" to see the HTTP ...
Patrick Collins's user avatar
3 votes

ethers contract call for value of state variable reverts with "missing revert data"

In case anyone comes across this trying to hunt down a reason for "missing revert data in call exception" in this case it was the result of calling a function that existed in the ABI I was ...
GGizmos's user avatar
  • 741
3 votes
Accepted

When trying to deploy a smart contract, I keep getting `Error HH100: Network ropsten doesn't exist` -- how do I resolve?

This hardhat error happens when you are trying to interact with a network that is not defined in the config file. Specifically, because you are using the --network ropsten flag, the config file ...
thatguyintech's user avatar
3 votes
Accepted

Web3 Chainstack Guide to Batch Transactions gives Error: This contract object doesn't have address set yet, please set an address first

new versions of web3js have been released with changes in the API so you have to make sure to run the code in the article with the specific versions. On the other hand, we've released an updated ...
Antonio U's user avatar
  • 649
3 votes

Fetch last 10 blocks using Alchemy Transfers API

Alchemist here 💙 To fetch all NFT mint events within the last 10 blocks, you can use: ethers.js to fetch block num, and then use the Alchemy getAssetTransfers request to search "erc721" ...
thatguyintech's user avatar
3 votes
Accepted

How to instantiate contract instances with ethers.js and alchemy-sdk

Try this example of using the alchemy-sdk to connect to eth mainnet to load a contract instance. I think the key difference is that you should use await alchemy.config.getProvider() instead of what ...
brady-alchemy's user avatar
3 votes
Accepted

Does Alchemy "getAssetTransfers" get all transactions or just all asset transfers?

Heya 👋🏼 Full disclosure: Alchemy Developer Advocate speaking :) getAssetTransfers gets all transaction types that you specify in your query, including "transactions even if no value is sent&...
thatguyintech's user avatar
3 votes
Accepted

If `provider` is essential in communicating with the blockchain, how is this following code working?

Acutally, when you running the script by hardhat command, it's automatic assigned by a provider into your erc instance contract. You can check it inside erc.provider For example npx hardhat run ...
CT95's user avatar
  • 343
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
2 votes

Alchemy - replacement transaction underpriced

Polygon's Bor client (currently a modification of Geth) uses the same default value setting for replacement transactions that you can view here. What this means any Polygon node running in the default ...
Ake's user avatar
  • 1,099
2 votes

web3.eth - getBlock FetchError: request to https://eth-mainnet.g.alchemy.io/v2/api_key failed, reason: getaddrinfo ENOTFOUND eth-mainnet.g.alchemy.io

this is the code you can run in web3.js. In this case this is eth_getBlockByNumber. var Web3 = require('web3'); var node_URL = 'CHAINSTACK_NODE_URL'; var web3 = new Web3(node_URL); web3.eth.getBlock('...
Dave Dev Advocate Chainstack's user avatar
2 votes

How to get detailed error message from Alchemy using ethersJS

If you're using ethers.js, you can use ethers-decode-error to handle the detailed error message in your frontend quite easily. Install ethers-decode-error: npm install ethers-decode-error --save And ...
toybox's user avatar
  • 71
2 votes

How to instantiate contract instances with ethers.js and alchemy-sdk

instead of passing alchemy.core, pass return value of this const ethersProvider = await alchemy.config.getProvider() final: const CompoundorContract = new ethers.Contract( CONSTANTS.ADDRESSES....
0xbeny's user avatar
  • 193
2 votes

window.ethereum.isConnected() always returns true

the problem is you are only toggling once in the if-statement (if: true / isConnected = true) but not the other way around (isConncted = false) does not trigger toggleConnect. In effect, you are just ...
AirUp's user avatar
  • 363
2 votes
Accepted

What do I need to consider to choose Ethereum Client?

Hi dev advocate at Chainstack here! Answer to question 1) Geth is definitely the most used for now. There are a few reasons why. Still, the main one is that Go Ethereum (Geth) is the official Go land ...
Dave Dev Advocate Chainstack's user avatar
2 votes
Accepted

Etherscan sends back garbage values through API for the same query that works on the website

The problem is that the address 0xc6845a5c768bf8d7681249f8927877efda425baf is the proxy bytecode contract. It doesn't store any data. To make it work you have call ...
Ismael's user avatar
  • 30.5k
2 votes

When I try to deploy my smart contract to the goerli network, nothing happens

I would have just commented to the original question, but I do not have enough reputation to comment. I have experienced the same issue. Lately the Goerli network is super busy in US day time and it ...
Ra Murd's user avatar
  • 43
2 votes
Accepted

Getting NFTs of an address in a specific collection

(1) Get all the NFTs of an address owned within a specific network by ( You have to do the network configuration earlier ): await alchemy.nft.getNftsForOwner(address) (2) Then store the response ( It'...
Sina Rahimi's user avatar
2 votes
Accepted

Can someone explain me providers and the different types of it?

The main difference between then is the infrastructure they use to connect to the Ethereum network - they also offer different features. Think of them as different services that will allow you to ...
timsntech's user avatar
  • 618
1 vote

Unable to mint an NFT with new contract,. Error: 'Returned error: execution reverted: Ownable: caller is not the owner'

Hi dev advocate at Chainstack here! The mintNftfunction has the onlyOwner modifier declared in it. This means that that function can only be called by the owner of the smart contract, which is the ...
Dave Dev Advocate Chainstack's user avatar
1 vote

Get all Nfts of a collection owned by a wallet using alchemy sdk

alchemy sdk changed something and so if you need, you can add pageKey to your sdk parameter. ... alchemy.nft.getNftsForOwner("0xshah.eth", {pageKey: '88434286-7eaa-472d-8739-32a0497c2a18'})....
Forest 1's user avatar
1 vote

Get all Nfts of a collection owned by a wallet using alchemy sdk

getNftsForOwner() accepts two parameters: owner and options (optional). Try passing any extra params as an object for options Getting only nfts of a certain contract for an owner would look something ...
DanInTheD4rk's user avatar
1 vote

Why use node providers? Is it necessary to use them for small project?

Overall running your node is very labor and resource intensive, especially for a small project. You'll end up spending thousands for the hardware and weeks to sync up a new node. This article about ...
Dave Dev Advocate Chainstack's user avatar
1 vote

Im trying to deploy contract on Polygon Mumbai but cant

Found the solution. If your deploy script's (in hardhat-deploy atleast) gas limit is higher than the network's block gas limit then you will receive that error.
MaximilianFullStack's user avatar
1 vote
Accepted

Does an ERC721A mint call count as a "external transaction" or a "token transfer" (on etherscan)?

The semantics of Alchemy Notify for address activity are that it matches on the from/to address of the given category to the address you are subscribed to. In this case, you are subscribed to events ...
omarsayha.eth's user avatar

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