16 votes
Accepted

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

Look at this post. EthersJS Listening to events with NodeJS Strange Errors Had the same problem few days ago, turned out to be problem with a beta release of ethers.js. The fix for me was to downgrade ...
Akall's user avatar
  • 463
14 votes

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

The newer version of Ethers seems to be unstable ethers 6.0.2... To solve this error downgrade your ethers version to 5.7.2 by going to your package.json "ethers": "5.7.2" now on ...
mish's user avatar
  • 141
11 votes
Accepted

Geth --rpcaddr doubt

--rpcaddr 127.0.0.1 starts the JSON RCP on the localhost network and only connections from your local machine reach the geth server --rpcaddr 0.0.0.0 starts the JSON RPC on all interfaces and any ...
Daniel Luca CleanUnicorn's user avatar
10 votes

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

I am using ethers version 6.2.3, You can directly import it from ethers package. const { ethers, JsonRpcProvider } = require('ethers'); For more info refer to this link https://github.com/ethers-io/...
Neeraj Walia's user avatar
9 votes
Accepted

Failed to get EIP-1559 fees error when deploying to ZkEVM polygon using Foundry

try to add suffix --legacy in forge script
TIROGEN's user avatar
  • 106
8 votes
Accepted

Difference between web3.eth.getCoinbase() and web3.eth.getAccounts()[0]

web3.eth.getCoinbase() returns the account that your mining rewards go to. web3.eth.getAccounts()[0] returns the first account you created (index 0) Web3.js doesnt expose this API (probably because ...
0xsegfault's user avatar
  • 1,260
8 votes

Single Call vs MultiCall

In some cases, you might need to gather synchronized data from the blockchain. A good example is querying token prices from Uniswap. You don't want to have the price for one token from block x and a ...
Ioana Roceanu's user avatar
7 votes
Accepted

GETH command --rpc

geth --rpc starts the rpc interface. The rpc interface is required to be able to connect with clients (websites, for example) that want to access the Ethereum blockchain. Use options --rpcaddress and -...
gisdev_p's user avatar
  • 1,801
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
  • 663
6 votes

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

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 ...
John Doe's user avatar
  • 133
5 votes
Accepted

What do these geth --rpcapi parameters mean: db and net?

db enables these functions: db_putString db_getString db_putHex db_getHex net enables these functions: net_version net_peerCount net_listening As stated in: https://github.com/ethereum/wiki/wiki/...
Nulik's user avatar
  • 4,061
4 votes

How to check Ethereum smart contract info?

For 1 you may use web3.eth.getCode(address) function of Web3 API. For contract addresses it returns contract byte code, while for non-contract addresses it returns something like "0x". For 3 it ...
Mikhail Vladimirov's user avatar
3 votes

How to get token holders via json RPC

In general you need support from the contract to be able to query for existing token holders. If the token is ERC-20 compliant then you can retrieve all Transfer events generated by the contract. ...
Ismael's user avatar
  • 30.6k
3 votes
Accepted

transactions in rpc block response sometimes have chain null and sometimes correct chain

ChainId can be considered to be derived from the signature of a transaction, as described in EIP 155 - in the case of all of these transactions, they have the previous transaction format, where ...
Joshua Mir's user avatar
3 votes
Accepted

MetaMask displaying wrong value when making RPC sendTransaction call

Value should be in hex format. Note: in some updated MetaMask installation, it seems the injected web3 has not the utils package anymore, so you may need to use web3.toWei instead. const myParameters ...
Giuseppe Bertone's user avatar
3 votes
Accepted

How to gather historical events emitted by any contract

Did you try using eth_getLogs. This is also exposed via the Ethers provider: https://docs.ethers.io/v5/api/providers/provider/#Provider-getLogs. The syntax for the parameter is the same as for ...
Richard's user avatar
  • 4,944
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

Is there a way to read hardhat config inside a script at runtime and console.log certain attributes?

If I understand correctly what you are trying to get in the updated part of the question, I think you can use hre.network.name, which is the name of the current network set in the config file that the ...
hellopeach's user avatar
3 votes
Accepted

Is there a way to read hardhat config inside a script at runtime and console.log certain attributes?

Great question; try something like this: Use hre.network.config.url; Here is an example of how you can get the RPC Provider URL at runtime in your deploy.js script: const hre = require("hardhat&...
Isaac Lau's user avatar
3 votes
Accepted

Looking for some good RPCs

Check out QuickNode https://www.quicknode.com/. There's a free lifetime plan. It's the fastest RPC provider. It gives you the lowest latency regardless of your location. Check out this blog post: ...
Sahil - QuickNode's user avatar
3 votes

What are the GraphQL API providers for blockchain data?

There are only a few customizable indexing solutions / frameworks (that include an instant Graphql API) that I've come across to query data for dApps or dashboards. There are also providers that re-...
svenno.lens's user avatar
2 votes
Accepted

go-ethereum rpc connection via http for native dapps

As discussed here, I think rpc.NewIPCClient is deprecated and replaced by rpc.Dial("****"). herefore, you can use : client = ethclient.Dial("http://*.*.*.*:8545"). From this example you'll find this ...
Badr Bellaj's user avatar
  • 18.8k
2 votes

How should I enable the api’s ‘personal’ and ‘admin’ over RPC on Azure ‘Ethereum Consortium Blockchain’

Below steps is what you need to do: 1. Open the SSH console for transaction node by running ETHEREUM-RPC-ENDPOINT Ssh script on powerShell. You can find the script on Azure portal, sthing like ...
Chinh Phan's user avatar
2 votes
Accepted

Parity web3 access for another user account on same server?

IPC-RPC API honors unix system users rights. You can control the IPC access via tools like chmod on the IPC socket. HTTP-RPC API is agnostic to the user account and should work for any users ...
q9f's user avatar
  • 32.9k
2 votes

How to get token holders via json RPC

Using QuickBlocks: https://www.youtube.com/watch?v=c_KNulh3PF4&t=2s to build a cap table of an ERC20 token.
Thomas Jay Rush's user avatar
2 votes

TypeError: Web3.providers.WebsocketProvider is not a constructor?

you need to wrap Web3 object inside {} const {Web3} = require('web3')
Nisarg's user avatar
  • 21
2 votes

TypeError: Web3.providers.WebsocketProvider is not a constructor?

I had the same issue with web3 v1.0.0 beta 30. Never got to the bottom of it but skipping the provider construction appeared to fix it: var Web3=require('web3'); var web3 = new Web3('ws://10.244.5.43:...
Linmao Song's user avatar
  • 2,357
2 votes
Accepted

rpc requests to geth on AWS instance

To connect to AWS instance via RPC you have to assign the public IP of that instance as the rpc address. geth --rpc --rpcaddr "Public IP of AWS" --rpcport "8545" --rpccorsdomain "*" console If it ...
Karthikeyan Thangavel's user avatar
2 votes
Accepted

How did MyEtherApi manage to disallow some methods (Parity)

Well, have been searching all day long. At last I tried posting the question on stackexchange and just 20 minutes later I seem to find the answer to my own question. https://github.com/paritytech/...
Billy's user avatar
  • 81
2 votes

Private Ethereum Node connection with Metamask

try to use the option : --nat value NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: "any") if your router supports upnp go for : --nat upnp
Badr Bellaj's user avatar
  • 18.8k

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