Questions tagged [web3js]

Javascript API and library for Ethereum To develop applications on Ethereum, you can use the web3 object provided by the web3.js library. Under the hood it communicates to a local node through RPC calls. web3.js works with any Ethereum node, which exposes an RPC layer. https://github.com/ethereum/wiki/wiki/JavaScript-API

Filter by
Sorted by
Tagged with
0 votes
2 answers
60 views

How do you return the market cap of an ERC20 token?

After an ICO, a token contract has essentially converted ethers into a token through the minting process. Once this token’s initial supply has been minted, how do you call the blockchain to return the ...
  • 345
0 votes
1 answer
33 views

How to get Publickey of metamask by Public address?

I want to get Publickey of metamask by Public address
1 vote
0 answers
55 views

How to solve this error MetaMask - RPC Error: The requested account and/or method has not been authorized by the user?

I used below code from account 1 on metamask to encrypt certain text let encryptionPublicKey; await window.ethereum.request({ method: 'eth_getEncryptionPublicKey', params: [account1], // you must ...
0 votes
1 answer
23 views

Please help me with this events error with HttpProvider

I have encountered this error while trying to put my oracle online. Please, help!
0 votes
1 answer
47 views

Not able to send transaction using alchemy sdk

Hey i have to build a ERC20 contract and using alchemy sdk to send transactions onchain For eg mint or burn tokens. But i am not able to send a transaction as its showing an error of cannot estimate ...
0 votes
1 answer
27 views

Impossible to edit returned result of web3 call() method

I'm trying to edit returned result from web3.js but getting the error: TypeError: Cannot assign to read only property 'fixtureId' of object '[object Array]' My react js code: let event = new web3.eth....
  • 103
0 votes
3 answers
38 views

Next Halving BlockChain BlockNumber?

Hello every hope all are good ? I'm asking where can you get the block halving number from a BlockChain ? Is there a way in web3 ? Can i find it in WhitePaper for each BlockChain ? Need i check block ...
0 votes
1 answer
41 views

Deploy contract to goerli infuria without signing the transaction

Is there a way to deploy a contract on goerli infuria, using web3.js and metamask so I don't have to sign the transaction, or is it possible to use metamask to sign it, without having to provide the ...
0 votes
1 answer
30 views

"before each" hook for "Initializes the NFT Correctly.": TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

Getting this error while basicNft test the error the test // We are going to skip a bit on these tests... const { assert } = require("chai") const { network, deployments, ethers } = ...
0 votes
0 answers
21 views

Gas errored in remix

HELLO I AM PRACTICING WITH SOLIDITY AND I HAVE A GAS ESTIMATION ERROR IN REMIX. SOMEONE GUIDE ME WHY THIS HAPPENS IN MY CONTRACT I WILL PROVIDE IT THERE PD: compiles OK // SPDX-License-Identifier: MIT ...
0 votes
0 answers
25 views

Adding A New account to Metamask using Web3.js

I want to create a new account for the user, add and display this new account in MetaMask. I have created a new account using : let walletWeb3 = await web3.eth.accounts.create(); and passed its ...
0 votes
1 answer
23 views

Converting checksummed address to non-checksummed address

I'm aware that the web3 library has the toCheckSumAddress method that converts an upper or lowercase Ethereum address to a checksum address. Am wondering if there is any method available that converts ...
1 vote
2 answers
25 views

Predict future gas price

I am wondering, is there a way to "predict" future gas prices? I would like to find a gas price or at least approximation of it for the future block, so the one that is currently pending.
  • 33
1 vote
0 answers
49 views

Ledger device: Invalid data received (0x6a80) #404

when i wanna transfer chainlink on goerli network with ledger i get this error: TransportStatusError: Ledger device: Invalid data received (0x6a80) contractAddress: ...
  • 11
0 votes
0 answers
57 views

Thirdweb error: Transaction was not mined within 50 blocks error

So I have this code: import { ThirdwebSDK } from "@thirdweb-dev/sdk"; import { ConnectWallet, useAddress } from "@thirdweb-dev/react"; export default function DonationPage() { ...
0 votes
1 answer
19 views

Checking web3 version metamask is using

I have installed metamask. When I open any page in the browser, go into the console and type web3 I can see that the object is present: > web3 Proxy { <target>: {…}, <handler>: {…} } ...
0 votes
0 answers
12 views

unexplained error on contract

My contract is reverting for a random reason and I cannot find out why. I have set a revert message to all my requires() but when I try to send a transaction via remix it does not work for a specific ...
  • 33
0 votes
0 answers
19 views

Show amount paid tokens in wallet

I build the contract as https://ethereum.stackexchange.com/a/110988/116380 But this way doesn't show the amount pay of ERC20 in metamask (mb others), how fix? Thanks!
1 vote
1 answer
17 views

Is there any less popular web3 development platform?

I want to try out some less popular web3 development platforms. Any suggestion? I have tried the following and that is all I can find online. Truffle Remix Hardhat OpenZepplin Ganache Tenderly
0 votes
0 answers
201 views

Connect Web3.js to Geth in Goerli Testnet

I am trying to connect to a Goerli node using geth in which I have deployed a smart contract via Remix. In fact I'm trying to call the function of this smart contract which returns a value for example ...
0 votes
1 answer
10 views

Adding chain to gnosis UI

I just followed steps to add new chain using this repo: https://github.com/safe-global/safe-infrastructure But when I click on Nothing happens. In order to bring up this safe-infrastructure and ...
0 votes
0 answers
11 views

How to detect payment and get contract information via Metamask using javascript?

I am writing a function for a Chrome extension, how can I retrieve information of the contract I am calling the payment function on (such as the contract address) each time I execute the payment ...
0 votes
0 answers
22 views

Change actual gasPrice for transaction

I'm using web3js & ethereumjs/tx I have some problem: get and calc gasPrice: fixedGasPrice = Math.round((await web3.eth.getGasPrice()) * 1.2); forming data for tx: const rawTx = { ...
1 vote
0 answers
17 views

Library package helps interact with Blockchain on the Ethereum platform (ETH, BSC, Polygon...) more simple and minimized

I am a Blockchain engineer and after 3 years of working with the EVM-platform I used many different libraries such as web3, ethers, ethereumjs-tx,... I realized they are so distributed and complex to ...
0 votes
0 answers
20 views

How to send funds from an address directly to another address without using the smart contract in solidity

I want to able to send funds from address A to Address B(A payable address) without sending it to a smart contract as the intermediary in solidity.
  • 1
1 vote
2 answers
31 views

Is there a foolproof way to determine if an address is a contract address or an EOA?

Is there any foolproof way to determine if an address is a contract address or a wallet address ? I searched across articles and stack exchanges but haven't found a satisfying answer .
2 votes
2 answers
60 views

ValueError: {'code': -32000, 'message': 'intrinsic gas too low'} how to resolve , see the code in body, looking for help

from web3 import Web3 infura_url = "https://goerli.infura.io/v3/<key>" web3 = Web3(Web3.HTTPProvider(infura_url)) account_1 = '0x0BD2c4B74c3DEcF804567eb91DF84F3fAcC6DE32' private_key1 ...
2 votes
1 answer
36 views

Convert IEEE754 quad precision float from bytes16 to a human readable decimal string

I have a solidity smart contract project that uses lots of floating point operations like Pow, ln, exp, etc, but I need more precision than normal 64 bit doubles. I am planning to use the ...
1 vote
1 answer
94 views

Decoding logs of Approval event with web3js results in error

I am trying to decode the Approval event of an ERC721 contract. I fetch the logs for the contract with the alchemy API and then try to decode them with web3js. The code looks like this: const logs = ...
  • 151
0 votes
1 answer
49 views

Ownable: New owner is the zero address

I'm trying to send USDT from my wallet to another wallet using web3, but I can't find the error here, I always end up sending BNB instead of the USDT that I have in my wallet. I've checked out ...
0 votes
0 answers
20 views

ECDSA not returning correct signer with Hardhat openzeppelin contract

So I have tried several things to get this to work. One of them being verifying the message in hardhat. Doing so did indeed return the correct value but the contract does not Contract: // SPDX-License-...
1 vote
0 answers
93 views

Set ethers provider to use any injected web3 providers

Using MetaMask provider to detect MetaMask as provider and Etherprojects provider to set provider. import { ExternalProvider, Web3Provider } from '@ethersproject/providers'; import ...
0 votes
1 answer
56 views

How to calculate price using getAmountsIn?

I have a function inside an arbitrage bot that is supposed to use getAmountsIn to determine the profitability of the trade. However, due to the current implementation, every single trade results in a ...
1 vote
1 answer
32 views

How to remove default Provider and allow users to choose?

Currently I have MetaMask installed in my chrome browser. And the dApp that I'm building uses the Ethereum provider by default. How can I not use it as the default Provider, and selects the Provider ...
0 votes
1 answer
21 views

Smart Contracts and Web3

Is it that when I use smart contracts for storing and retrieving data to and from blockchain, the smart contract automatically stores data in the next to be added block as well as runs through the ...
3 votes
1 answer
57 views

Swap 2 tokens directly with Pair, without Router

It is possible to swap tokens, interacting directly with the pair, and not with router? If it's possible I can receive an example (explanation, not necessarily the code) For example: Blockchain: ...
  • 131
0 votes
3 answers
89 views

SQL Querying ability using Blockchain

I am working on an application that can handle SQL queries for data stored in Blockchain. Currently I am using Smart Contract for achieving this as this allows me to store the data in a well ...
0 votes
1 answer
38 views

How can i build a bridge from scatch and of course a secure bridge which no one could hack it?

i want to know how bridge work because i want to work on my own bridge for a personnal project. Any good link for documentation and tutorial ? Thanks !
0 votes
2 answers
21 views

Is connecting a wallet to a website an on-chain action?

I am developing a crypto analytics tool and had this question in mind. When I connect a wallet to a website (let's imagine I connect metamask to Uniswap), is there anything that happens on-chain that ...
0 votes
0 answers
23 views

Please can anyone help me in converting this from Loom to Ethereum testnet?

I am trying to deploy this on Ethereum Goerli instead of Loom but do not understand what all to change. I am getting a lot of errors. Please, can anyone help me? Error Message PS C:\Users\VidhanMangla\...
0 votes
0 answers
5 views

create block hash from transactions in solidity and use for rollup chains

in a function of solidity, we pass all transactions, and block hash of a block of layer 2 blockchain aka rollup chain. now, i want to verify transactions via mercle tree to get block hash, and match ...
1 vote
3 answers
73 views

How to get all transactons of a specific address?

I am trying to retrieve all transactions for a particular address at once. My current approach is to collect all transactions of all blocks in MySQL DB and issue a query like "SELECT * FROM table ...
  • 131
0 votes
0 answers
108 views

Solidity project error with my deploy.js script

I cannot get this to work: npx hardhat run scripts/deploy.js --network localhost The deploy script returns: TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider') This is my ...
  • 3
0 votes
0 answers
14 views

RPC error happens often when connect metamask with change network

my dapp call change network function before connect metamask if network is not goerli network. however it makes rpc error often on ios metamask browser environment. i think mainpage shows data from ...
  • 5
1 vote
2 answers
48 views

How to use two defaultNetwork: in Hardhat.config.ts

Here's my hardhat.config.ts file { defaultNetwork: 'goerli', //////// here 'polygon_mumbai' networks: { hardhat: { }, localhost : { url : 'http://127.0.0....
0 votes
0 answers
12 views

Getting TypeError: unhashable type: 'list' when reading ABI json

Getting TypeError: unhashable type: 'list' when reading ABI json. Using Python 3.11 Can anybody help ? from web3 import Web3 import json abiStr = '[{"inputs":[],"stateMutability":&...
0 votes
0 answers
9 views

var web3 = new Nethereum.Web3.Web3(); Why does this not work?

It would seem that you can't get any more basic than this. But it does not work. It produces the error: 'Web3' does not contain a constructor that takes 0 arguments
  • 1
0 votes
0 answers
16 views

Web3.js metamask android contract function fails

const value = web3.utils.toWei(userBalance.toString()); const dETH = new web3.eth.Contract( dETH_ethAbi as any, config.goerli.addresses.dEth ); ...
  • 1
1 vote
1 answer
18 views

Price not showing in marketplace after minted from smart contract

We have created a fronted which require client to fill in name,description,price and attach an image. After mint, name, description and image able to display in Opensea created, but price not showing. ...
  • 117
0 votes
1 answer
31 views

Need help with solidity?

Hello everyone so Im building flashswap arbitrage program and I got stuck and cant figure out why maybe anyone has a solution : this is the code I have for solidity // SPDX-License-Identifier: ...