Skip to main content

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
1 answer
25 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
54 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
29 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
29 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
231 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
19 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
41 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
115 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
44 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
  • 103
0 votes
1 answer
70 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
  • 567
1 vote
1 answer
513 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
56 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
  • 103
0 votes
0 answers
56 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
68 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
255 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
543 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
28 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
31 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
22 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
101 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
118 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
63 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
25 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
0 votes
0 answers
31 views

How to sign transaction for two usdt receivers (same sender)?

I have a working code for creating a signed USDT transaction using web3js, but I am not successful in adding another receiver in the same signed transaction. How can I send USDT to two separate ...
CryptoCoder's user avatar
0 votes
0 answers
16 views

How to generate new Breed NFT Image?

How do I use two NFT images to create a new NFT through breeding? I'm a bit confused about this. I've used different attributes for coverage. now I want to generate the image as well. For example, if ...
Maidi's user avatar
  • 121
0 votes
0 answers
92 views

Creating a signed transaction USDT / matic

I want to create a signed transaction that sends USDT to two different receivers, using MATIC. I have a polygon node working (from Alchemy), but I am currently stuck on this error: ...
CryptoCoder's user avatar
0 votes
0 answers
17 views

Declaration "ERC721" not found in "c:/Users/

//SPDX-License-Identifier: Unlicense pragma solidity >=0.8.0; import {ERC721} from "@openzeppelin/contracts/utils/Counters.sol"; // i get error in this line import {ERC721} from "@...
Royhan Nulloh's user avatar
0 votes
1 answer
302 views

Subject: Facing "TypeError: invalid private key" during deployment

Description: I'm encountering an issue while attempting to deploy a contract using ethers.js. The error message I'm receiving is as follows: Error: TypeError: invalid private key (argument="...
Amine Merad's user avatar
0 votes
1 answer
43 views

Return value of contract function in web3 is array, not uint

I am working on the ethernaut game to learn about solidity and the ethereum ecosystem. I solved the Fallback problem, but don't understand the interaction below. The basic question is: the contract ...
kasterma's user avatar
  • 103
0 votes
1 answer
44 views

Possible to get latest NFT from a collection with web3.js?

I want to show the most current NFT from a collection on a website. Is this possible with web3.js? I have a working example how to load all NFTs from a collection which are owned by a certain wallet ...
aronsommer's user avatar
0 votes
1 answer
168 views

Token Balance not changing after simulating swap on uniswap v2

Hi I am trying to mock the process of buying and selling token through uniswap v2 router. I start with a local network fork anvil --fork-url https://mainnet.infura.io/xxx Then I have to do 2 things ...
newbiesolidty's user avatar
0 votes
0 answers
116 views

ResponseError: Returned error: err: insufficient funds for gas * price + value

=====USING=== Sepolia Testnet, metamask, web3js and walletConnectModel =====ERROR=== sendSignedTransaction error: ResponseError: Returned error: err: insufficient funds for gas * price + value: ...
Rommer 's user avatar
0 votes
0 answers
22 views

How can I get strategy of the Linea-Goerli with the vault address?

Like in mantle, we can get the strategy and the contract by navigating to the site https://explorer.mantle.xyz/address/{} How can I get the same for the line I have tried the https://explorer.goerli....
Lakshay khattar's user avatar
0 votes
1 answer
86 views

Getting EVM error when trying to call a basic contract using Javascript

I am a complete beginner when it comes to writing javascript so bear with me. I want to write a basic .js file that I can run that will be able to sell something for BNB (in this case a very small ...
Jewbacca79's user avatar
0 votes
0 answers
19 views

analysing a wallet on a specific contract (web3js/ethers)

is it possible to obtain the transactions of an eth address on a given contract (nft)? at the moment the os API does not allow this, or rather, I would have to iterate over all wallet transactions ...
klok's user avatar
  • 1
0 votes
1 answer
277 views

python web3 account sign_message with nonce

I want to sign message for login dapp, The message is like "Welcome !" and have Nonce. How can I using sign_message function with nonce? In the Metamask show like below.
정승원's user avatar
0 votes
0 answers
48 views

Use erigon to retrieve all transactions for a specific address

Is it possible to use erigon to retrieve all transactions issued or received by a particular address at once? If so, I would like to know how to do it, for example, using the javacript library (web3....
Pierogi's user avatar
  • 203
0 votes
1 answer
107 views

Differentiate a swap and normal transfer on erc-20 token transaction

Hey i’ve been following this guild (https://stackoverflow.com/questions/67998154/how-to-calculate-the-total-volume-transacted-for-a-token-on-rsk) in the ✔️ answer section to calculate the volume for ...
irregular's user avatar
0 votes
0 answers
107 views

Pancake swap v3 exactInputSingle fails without reason

Im trying to make swap on PancakeSwapRouterV3(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4) with web3js using method exactInputSingle. With v2 version i could do this with swapExactTokensForETH method ...
Szedou's user avatar
  • 1
0 votes
1 answer
61 views

Why is contract deploying, but giving an error on console

So I'm using ganache client and deploying the contract. I can see the contract on ganache and also the transaction. But on the console I'm getting following error: ... code: 'UNKNOWN_ERROR', ...
MySti's user avatar
  • 1
0 votes
0 answers
11 views

console.table return undefined and can't show value returned from a function?

Hello everybody hope all is good ? I need help please, I have 2 functions : 1st return a value after fetching and url(api) and 2nd it log in table value returned but it didn't work :( This is my code :...
forexmp45's user avatar
0 votes
0 answers
86 views

Need Help Deploying Contract to Sepolia

I've built a web3 dapp for the "Rock, paper, scissors, lizard and spock" game. I've made it run on my local system using truffle and ganache but I must deploy it on an Ethereum test like ...
Priyadarsh S S's user avatar
0 votes
1 answer
65 views

Liquidity transfer from A user to B user

How can I make option for user transfering his liquidity pool value (withdraw it) to user B? Maybe it’s uniswap router, transfering LP tokens from wallet or what?
Hahan't's user avatar
  • 103
1 vote
2 answers
43 views

Problem verify smart contract by harhdat

I recently used hardhat as a compiler for deploying SC and feel it really efficient. However, when I try to verify the SC using npx hardhat verify --network bsc_testnet 0x.... I got the following ...
Xar Tran's user avatar
0 votes
2 answers
299 views

What is the difference between Uniswap V3 and Uniswap V2

can you help me to understand the main difference between Uniswap V3 and Uniswap V2 in terms of technology and liquidity. Also, is it legal to copy the Uniswap contract. I see lots of project just ...
Phill Jonny's user avatar
0 votes
1 answer
25 views

I want to know a Contract address verified or not by programatically

I am having Token Names , Token Symbols and token addresses , I want to know that a Particular Contract address is verified or not by programmatically , but I don't want to use BSCSCAN API endpoint , ...
Bhushan Dhiware's user avatar
0 votes
1 answer
68 views

TransactionRevertedWithoutReasonError - How Do You Debug This‽

I've seen the question countless times on here, but it's always unique to the smart contract, so I feel like I need to ask it again. This is based off of a smart contract I'm testing on Goerli. I ...
Trent Kennelly's user avatar
1 vote
1 answer
22 views

Transfer Ether through a smart contract

I'm pretty new to web3. I'm writing a simple smart contract to receive ETH and transfer it to a fix address, really a simple smart contract. Its work well with standard token but not with Ether. Can ...
Xar Tran's user avatar