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
1answer
15 views

is there any way to test etherum application using real addresses by Metamask?

I have Ethereum app written using react + web3 and my contract code written using solidity. can I test the app using real addresses [I used Rinkbey network] and my wallet Metamask .
0
votes
0answers
23 views

Ethereum TX not sender - Returned error: invalid sender

I want to create a DApp by staking pools of Stake BNB Earn MyToken tokens. I've been looking for some references but I'm still confused, that's why I decided to ask. I have the following lines of code ...
0
votes
0answers
8 views

VM Exception while processing transaction

I have the following function, but when I call this function, it gives me the following error: Uncaught Error: Returned error: VM Exception while processing transaction: revert at evalmachine.<...
0
votes
0answers
3 views

Sorry, but the decompilation process exceeded the timeout threshold and could not be completed

i'm trying to use the "decode" function of BSCscan for a contract (https://bscscan.com/bytecode-decompiler) but i got this error : There is an alternative solution to decode big contract ...
0
votes
1answer
13 views

How to increase the number of test accounts using injected Web3 with Metamask?

I have encountered a problem where I need a large number of accounts. How can I increase the number of accounts from only 1 with injected web3. Remix and Metamask only give 1 account. I require more ...
0
votes
0answers
87 views

When I use WalletConnect with MetaMask, MetaMask get request, send Token and ETH together that wrong

When I use WalletConnect with MetaMask, MetaMask get request, send token and eth together in one transaction, equal amount, example 800tokens+800ETH that is wrong, when I use MetaMask without ...
0
votes
0answers
6 views

predefined error in web3js like poocoin

Sometimes I need to check the error before sendSignedTransaction, like poocoin, they has predefined error before transaction send, how to make that with web3js?
0
votes
1answer
178 views

Enormous suggested fees on metamask after the EIP-1559

We have to react based app that is responsible for connecting with the NFT contract and calling the "mint" function. To call the function, the contract will ask for 0.06ETH, and the amount ...
0
votes
1answer
95 views

tuple[] for a function input. How to use it?

I'm trying to use this contract https://etherscan.io/address/0x1756438d0038fae9d9566b54a93a4014f4b38953#writeContract. More specifically, createSplit function. I'm struggling to understand what to ...
0
votes
1answer
21 views

How to get gas fee to send erc20 token at mass volume?

Pardon me for my poor english. What I am trying to achieve is: I am learning node JS developing a crypto currency exchanger as a homework project where user can deposit ERC-20 token and Ethereum. I am ...
0
votes
0answers
9 views

Error: Network not synced; last block was 1630630627.508 seconds ago

I checked eth.syncing in the console and it says false which should mean the blockchain is synced, but in my node script I get an error that blockchain is not done syncing: const fs = require('fs'); ...
2
votes
1answer
143 views

MetaMask (Web3) Inflates Transaction/Mint Price to Ridiculous Amount

I am writing a dApp/UI for my ERC721 smart contract and facing a recurring issue. My contract has been deployed to the Rinkeby test network and the contract has been verified on Etherscan, allowing me ...
0
votes
1answer
11 views

In Solidity How to Get/Send Part of Ether Stored in msg.value?

assuming i have the function: // Fucntion that act like a wallet in which i deposit ether in it say 100ether function storeEth() public payable onlyOwner{ } but then i want to withdraw or ...
0
votes
0answers
12 views

Web3.js retrieve a boolean from ERC721 Contract

I can't find this anywhere in the docs. I'm trying to retrieve a boolean value from my ERC721 contract. I understand that to call a function, you simply use: contract.methods.MyFunction(param1, param2)...
0
votes
0answers
9 views

getPastEvents OR filter across two parameters

Web3 allows one to filter events by indexed parameters (see here). For example: {filter: {myNumber: [12,13]}} would pull only events where “myNumber” is 12 or 13. Is it possible to filter across two ...
0
votes
0answers
39 views

How to confirm ethereum smart contract using Meta mask App from a transaction generated from browser in Android mobile phone

I have tried to let Metamask wallet app on my mobile phone(android) to confirm smart contract transection in the same way that I could do on my PC. However, it seems like the mobile browser does not ...
0
votes
0answers
21 views

How to read a value off the smart contract using a "web classic API" HTTP request approach?

I've done this a couple of times, but often it is problematic... Loads of things change, often my old code does not work. All I want is to read a single value of the smart contract and display it to ...
0
votes
1answer
36 views

How to send a full balance from one wallet to another with a gas deduction? [duplicate]

Hello everyone, I start learning programming, sorry for my mistakes. I need to send all balance (100 ether) from account 1 to the account 2. But he does not have enough money for the transfer. I ...
0
votes
0answers
177 views

How to cancel automatic withdrawal on Trustwallet?

My Trustwallet was compromised and I have some tokens staked on it. When I deposit eth or any other token, it’s automatically sent to a different address almost immediately. Kindly advise on the best ...
0
votes
1answer
23 views

Is there a way to specific the block when buy BEP20 token?

To avoid bot, some of fairlaunch and dev make a 99% tax in 2 first block buying after liquidity, it called antibot system. https://bscscan.com/tx/...
0
votes
1answer
45 views

How to send BNB from BSC Network to smart contract

Hello I have to send $10 to contract from BSC NETWORK var toSend = web3.utils.toWei("10","ether"); MyContract.methods.UpdateUser(73104224,account).send ( { value: toSend , from: ...
0
votes
1answer
26 views

Infura with JWT authentication

I am using wallet connect an Open protocol for connecting Wallets to Dapps with web3 modal sdk . the wallet connect requires an infura key. Since the wallet connect is executed on the borwser it ...
0
votes
1answer
35 views

Get data using mapping from struct

I have a struct - struct AppData { uint256 SrNo; uint256 UserID; uint256 RefID; address Wallet; } and Mapping mapping(uint256 => AppData) public AppUsers; So I am not mapping on ...
0
votes
0answers
31 views

Smart contract realization flash loan

I am trying to create a smart contract that will take a flash loan and make transactions. https://etherscan.io/tx/0xf65b384ebe2b7bf1e7bd06adf0daac0413defeed42fd2cc72a75385a200e1544?...
0
votes
0answers
9 views

How to get event of a transaction with web3js

I have a smart contract that deploys another smart contract and returns the address of the deployed smart contract. The code for the smart contract looks like this- function createNFT() public ...
7
votes
0answers
113 views

How does estimation of gas price changes after implementation of EIP-1559

I understand that after EIP-1559 implementation, the fee structure changes to now have max priority fee and max fee instead of single gas price. The question is though what could be the best strategy ...
1
vote
1answer
96 views

err_cleartext_not_permitted error while running Dapp on Android Metamask

I use Metamask browser on Android phone to connect to a Dapp. But it gives ERR_CLEARTEXT_NOT_PERMITTED. This Dapp is working well on browswer extension Metamask. All connections in web3.js source is ...
1
vote
1answer
185 views

Error occurring while trying to swap tokens in Uniswap v3

I'm trying to execute a swap using web3 through following code snap: const fromTokenAddress = `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`; // WETH9 const toTokenAddress = `...
0
votes
1answer
59 views

Not able to transfer ETH via MetaMask using web3.js

So I try to transfer the funds using below code its working in metamask extension its shows SEND Ether amountToSent = "0.002" web3.eth.sendTransaction( {from: ethereum.selectedAddress,to:...
0
votes
1answer
94 views

while converting number 0.001 to BN.js instance, error: Value must be an integer, hex string, BN or BigNumber instance

I want to transfer 0.001 token and I cannot use web3.utils.toWei(0.001) as the smart contract has 12 decimal instead of 18 decimal. How can I correct it ? var decimals = 12; var amount = web3....
0
votes
1answer
29 views

Unable to add transaction to blockchain (I'm invoking the setMessage(str) method but the string i pass doesn't get set but getMessage() method works)

When i call the setMessage() function this doesn't log any transaction in the blockchain. But the getMessage() function works by bringing the message which was previously set using the remix IDE ...
0
votes
2answers
31 views

web3 transaction details

Are there any functionalities available on web3.js to provide the details Etheresacn provides, such as Txn Type, the Base fee per gas, etc. I am aware of web3.eth.getTransactionReceipt however, it is ...
0
votes
0answers
23 views

How to check if an address is included in a mapping of address' key from Web3?

I would like to check if a specific address is included in an address key mapping from web3? Here is my Solidity Smart Contract: pragma solidity >=0.4.21 <0.7.0; contract Election { //...
0
votes
1answer
98 views

How to send a signed transaction using metamask and web3?

I'm stuck at sending a signed transaction to a Smart Contract deployed on Ropsten network. As learning purposes, I created a 'Voting' smart contract. This contract includes 2 candidates we can vote ...
0
votes
0answers
243 views

How to get NFT data with web3 or etherscan api?

I see platforms like zerion io able to get nft data from only a public ethereum address. But how are they doing this? I dont see a clear path of getting this type of data from etherscan as an nft ...
1
vote
0answers
8 views

Does Ethers.js log events before the blocks they belong to are mined?

I'm using the following lines to capture all future emissions of the Triggered event. const filter = contract.filters.Triggered(null, null, null); provider.on(filter, (log) => { console.log(&...
0
votes
2answers
168 views

How to approve swapExactTokensForETH from UniSwapRouter V2, before invoking it?

I am trying to create a simple DAI/ETH swapper which lets me swap some DAI for ETH using Uniswap Router V2. I am creating it using React and uniswapSDK. So far, I have managed to connect to my ...
0
votes
1answer
27 views

TypeError: Cannot read property 'ownerToken' of undefined

i want to return owner of contract address : i write this contract : // SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "./Token.sol"; contract KIA is Token { Token private ...
2
votes
1answer
35 views

How estimateGas works internally?

I am building a sniper bot which continually estimating the gas for buying one token. Once the gas is successfully estimated, a transaction to buy the token is sent. But for many times it estimated ...
0
votes
0answers
25 views

why has my script stopped working after moving from ganache to geth?

I have built a web application that connects to a private blockchain, the app works like a private token exchange. Everything works perfectly with ganache/truffle, however the below script i use to ...
0
votes
1answer
126 views

Pancake Swap Factory smart contract error

I am using web3js to call PancakeFactory v2 contract (bscscan): contract address: 0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73 Anytime I want to call any function present in the contract I end up with ...
0
votes
0answers
30 views

Quasar Framework (VueJS) - “UI” compiled with errors (If import web3)

I use Quasar CLI version 1.2.1 and library web3 version ^1.5.2 it's an error when i use: import Web3 from 'web3' Log Error: App • Chaining "UI" Webpack config App • WAIT • Compiling of &...
1
vote
1answer
38 views

Getting inconsistent responses with web3.eth

The code runs but says "food.eth" is available (it isn't): var Web3 = require("web3") let web3 = new Web3(Web3.givenProvider || "ws://localhost:8546"); var ens = web3.eth....
0
votes
2answers
162 views

Web3.js calling ERC721 contract methods

I'm writing a React app that calls to see who the owner of a tokenId is. I am trying to call the built-in function ownerOf(uint256 tokenId) from the ERC721 contract. Here is my javascript code: const ...
0
votes
0answers
24 views

How to get all entry's from web3py?

Does infura or alchemy have the capability to listen to each and every filter of a contract on one node? I want to listen to about 6 events all at once from a lending pool. I'm using web3py like this: ...
0
votes
1answer
30 views

Get all response of Web3.eth.getTransaction() from 0 ~ current block(~ about 13090000)

I am trying to get all the transaction data from an old (ancient?) block to the current block using Web3.eth.getTransaction(). However, in the current version of geth, I can't do that without using --...
0
votes
0answers
74 views

How to sign a transaction in metamask (EIP 712) with data instead of sending it normally to save gas cost?

I have a function to set some additional metadata on a NFT card, it's not really expensive (seems that I only have to pay a couple bucks like sending a normal ETH tx) but I'd like to sign the ...
0
votes
2answers
56 views

Signing transaction on frontend and sending on backend server

Hi I'm making an NFT auction site similar to OpenSea to learn blockchain technology. But I have some security concerns about sending transactions on the frontend of my application because if a user ...
0
votes
0answers
26 views

Import private key into geth

I was trying to import private key into geth node which i run locally. I am using javascript console When i tried the command web3.eth.personal.importRawKey("Private Key","Password&...
0
votes
0answers
19 views

sendSignedTransaction vs sendRawTransaction

sendSignedTransaction vs sendRawTransaction: What's the difference? They both require the transaction to be already signed (and therefore hashed). Both work with local keys and not hosted keys. Both ...

1 2 3
4
5
99