Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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
0 answers
19 views

Got metamask connection disconnect when sending a transaction

I am building a dapp with web3 and call smart contract running in sepolia testnet. I have below code to send transaction: provider.request({ method: 'eth_sendTransaction', params: [ ...
Joey Yi Zhao's user avatar
0 votes
0 answers
8 views

How to convert takerRate to readable value from 1inch API OrderBook?

I use 1inch API to get a list of order limits by the specific token. https://portal.1inch.dev/documentation/orderbook/introduction pair AXL/axlUSDC and I get a response something like that: [ { ...
red_space's user avatar
0 votes
0 answers
18 views

How to send entire account balance to another address on Base

The below code is what I used to transfer entire account balance to other address on the ERC20 network and it works fine on it, but not on Base. Maybe it's because Base has different transaction fee ...
Zero's user avatar
  • 103
0 votes
0 answers
35 views

Replacement fee too low, Base Sepolia

This is the code I have for sending a transaction on Base Sepolia. I am using this to split the balance in my account into two halves and sending each half to an address one by one. export async ...
Zero's user avatar
  • 103
1 vote
1 answer
107 views

How can I decode the output of the first call and use it to send a transaction?

I am attempting to call view function “0x…” with argument of value “3…” to a specific address “0x…” and also send X wei to that address I am looking to acquire the hash of the successful tx. Tools/...
QuantumDomain's user avatar
0 votes
1 answer
29 views

Get unknown account when sending transaction to ethereum testnet network

I am using web3 library to send transaction to Ethereum testnet network. Below is the code: const w = new web3(process.env.NEXT_PUBLIC_ETHEREUM_NETWORK); const transaction: Transaction = { ...
Joey Yi Zhao's user avatar
1 vote
0 answers
14 views

Currently I am on Lesson: 9 of PatrickCollins Course- Error: VM Exception while processing transaction: reverted with custom error 'InvalidConsumer()'

Could someone please help me understand and resolve the following error in my code? Error: VM Exception while processing transaction: reverted with custom error 'InvalidConsumer()' Here is the Raffle....
Hrithik's user avatar
  • 11
0 votes
0 answers
10 views

DNS using blockchain (how can i hashed my domain name ) in the code below help me to complete this code

import Web3 from "web3"; import Registry from "./contracts/Registry.json"; import Resolver from "./contracts/Resolver.json"; import Cache from "./contracts/Cache....
Zain Alramahi's user avatar
0 votes
0 answers
13 views

Facing this error "Error: transaction has been reverted by the evm, fail to send transaction"

This is my web console error: web3.min.js:22 Uncaught (in promise) Error: Transaction has been reverted by the EVM: { "blockHash": "...
noemotions's user avatar
1 vote
0 answers
28 views

Optimism Swap problem in Web3.py

Error in code when trying to swap from Optimism to usdt or usdc via Web3.py library I have code that swap successfully to Arbitrum, Polygon but error in Optimism. I am using MetaAggregationRouterV2 ...
patifon's user avatar
  • 11
0 votes
1 answer
32 views

Web3.js does not include extra data with the function?

I encountered a problem where the included hex data is not visible on the blockchain. Here's the code snippet I used: const tx = { from: wallet.address, to: to, chainId: 44445, value: ...
Toni Dev's user avatar
  • 155
0 votes
2 answers
47 views

uniswapRouter.getAmountsOut returns less value of token B than present in reverses when provide full amounts of token A

I have the next code to get familiar with uniswap mechanics: create pair contract get reserves invoke getAmountsOut and provide all UNI token reserves const pairAddress = await _V2Factory.getPair(...
dvcr's user avatar
  • 3
0 votes
0 answers
17 views

How find in bytecodes part of the code?

If with this code I can find the signature of a function in a solidity contract: const hash = Web3.utils.sha3(word).slice(0, 10).substring(2); How could I find another one? ex: assert(a == 0 || c / a ...
Cazs's user avatar
  • 1
0 votes
0 answers
35 views

How can I get private key from metamask when sending a transaction?

I am using web3 to send a transaction to smart contract in ethereum network. web3 library has a method web3.eth.accounts.signTransaction(tx, privateKey [, callback]); to sign a transaction but it ...
Joey Yi Zhao's user avatar
0 votes
1 answer
19 views

ethers read WETH allowance throwing call revert exception

I am trying to read the WETH allowance of an account on blast (blast.io). So far I have tried different ABIs but all of them result in errors. const WETH_ADDRESS = "...
sha237's user avatar
  • 1
0 votes
1 answer
27 views

Feeding a Smart contract with large Data

I want to feed a smart contract with multiple 5000 or more wallet addresses (for whitelisting purposes) in an array in a single transaction. How can I achieve that without sending data in chunks? ...
Bhushan Dhiware's user avatar
0 votes
2 answers
45 views

Is it possible to make an atomic transaction using web3.js only?

I am currently working on a project using web3.js that invloves making 2 transactions atomically. Is it possible to pass those 2 transactions in a single transaction object to make it atomic or is the ...
John's user avatar
  • 11
1 vote
0 answers
18 views

Solidity: getStudentNotifications Retrieves notifications to other metamask account instead of one metamask account

I have two metamask accounts, one is Vamshi (student) and Mike(University). I use Vamshi's account to call the function sendRecordsToUniversity and the university address, I use here is Mike's. so the ...
Robert Downey Jr.'s user avatar
0 votes
1 answer
35 views

How to transfer entire address balance to another address

After going through the questions here and here I came up with the code below to transfer the entire balance from one address to another using web3.js. export async function sendTransaction( ...
Zero's user avatar
  • 103
2 votes
3 answers
67 views

How does Etherscan decode unverified contracts events?

Etherscan is able to decode event data from unverified contracts, even without an exposed ABI. Below is an example screenshot. No signature available for this event. I've been able to replicate the ...
user130657's user avatar
0 votes
1 answer
24 views

Etherscans ABI and transaction receipt topic[0] are different. Bug?

I need simply to get Transfer data values from transaction with 1 log https://etherscan.io/tx/0x6465187a7bb43a6db42ee63e5f5cc30fb094393957a7f1ce6c08b5afddf3e0bc. It sends +7,601.747 LINK. The problem ...
sirjay's user avatar
  • 121
0 votes
1 answer
48 views

InvalidResponseError: Returned error: unknown account

I'm attempting to sign a transaction using an account stored locally on my system. In the code below, you can see that I'm reading the file of that account and all other accounts stored using the ...
Alireza's user avatar
  • 547
1 vote
1 answer
142 views

Web3 Contract (React) - SafeERC20 Low Level Call failed with ERC20 Token (USDT)

I am working since 8 days on a problem with my smart contract and / or with my Web3 App. If I try to use the contract with ETH it works well in the moment I try to use it with an ERC20 token (USDT) it ...
Aleksandar's user avatar
1 vote
1 answer
83 views

Cannot send USDT on Polygon : Error happened while trying to execute a function inside a smart contract

//token_address is the adress of the contract : 0xc2132D05D31c914a87C6611C10748AEb04B58e8F //because USDT on polygon is a Proxy contract, minABI is the abi of the contract where it redirect : https://...
Francois's user avatar
1 vote
1 answer
30 views

How to integrate a web3 browser in my crypto wallet expo app

I have created a crypto wallet using Expo and now want to integrate a web3 browser like they have in metamask or trustwallet. i don't know how to start, any guidance or article or help will be highly ...
Shivam Yadav's user avatar
0 votes
1 answer
23 views

Transaction fees too high for swapExactETHForTokens

I've written a script to buy tokens in javascript. The issue is I keep getting an error showing abnormally high transaction fees. This is my script const buyFunction = this.pancakeContract.methods....
ahabsy's user avatar
  • 1
0 votes
0 answers
38 views

Swapping tokens with code

how do I swap tokens using java script in pancake swap v3 I'm looking for source code but not finding it anywhere
RichMond's user avatar
1 vote
2 answers
28 views

How does the real Ether work in ERC20 protocol?

I am reading ERC20 protocol and learning how that is implemented from OpenZeppelin: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol The code demoed ...
Joey Yi Zhao's user avatar
0 votes
1 answer
20 views

Why is the gas fee shown on Ether scan is different than the transaction I sent?

I sent a transaction to Ethereum test network sepolia as below code: const transaction = { from: account.address, to: contractAddress, gas: 202419, ...
Joey Yi Zhao's user avatar
2 votes
1 answer
109 views

How to get revert message in Web3js?

I want to get the revert massage from a send method call to a smart contract. So I use: receipt.logs[0].data that is a string containing a hexadecimal value. Now I want to to decode this value to get ...
Alireza Zojaji's user avatar
0 votes
1 answer
15 views

Metamask Mobile problem

code: if (!$metamask.states.connected || !connectedAddress.value) { errorMessage.value = 'Please connect your wallet first.'; showModalError.value = true; return; } let ...
brok 3's user avatar
  • 1
0 votes
0 answers
12 views

Unhandled Rejection (Error): ENS is not supported on network private

Unhandled Rejection (Error): ENS is not supported on network private l.<anonymous> /packages/web3-eth-ens/lib/ENS.js:481 478 | if (!this._detectedAddress) { 479 | var networkType = await ...
Nishant Patil's user avatar
0 votes
0 answers
32 views

The 'myEvent' is not being set in the getPastEvents function of web3.js

I am using "web3" : "4.5.0" I am trying to use the getPastEvents function in accordance with the official documentation of web3.js to view the emitted events for a specific event. ...
권승미's user avatar
0 votes
2 answers
74 views

Send a transaciton to Sepolia network but it can't be found from `sepolia.etherscan.io`

I am using below code to call a smart contract deployed in Sepolia network. const w = new Web3('https://rpc.sepolia.org'); await w.eth.accounts.signTransaction( { from: ...
Joey Yi Zhao's user avatar
0 votes
0 answers
38 views

Etherscan API doesn't return internal transaction (although it has)

Here is transaction https://etherscan.io/tx/0x33e0dab83aa27ba8b2a08b3c69d61a34911a4adb6e7a35dd30cf11383f43fcc3 with simple Transfer() some GALA tokens. Etherscan shows 1 internal transaction: But it'...
sirjay's user avatar
  • 121
0 votes
1 answer
39 views

Does subscribe("newBlockHeader",...) consistently provide the header of the most recent block?

Assuming we are trying the blow code that subscribes to incoming block headers and returns the header of the i-th block in the ledger, triggering the execution of the callback function in then(). If ...
Alireza's user avatar
  • 547
1 vote
1 answer
203 views

how to get project id from infura

import { createAgent, IResolver } from '@veramo/core' import { DIDResolverPlugin } from '@veramo/did-resolver' import { getResolver as ethrDidResolver } from 'ethr-did-resolver' import { getResolver ...
Lebusetsa Moorosi's user avatar
0 votes
1 answer
49 views

Why Etherscan's API missing ABI functions?

Here is transaction https://etherscan.io/tx/0x0db6f8036ca7ea58bf4a8799bbf62bb30e3431d644d37d4030c27ac0d22f7542#eventlog In logs we can see 3rd function SendToInjectiveEvent(). It is interaction with ...
sirjay's user avatar
  • 121
0 votes
0 answers
53 views

How to get service fee when deploying smart contract (Web3.js)

I am trying to get service fee from every contract deployment on my website frontend, when I run this, the contract is being deployed to testnet successfully but the amount I specified in 6th argument ...
Nah Bulursun's user avatar
1 vote
1 answer
54 views

What is the metamask algorithm for creating accounts based on one seed phrase?

Metamask uses one seed phrase to generate other accounts. Thus, with one seed phrase you can restore all accounts. But what is the algorithm for this? I want a script that could show 10 of my accounts ...
Илья Зелень's user avatar
0 votes
0 answers
174 views

MetaMask Gas Estimation Error in Staking dApp: "We were not able to estimate gas" without Sufficient Native Tokens. Big gas fee

I'm developing a staking dApp and have encountered a peculiar issue with MetaMask when attempting to execute transactions without sufficient native tokens in the wallet. MetaMask displays the error ...
Nikola Skadric's user avatar
1 vote
1 answer
374 views

How to fix error with deploy my Next.js project?

I have my project that I want to deploy to Vercel but when I'm trying to deploy it I got error Failed to compile. ./node_modules/@wagmi/core/dist/esm/actions/getProof.js Attempted import error: '...
Victor's user avatar
  • 45
1 vote
0 answers
24 views

Represent UUIDv4 string as bytes16 in event topic

I am trying to emit an Event with UUIDv4 indexed string. Example contract: contract EventEmitter { event ExampleEvent(string indexed id); function dispatchEvent(string memory _uuid) public { ...
Marcin's user avatar
  • 111
1 vote
1 answer
28 views

How do i read sales here?

I've been trying to read the sales in this transaction. Tried to read "Execution721MakerFeePacked" event But could not understand anything from it. Tried seeing what NFTs got transferred and ...
Ladybug's user avatar
  • 11
0 votes
0 answers
20 views

There isn't fail reason when the transaction failed to execute with Web3.js 4.x

Environment OS: Ubuntu 20.04 Node: v18 Web3: 4.4.0 Code Snippet Solidity function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ...
george huang's user avatar
0 votes
0 answers
84 views

eth_sign invalid "from" address in signature in Trust Wallet browser extension or 0 balance when user has money

Problem I have code for sending 1 dollar from user to my account. It always works for all wallets except the trust wallet extension (trust wallet mobile works also). When I watch the result ...
noofdmsl1987's user avatar
1 vote
0 answers
94 views

Web3 Provider not available. Use `.setProvider` or `.provider=` to initialize the provider

Modified today Viewed 2 times 0 Hi i cain't get my code to work as it use to a few months back and I caint figure out why can anyone support I appreciate it, I tried a few things but none worked. I ...
David Dacruz's user avatar
1 vote
1 answer
40 views

How to get signature by JS with contract use ECDSA verify

I want get signature by Javascript
ltt88's user avatar
  • 23
0 votes
0 answers
24 views

Fail with error 'Incorrect Ether amount'

I am trying to set up a very basic presale using Remix IDE. 0x96AAC35C248C48418eF9A939e3eB8b9a64207532 --> Presale Contract 0xF60EeA9ab4B520846CA01D368A08cD4b71B619f8 --> Token itself This is ...
Jim Mike's user avatar
0 votes
0 answers
9 views

Calling function from smart contracts after connection using connectWallet SDK react native

I have connected my react native app to metamask using wallet connect sdk now I want to call functions from a smart contract which is deployed on the binance test net. I was thinking I could achieve ...
user130561's user avatar