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
2 votes
0 answers
22 views

Cannot send transaction to smart contract, 'unknown account' even with account added to wallet

I am trying to send a transaction that updates the state of a smart contract. I have locally deployed a ethereum network using Geth and three VM. Here is my JS code: import { Web3 } from 'web3'; ...
robeng's user avatar
  • 21
1 vote
1 answer
80 views

Is there any way to get historical pool data by interacting with the pool smart contract?

I am wondering if there is a function in smart contract pools to get historical data (just last 100 bars for example). thanks guys!
Aniss Itaoui's user avatar
0 votes
0 answers
18 views

Right wat to execute sendSignedTransaction with web3 v4.2.0

I am using [email protected]. I am trying to implement the sendSignedTransaction method, but it keeps on giving me below error. reason: 'err: insufficient funds for gas * price + value: I am sure I do have ...
anish samant's user avatar
0 votes
1 answer
39 views

can eth_call simulate approve and transfer?

I have a solidity contract that contains a logic to approve and transfer balance, swap and flashloan. But when i use eth_call to call my function that perform swap, it reverts. I tried by ...
Biruk Damte's user avatar
0 votes
2 answers
62 views

insufficient funds for gas * price + value: address on approve usdc on Arbitrum

Hi i face error gas insufficient while try to approve usdc on Arbitrum my wallet have eth around 0.005 ETH why not enought for L2? require('dotenv').config(); const { Web3 } = require('web3'); // Set ...
krissanawat's user avatar
0 votes
1 answer
56 views

How to read a variables in deployed contract via cast command?

contract testContract { address private test1; string publictest2; } How do I use foundry framework test cases to read the storage slots? https://book.getfoundry.sh/cheatcodes/load // This ...
anonauditor's user avatar
0 votes
2 answers
24 views

Web3 Schema Update

I understand that web3 smart contracts are decentralised and the code once written cannot be updated. They are immutable. Imagine my app stores user profile in a smart contract. It has name in it for ...
Anuj Kumar's user avatar
1 vote
0 answers
24 views

How to fix `Invalid callback object specfied` error when deploying a smart contract?

My smart contract: // SPDX-License-Identifier: MIT pragma solidity 0.8.19; contract Inbox { string public message; constructor (string memory initiialMessage) { message = ...
Jyobala's user avatar
  • 11
0 votes
0 answers
24 views

I keep getting error when trying to send transaction signed by web3.eth.sign with web3.eth.sendsignedtransaction

I get an error Error: TypedTransaction with ID 40 unknown at t.TransactionFactory.fromSerializedData HERE IS MY CODE: const txData = { nonce: "0x" + parseInt(nonce, 10).toString(16), from: ...
Milikoder's user avatar
0 votes
0 answers
28 views

Upgrade to Web3 Library Version 4.1.x Causing Contract Function Transaction Failures via Metamask

I am facing a very strange error and I am still unable to figure out after spending more than 2 days. I am using truffle framework and latest version of Web3 library which is version 4.1.2. I am ...
wolvorinePk's user avatar
0 votes
0 answers
9 views

I am getting this error and I cant solve it error:-( _this.state.tokenFarm.methods.stakeTokens is not a function)and whole code is given below ASAP

// ALL CODE WITH INITIALIZATION OF CONTRACTS ARE GIVEN HERE PLAESE HELP ME ASAP import Web3 from 'web3'; import React, { Component } from 'react' import DaiToken from '../abis/DaiToken.json' import ...
Devang Thaker's user avatar
0 votes
0 answers
19 views

Is this the correct way to add string extra string data to a solidity contract

This is my first solidity contract, it was working until I wanted to add extra data to the transaction. I'm not sure if I'm calling it wrong with webjs3 or the contract itself is flawed in some way. ...
Brian's user avatar
  • 101
0 votes
0 answers
45 views

Smart contrat working in remix ide but actions not working with web3.js html interface, only displays work and i can't figure out where and why it is

first of all thank you for your time reading this. I'm trying to learn and play with solidity on polygon mumbai blockchain. I worked with internet forums, videos and chatgpt4. Here is some details ...
Jawhar Aredsgfs's user avatar
1 vote
1 answer
18 views

First deployed contract, can setMessage but cannot getMessage

I have created a test contract and deployed on Remix: pragma solidity ^0.4.24; contract Message { string myMessage; function setMessage(string x) public { myMessage = x; } ...
blocker's user avatar
  • 21
0 votes
1 answer
26 views

Deterministic address calculation?

proxy contract contract ERC20ProxyDelegator { constructor(ERC20Votes _token, address _delegate) { _token.approve(msg.sender, type(uint256).max); _token.delegate(_delegate); } } ...
kumar's user avatar
  • 41
0 votes
0 answers
14 views

Transaction gets reverted when using send web3 function in angular

I am using [email protected] to access my ganache blockchain through localhost. I am new to dapp development and I'm trying to call a function that updates the ganache blockchain through web3 in angular. I ...
newcoder's user avatar
0 votes
0 answers
37 views

signTransaction not working

I'm trying to sign a txs using web3.eth.accounts.signTransaction but it gives : v: '0x00', r: '0x00000000000000000000', s: '0x00000000000000000000', I tried the examples from official documentation ...
Johny Smith's user avatar
0 votes
1 answer
36 views

How do I remove Gas limit on Solidity Code

I am new at Solidity and Blockchain. I Have written this solidity code to send all NFTs in wallet. contract MultiERC721Transfer { // Mapping to keep track of approved contracts mapping(address ...
Daniel's user avatar
  • 1
0 votes
2 answers
41 views

Transaction gets reverted when using send web3 function

I have a basic smart contract that sets the hash of a string and retrieves it along with verification. The contract works perfectly fine, but the issue is with the .send method of web3 that reverts ...
Andrea Ross's user avatar
1 vote
0 answers
32 views

Cannot deploy contracts on Polygon Mumbai, what am I doing wrong?

I'm trying to deploy contracts to the Polygon Testnet Mumbai, but I get no confirmation, it works maybe 1 in a 50 attempts. I've been iterating my code and I'm quite confused as to what is going wrong....
twangsta's user avatar
0 votes
1 answer
119 views

TypeError: abis.filter is not a function

I've been working on a React program that provides a frontend for a Solidity smart contract I'd been making. The App.js code is shown below: import React, { useState, useEffect } from 'react'; import ...
aussastan's user avatar
0 votes
1 answer
28 views

In either web3 or ethers, how do I monitor an address' transactions calling specific methods?

I'm trying to monitor an address each time it calls "Transfer" or "Notify Reward Amount". And if there is a match, print the info of said transaction. Both interact with ERC20s. ...
htschvl's user avatar
0 votes
0 answers
10 views

web3 module takes nearly 500ms to load

I noticed my web3 scripts are very slow and after doing some testing I noticed that the web3 module takes 470ms alone to load. Other modules only take 1 ms. Is this normal? I have the latest version ...
wbinky's user avatar
  • 1
0 votes
0 answers
15 views

Asking too much gas fee for transaction, Returned error: theta RPC returns an error

I have deployed my contract on theta mainnet. It was working fine for few days but now it is asking too much gas fee for transaction. I am using web3 "v1.3.1" on server side nodejs
Ilyas Khan's user avatar
1 vote
0 answers
78 views

TransactionRevertedWithoutReasonError: Transaction has been reverted by the EVM when trying to mint an erc1155 token using web3

I deployed a solidity contract on polygon mumbai testnet using remix IDE and metamask as my Environment. I'm currently trying to call the mint function that mints an ERC1155 token in exchange for ...
Ciirno's user avatar
  • 11
0 votes
2 answers
39 views

Deploying contracts at same address

// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /* Let's say Alice can see the code of Foo and Bar but not Mal. It is obvious to Alice that Foo.callBar() executes the code inside Bar.log(). ...
kumar's user avatar
  • 41
0 votes
1 answer
38 views

How to Download dependencies when auditing a hardhat project?

I just attempted to audit smart contracts that were tested using the Hardhat framework. In Foundry, after cloning the repository, I know that I can install all the necessary dependencies by simply ...
kumar's user avatar
  • 41
0 votes
1 answer
39 views

Unable to deploy the smart contract from my terminal using hardhat

I've created one contract and trying to deploy it locally to test it. But it's not deploying. It throws this error, This is the code in scripts/deploy.js file, async function main() { const ...
Santhosh's user avatar
0 votes
0 answers
8 views

Gnosis Safe wallet transaction creation

Is there a way to achieve this scenario on JS application: We want to implement a multisig wallet onto our application that is used to approve crypto transactions from an admin panel. So our goal is, ...
Norm's user avatar
  • 1
0 votes
0 answers
68 views

When sending a transaction using web3 I recive EIP1559FeeMarketTransaction.fillFromResult error

I am using a ganache local blockchain and truffle to test my smart contracts, this problem started to occur all of a sudden, since before I wasn't running into this problem. So when I call the ...
blackopps166's user avatar
0 votes
1 answer
16 views

In the post merge 2023 developer ecosystem, what's the best practice for connecting to a web3 dApp that doesn't use client-server JS (e.g. node)?

I have a very simple application that uses Django as the underlaying web framework, and our app got a bit stranded by the move from Walletconnect's services in the migration from v1 to v2 that was ...
jdero's user avatar
  • 101
1 vote
1 answer
80 views

How do I hide or mask the sending address when sending tokens or eth

I am trying to build a crypto payment gateway. But when users initiate a withdrawal to credit their customers, the transaction can be tracked up to the point that shows the system address where the ...
Starbody's user avatar
0 votes
2 answers
46 views

A guide to solve some challenges in building a blockchain game

We are designing a blockchain game, currently we have encountered some challenges in the wallet and interaction with the smart contract and token transfer that I would like to consult you about. First ...
Ali's user avatar
  • 63
0 votes
0 answers
34 views

Sending data to the contract from the react frontend is not working

I've made an twitter contract, where we can send and get tweets from the frontend React. While sending the data to the contract, The metamask popup is opening, But it shows warning like this. I don't ...
Santhosh's user avatar
0 votes
1 answer
60 views

Signing message using web3 and using ethers gives different result. Why?

I'm encoding a message using ethers' solidityPackedKeccak256() const encodedMessage = ethers.solidityPackedKeccak256( ["address", "uint256", "uint256"], ...
ujjwalvinze's user avatar
1 vote
0 answers
37 views

Transaction involving contract and ETH

I have a problem in Web3. I'm trying to obtain data from an ETH transaction but it involves a contract (Coinbase 10). From what I understand of the transaction, it looks a lot like token transactions (...
Alison Silva's user avatar
0 votes
2 answers
58 views

Error Handling in Solidity Using Custom Errors with Web3js

In many posts, I've noticed discussions about handling this using the Ethers library. However, my implementation is based on Web3.js, and I'm facing a challenge. My contract is set to revert a ...
nunurao's user avatar
  • 101
0 votes
1 answer
127 views

UniswapV3 Quoter throws error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION)

I am working with the Quoter from Uniswap V3, here is the part of the function that challenges me: ... // Reformat Amount In if (!isNaN(amtIn)) {amtIn = amtIn.toString()} let amountIn = ethers....
Christopherus's user avatar
0 votes
1 answer
125 views

ERC721: invalid token ID"

I'm minting an NFT and listed it on my NFTMarketplace, after minting I keep getting ERC721: invalid token ID, whenever I try to create the sale on the market place. this is my nft code // SPDX-...
Santos's user avatar
  • 17
0 votes
1 answer
17 views

Unable to change the storage using Delegate call

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Preservation { // public library contracts address public timeZone1Library; address public timeZone2Library; address public ...
kumar's user avatar
  • 41
1 vote
1 answer
26 views

How to change the storage using Delegate call

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Preservation { // public library contracts address public timeZone1Library; address public timeZone2Library; address public ...
kumar's user avatar
  • 41
0 votes
1 answer
10 views

How the uint changes to address type in solidity when using delegatecall?

pragma solidity ^0.8.18; contract One{ address public first; address public second; address public third; function setaddress(address _address)public { third = _address; }...
kumar's user avatar
  • 41
0 votes
1 answer
49 views

(SOLVED) TypeError: Cannot read properties of undefined (reading 'call') and TypeError: TestContract.name is not a function

This is my simple js code (without api). I try to do my first steps with js and web3 and the goal is to fetch data from the OMG network, a very simple task, but for some reason it is not working. I ...
Christopherus's user avatar
0 votes
0 answers
42 views

Running beacon node using prysm

I was running Running beacon node using prysm with the following command: ~/Documents/microverse/BlockChain\ and\ Web3/mynode/sepolia/consensus/prysm/prysm.sh beacon-chain --execution-endpoint=http://...
Henok Mekonnen Mossissa's user avatar
0 votes
0 answers
17 views

What's difference between npm web3 version1 and version4?

async function sendDonate() { try { const result = await contract.methods.donate().send({ from: account, value: web3.utils.toWei(inputValue, "ether"), }); console.log(result); ...
HingguHinggu's user avatar
1 vote
0 answers
102 views

Walletconnect v2 don't work in ios trustwallet, but work in andriod. Why is this happening?

sing Wagmi and walletconnect v2 sdk to implement sending USDC tokens from a wallet to a specific wallet. Everything works on Android on trustwallet and metamask wallets But on ios metamask sending ...
Madis Conner's user avatar
1 vote
1 answer
21 views

Tips for designing a blockchain game

Some of my friends and I are designing a blockchain game and I have a question for you that I hope you experienced friends can help me with. My first question is about the architecture and ...
Ali's user avatar
  • 63
3 votes
1 answer
53 views

Smart Contract/Nextjs Error: Returned values aren't valid, did it run Out of Gas?

I'm having an error while calling one of the function of the deployed contract from Next.js Error: Parameter decoding error: Returned values aren't valid, did it run Out of Gas? You might also see ...
Mohsin's user avatar
  • 31
0 votes
3 answers
105 views

REWARD!! PLEASE CAN SOMEBODY HELP ME ETH STUCK - I am a newbie trying to create a trading bot. and came across a tutorial, my 1.1eth stuck Metamask! [duplicate]

SORRY ABOUT THE GRAMMAR AND SPELLING I HAVENT SLEPT FOR ALLMOST 2 days BECAUSE OF THIS.. Here is a bit of a back story on why I have become a little desperate lately to find ways to make crypto faster ...
GTR ARGH's user avatar
0 votes
0 answers
10 views

The transaction ends successfully but in the contract remains pend forever!

const id = Number(globalChainId) const provider = new ethers.providers.Web3Provider(window.ethereum) const signer = provider.getSigner() const contract = new ethers.Contract(contractAddress, abi,...
Shav0 Papoyan's user avatar