New answers tagged

0

Reading JSON Files is supported directly. In my Nodejs Express App I loaded the contract: // Load Contract var fs = require('fs'); var jsonFile = "abis/abi.json"; var abi = JSON.parse(fs.readFileSync(jsonFile)); // Contract var contract = new web3.eth.Contract(abi, "0x068_your_address");


1

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 eth_newFilter.


0

You could try getBlockTransactionCountByNumber RPC method to get the number of transactions in a block. You can query Infura (or any other RPC provider) for each block that's been minted and create an aggregate. Or you can also get other block details too, like timestamp using getBlockByNumber method. It contains the list of all the transactions included in ...


0

Check web3.eth.getChainId(). You find the documentation here: https://web3js.readthedocs.io/en/v1.2.4/web3-eth.html#getchainid Also there is an EIP-1193 event in WalletConnect that tells you when the chain has been changed: https://docs.walletconnect.com/quick-start/dapps/web3-provider#events-eip-1193


0

Ethers it's pretty similar to web3 regarding getTransactionCount. Reference await provider.getTransactionCount('ricmoo.eth'); // 26 Using the "pending" switch you can get the number of non mined tx for that address await provider.getTransactionCount('ricmoo.eth', 'pending'); // 2 Beware though: it's quite unreliable. The pending blockTag is not ...


1

This is what I would do: I would run a local fork of mainnet using hardhat node provider_url and do the transaction there, while capturing the events and reading the state changes that resulted afterwards.


0

Failed transactions are also part of the Ethereum blockchain. This is because even for failed transactions a gas fee is paid. This fee payment is a state change and needs to be kept track of in the blockchain. If a transaction would fail because the fee payment cannot be made or the nonce is not in order anymore, then the transaction will not be included in ...


1

As it seems, these are probably the addresses owned by the RPC node. They change because I probably constantly hit different actual nodes behind the loadbalancer


1

This happens because eth_getTransactionCount returns the nonce of mined transactions but not the pending ones. So in your case, under heavy load, there will be some transactions that are still pending but not counted by calling eth_getTransactionCount. I've been looking for a solution for this problem but I haven't found an official one. However, you can ...


Top 50 recent answers are included