New answers tagged

0 votes

Where to find Uniswap contract addresses on Goerli testnet

Just set your wallet for goerli network, go to app.uniswap.org, click "Pool" and "+ New Position" - then you can see the available tokens - I see ETH, UNI and WETH and you can '...
user avatar
0 votes
Accepted

Is there sdk to create new account in Polygon through web3

You can do this: var ethers = require('ethers'); var crypto = require('crypto'); var id = crypto.randomBytes(32).toString('hex'); var privateKey = "0x"+id; console.log("SAVE BUT DO ...
user avatar
0 votes

Web3 error handling in React

Pasting my answer from S.O. here. Her's how I did it: For me, the "require" reason is there in the message property of the error object, but it is surrounded by lot of other words which I ...
user avatar
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('...
user avatar
  • 366
1 vote
Accepted

What is the complete beginner's road map for learning Web 3.0 Decentralized applications and writing smart contracts?

If you are already experienced start by reading about eth and solidity from official docs, you will get detailed roadmaps, lectures and guided projects through many options like these. ( There will be ...
user avatar
  • 24
0 votes

Claiming rewards in P2E game

A common approach to this problem is to have a backend service that will track each user state. When the user want's to mint its reward, the frontend send a request to the backend that will validate ...
user avatar
  • 29.6k
2 votes
Accepted

MetaMask - RPC Error: The requested account and/or method has not been authorized by the user

Before you make any requests to metamask, you need to first connect to metamask wallet and get the accounts that user authorizes. You can use this snippet const accounts = await ethereum.request({ ...
user avatar
  • 1,219
0 votes

How to generate solidity encode function signature from Javascript?

Here's what I used to crack the Ethernaut Puzzle Wallet level. I believe encodeFunctionCall is exactly what you're looking for: let deposit = web3.eth.abi.encodeFunctionCall(contract.abi[2], []) let ...
user avatar
  • 167
1 vote

Sign and send transaction (call contract function)

With ethers.js v5: create your smart contract instance const instance = new Contract(address, abi, signerOrProvider) or just the interface const interface = new ethers.utils.Interface(abi) encode ...
user avatar
  • 185
0 votes

web3py The method eth_getRawTransactionByHash does not exist/is not available

This method is not supported by the Infura API according to this thread in their forums https://community.infura.io/t/the-method-eth-getrawtransactionbyhash-does-not-exist/3821/2
user avatar
  • 33

Top 50 recent answers are included