Issue with getting web3.eth.accounts (MetaMask)

My MetaMask is enabled, but in console I see empty array image here, also when I tried console.log(web3.eth.accounts[0]), it returns undefined. But when I'm using console.log(web3.eth), I see in...

npm install web3 Install fails´╝Ü undefined ls-remote

Installation Environment win7 64bit I:\nodejs>node -v v10.13.0 I:\nodejs>npm -v 6.4.1 I:\nodejs>npm install web3 npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise...

What hash encryption algorithm does web3 use? ethereumjs-util Sha3 returns different result

I'm trying to properly sign an authentication method through web3's signPersonalMessage function. However, eth-sig-util's package which correctly authenticates does not produce the same hash with...

Cannot fix "Unexpected token name «i», expected punc «;»" from UglifyJs

I have created a react app with a custom next server server.js: const { createServer } = require('http'); const next = require('next'); const app = next({ dev: process.env.NODE_ENV !==...

web3 gives " Error: Returned error: invalid sender" when broadcasting transaction

I am new to web3 and ethereum blockchain. I tried broadcasting a transaction using the following code but it always gives me an invalid sender error.The sample code is shown below. const Tx =...

How to connect ethers.js with metamask?

I am using the ethers.js documentation: https://docs.ethers.io/ethers.js/html/cookbook-providers.html . I am getting the error when setting up the provider -: Uncaught ReferenceError: web3 is not...

Unable to call contract function from web3 with big number as parameter

Hi I am trying to call a custom function of a contract that expects a parameter of unit256. Im calling this function from web3 with this value as parameter: 10000000000000000000 (10 with 18...

Add liquidity to Uniswap pool with Web3

I am trying to add liquidity to Uniswap on the Ropsten network using Web3. My JavaScript code is as follows: (async () => { console.log("account: ", this.state.account); const...

Compute uniswap pair address via python

I`m trying to compute (off-line, i.e. without an http requests) address of an Uniswap pair, with python, web3 and eth-abi libraries, based on this solidity example. address factory =...

How to properly use revert reason in web3.js to show meaningful error message in UI

I want to use web3.js to show revert reason to user, for example in the case of user trying to mint erc721 token that has already been minted. I am using try catch block and see the error message...

Web3.py - Unable to import 'web3' even though web3 is installed

I've installed web3 today via pip install web3 and since then I've been trying to import web3 into the current working file without any success. No matter what I do, I get "Unable to import...

Fetch all NFTs owned by wallet address with web3.js

I am new to blockchain. I have done a little bit research and here's my steps to fetching a list of NFTs owned by certain wallet with web3.js balance =...

Composer install suddenly fails because of symfony/flex

I'm having this problem out of the blue. I didn't change anything in composer and it ran just fine up until last week. Now when I run composer install I get this at the end: Generating autoload...

Function invocation failed due to no matching argument type. web3.py, Python

I'm trying to swap tokens using swapExactTokensForTokens() (Pancakeswap Router function). Here is my code def swapTokens(): amountIn = (w3.toWei(0.00001,'ether')) amount1 =...

How to Logout of MetaMask account Using web3.js

I am using MetaMask for sending transactions to contract in my DApp. I need help in How to Disconnect MetaMask account from my DApp when the user clicks on logout button. Front-end:...

Access ContractFactory in web3-react

I'm using [email protected]^5.0.5 to interact with web3 from my react app. I can connect to metamask just fine. I set the library to ethers.js and connected to metmask. Connecting worked fine, but...

transaction underpriced in BEP-20 Token transaction

I had do some transaction in Binance Smart Chain in Binance-Peg BUSD-T and it worked successfully. But after 5 transactions. I face to a problem that said Returned error: transaction underpriced !...

How to trigger change blockchain network request on MetaMask

I am using web3 for my first dapp test and I'd like to make so MetaMask will prompt the user to change the network to Binance (BSC) network if it is not selected already, just like here: How to...

how can I use top level "await" in typescript next.js

When I use "await" on top-level like this: const LuckyDrawInstance=await new web3.eth.Contract(abi) I got a warning on the terminal: "set experiments.topLevelAwait true". When I tried to add...

Web3 ExtraDataLength Error on the Binance Smart Chain using python

I'm trying to pull the transactions that took place on a specific block, and I get stuck here: from web3 import Web3 bsc = "https://bsc-dataseed.binance.org/" web3 =...

Exception has occurred: Error Non-hexadecimal digit found in python

I am getting this error tried every thing also search in google but cant understan what i am doing wrong even i am getting my connection true , balance from wallet but when ty to buy getting...

bsc get transactions by wallet address Web3.py

How can I track tokens transactions of a list of wallets in the bsc network? I think about using websocket and filter function. I think it's possible to use the topics as a part of the filter...

Web3.js returned error: execution reverted

I'm new to blockchain programming and web3 and I don't really understand the error. I'm trying to call a function from my smart contract (on BSC test net) Function is called getRandom app.js const...

Detecting new PairCreated events on Polygon blockchain with Web3 and Python

I'm trying to make a program that continuously detects new tokens on the polygon blockchain as soon as liquidity has been added (PairCreated event). Below is the main section of the code. I am...

How can upload metadata json to IPFS by javascript codes and how can programatically mint this URL by frontend

I start study NFT based on IPFS project flow is 1- install IPFS 2- upload asset photo by IPFS and get hash 3- create metadata json file by this hash url { "name": "NFT", "description":...

how to use webpack and web3 in react?

Hello I've just started a new react app from skratch. I followed instructions at https://medium.com/age-of-awareness/setup-react-with-webpack-and-babel-5114a14a47e9 this is my package.json file { ...

Solana - How to get the balance from my Phantom wallet?

I'm currently working on a web app that can connect to Phantom Wallet. I've established the connection and have successfully retrieved the wallet's public key. The problem is, I can't seem to find...

How to get Solana Account Info and-or SOL Balance using Vanilla JS and JSON-RPC via Phantom wallet integration?

The following Vanilla JS example connects to and disconnects from the Solana blockchain via Phantom wallet. It successfully connects and gets the public address. It fails when trying to use a...

Uncaught TypeError: Cannot read properties of undefined (reading 'getidentificadors_contadors')

I am making a dapp of registration of an energy community using a server emulator and a blockchain emulator (ganache) together with Web3 js library and solidity. In the index.js, when quoting and...

Compute the LP Address of a token pair using web3.py

I just found the snippet below after searching the net. What I wanted to accomplish is get the LP Address of a token pair. I basically wanted to know the LP Address of a token. from web3 import...