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
6 views

Unpacking arguments when calling a smart contract function with web3.py

I'm trying to reproduce some code on python that is currently working on javascript. The main goal is to select a function to query from the contract abi and call it (just view functions). Let's say ...
user avatar
  • 111
1 vote
1 answer
9 views

Wait for incoming ethereum transactions and credit them after n confirmations

I'm trying to create a website where users can deposit ethereum. For my server I'm using node.js and express.js. I looked into web3.js but the docs are unclear to me and I don't know which functions ...
user avatar
  • 11
0 votes
1 answer
13 views

Gas limit is not set REMIX

I set the gas limit to 1 000 000 for every transaction. But each transaction takes less amount of gas than 1 000 000. Could you please explain why it happens or what I need to read to get this right. ...
user avatar
0 votes
0 answers
10 views

Fetch Transaction Data/Block Data on Solidity

is there a method to call web3.eth.getTransaction or web3.eth.getBlock on Solidity? Or is there an oracle that allows to do so?
user avatar
  • 11
0 votes
1 answer
15 views

contract.methods.payFund is not a function. Unable to call any of my contract function

I am unable to call any function of my contact.............. when I am printing my contract object it shows that all the functions are in the object but unable to call. It is the output when i print ...
user avatar
0 votes
0 answers
9 views

Parameters that can be passed in curly braces for message call and delegate call

When I use "call" in solidity I am able to pass parameters in parenthesis and in curly braces. What is the full list of parameters I can pass in curly braces? What is the main difference ...
user avatar
0 votes
1 answer
24 views

"Cannot read property 'utils' of undefined" on web3.utils

This is my code: import {web3} from "hardhat" const OWNER_ROLE = web3.utils.keccak256("OWNER_ROLE"); This is the error in my terminal: const OWNER_ROLE = web3.utils.keccak256(&...
user avatar
1 vote
0 answers
11 views

In geth, `eth.syncing` gives `false`

In geth, eth.syncing gives false but when I check the eth.blockNumber I get the latest block? And also all of my eth account has zero balance? how can I add balance or its just node not syncing yet or ...
user avatar
1 vote
0 answers
23 views

Public key to ethereum address in javascript without (or minified sha3 library)

I am trying to get rid of the web3js library and this is the last hurdle. Before i used web3.utils.keccak256(eth_public key) How can i do this with minimal amount of code in javascript. I tried https:/...
user avatar
1 vote
1 answer
9 views

Work out Eth price from getAmountsIn method

I am attempting to create a test arbitrage bot using Uniswap & SushiSwap. I can successfully get the amount of X tokens I would get for 1 WETH on both dexes. For example: ​ Uniswap: WETH / USDT ...
user avatar
  • 111
0 votes
0 answers
14 views

How to detect which Wallet is connected?

I have a web3 application where I use three types of wallets: MetaMask, WalletConnect, BianceChain, users can connect to these wallets,Problem is I can not detect which wallet user comes from, is ...
user avatar
0 votes
1 answer
19 views

Is there sdk to create new account in Polygon through web3

Is there any functions or API to create a new account in polygon, like hashgraph in hedera, is there any function or API to create a new account through code in the polygon? I really appreciate any ...
user avatar
  • 3
0 votes
0 answers
7 views

Can i create pending transaction that get execute once there is enough gas fees in my wallet?

I have a permession for a scam smart contract that steal every eth that transfer to my wallet I also have some other tokens like USTD I can't transfer the usdt out because I don't have enough gas fees ...
user avatar
0 votes
0 answers
8 views

Hello please give me answer in my questi [closed]

How to connect web3 in react native App, How to get balance web3 in react-native
user avatar
0 votes
0 answers
7 views

Setting an array useState([]) variable in React.js returns undefined

I have been trying to create a Web3 dApp using React.js. My first step was to connect the browser to a MetaMask wallet. So I first started by initializing a useState array variable named "wallets&...
user avatar
0 votes
1 answer
15 views

Why am I getting incorrect WBTC when swapping it with DAI using Uniswap?

Hi I created a smart contract but when I am swaping 1 Million DAI with WBTC tokens I am getting only ~3379786784 WEI (~34 WBTC) but when I am checking its value on UNISWAP website it is showing 43 ...
user avatar
0 votes
1 answer
22 views

Data from smart contract not properly showing JavaScript code

async function viewmyactivedeposits() { const result = await myLoanContract.methods .viewMyActiveDeposits() .call() .then(function (result) { let data = Array.from(result); $(...
user avatar
  • 1
1 vote
0 answers
18 views

How to add logo to a web3 personal signature message?

I have generated a signature message from my react js app for the users. But in mobile metamask the message displays a letter D, the first letter of my url, at the top of the message. But I want to ...
user avatar
0 votes
0 answers
6 views

Obtaining ECDSA values to pass as arguments for a solidity function call

I am trying to call a function where a message must be signed and split to obtain the ECDSA values. I'm using splitSignature function from ethers to get the r,s,v values but the smart contract require ...
user avatar
-1 votes
0 answers
13 views

How do I fix Integer Constant Expected remix

from solidity: TypeError: Integer constant expected. --> contracts/5_Carcompanies.sol:45:13: | 45 | Car[carLength] = Carcompanies( | ^^^^^^^^^
user avatar
0 votes
1 answer
12 views

web3.js filtering events does not work

Event: event published(string indexed username,uint8 indexed age); in front-end (browser) : instance.events ...
user avatar
  • 25
0 votes
0 answers
18 views

Eth_Sign keeps giving scary warning eventough its nothing dangerous

I am currently sending a singned transacion that is beeing signed with eth_sign. The transaction is a contract method and our team needs such a transaction but a red message is beeing displayed that ...
user avatar
  • 1
0 votes
0 answers
22 views

Metamask does not open on opera using web3modal

I am using web3modal to connect with different wallets. On Mozilla I am able to connect with metamask but when I open my website on Opera GX browser (version: LVL4 (core: 89.0.4447.64)) it says that ...
user avatar
  • 45
0 votes
0 answers
12 views

TypeError: Cannot read properties of undefined (reading 'toNumber'), When trying to fetch totalSupply

I'm trying to fetch totalSupply from my smart contract using react-moralis useWeb3ExecuteFunction and got this problem the code import Head from 'next/head' import styles from '../styles/Home.module....
user avatar
0 votes
1 answer
33 views

Why the transaction fee in blockchains change?

I would like to understand why when making a transaction in the blockchain, the fees change. Being in the polygon network, I execute the same contract 10 times and the transaction price is always ...
user avatar
  • 25
0 votes
1 answer
10 views

why there are differences in web3 when using truffle and when used in the browser?

1- why listening to events in truffle require another library called truffle-assertions, why can't we just use contractInstance.events.EventName() like we do in the browser? if truffle also use web3 ...
user avatar
  • 25
0 votes
1 answer
41 views

How to Multicall a non contract function in web3 python?

The method to aggregate functions belonging to contracts is given in this library: https://pypi.org/project/web3-multicall/ But my question is, how can I aggregate a basic web3 function (that is not a ...
user avatar
0 votes
0 answers
10 views

How do you call a getter function in web3.js alone

Can someone please show me how to do the equivalent of web3.eth.Contract.methods.someGetterMethod().call(); solely with web3.js and an account created with web3.js. What confuses me is that I don't ...
user avatar
0 votes
0 answers
14 views

When calling `getOwners` on a Gnosis Safe contract, is there a trivial code solution to detect if the returned addresses are also Gnosis Safes?

I'm looking to build a sort of whitelist of addresses for my application based off the owner addresses associated with a Gnosis Safe contract. I want this to work up to two levels deep, so I'm calling ...
user avatar
0 votes
1 answer
16 views

Insufficient funds for gas Web3.js

Hello i have this code using web3js to send USDT to an address, but i get the error "insufficient funds for gas * price + value" This is the code const fromAddress = this.walletID; ...
user avatar
0 votes
2 answers
31 views

ABI call using Metamask's RPC provider from web3js

I want to call the balanceOf method from the ERC20 smart contract. Is it possible to do so using Metamask's RPC provider, or do I always need to provide my own host? For example, this following ...
user avatar
1 vote
1 answer
21 views

Metamask API support for interacting with Ethereum contracts

Metamask stopped using web3. Their own API has no methods for interacting with ERC20, ERC721 contracts. How do I accomplish simple task of reading token balance for a wallet on an ERC721 contract? ...
user avatar
  • 111
1 vote
1 answer
32 views

Alchemy - replacement transaction underpriced

SC: 0x3c445903aCa6c4d1B55357Fb9F8e22252899478A I simply try to mint() on Polygon Mumbai but I had to workaround "replacement transaction underpriced", I still can't see any pending/unmined ...
user avatar
  • 21
0 votes
1 answer
27 views

Mint _msgSender() on contract on deployment

I'm starting up with solidity and I'm deploying my smart contracts using web3 with the following function: deployContract(args) { var web3 = <MY-WEB3-PROVIDER>; var privateKey = <...
user avatar
  • 103
0 votes
1 answer
32 views

ERC20 Event Listener in Rust Programming

I am trying to program an erc20 event listener using Rust programming language and trying to get events from a particular block to the latest block. But even though I have specified from the block it ...
user avatar
0 votes
1 answer
15 views

get nft activity

Does anyone know how I could get the transaction logs of an nft? having the address of the collection and the token ID. thanks guys!
user avatar
2 votes
1 answer
38 views

web3.eth.sendSignedTransaction is not a function

I'm taking initiative to learn with Web3js and Ganache for testing interactions with blockchain. (So go easy on me being a noob pls) When trying #3 example from here: https://www.dappuniversity.com/...
user avatar
  • 21
1 vote
1 answer
22 views

web3.eth - getBlock FetchError: request to https://eth-mainnet.g.alchemy.io/v2/api_key failed, reason: getaddrinfo ENOTFOUND eth-mainnet.g.alchemy.io

I'm trying to get Eth blocks by blockNum using Alchemy's apis. The docs mention two methods: getBlockByHash and getBlockByNum, but those methods don't exist on the web3.eth object. Here are the ...
user avatar
0 votes
1 answer
24 views

How to add ethereum-based token to my app?

I am new to this erea and I am trying to write a wallet application. I have developed my wallet to publish on Ethereum and can now publish to ETH mainnet. I am wondering if I can add some more coins ...
user avatar
  • 101
0 votes
1 answer
25 views

What is the complete beginner's road map for learning Web 3.0 Decentralized applications and writing smart contracts? [closed]

As a front end developer (using React.js), I want to understand blockchain so that I may create decentralised applications (dapps), NFT marketplaces, and solidity contracts. However, I'm not familiar ...
user avatar
  • 103
0 votes
0 answers
14 views

what is the correct address for BUSD Testnet for transferring with Web3/Metamask?

I have a requirement of building Smart contract where BUSD is used.but after googling, i came to know about 2 BUSD address and I don't know which one is going to used in smart contract implementation(...
user avatar
1 vote
1 answer
47 views

Why are all ethersjs & web3js calls to BSC network failing?

All calls using "wss://bsc-ws-node.nariox.org:443" and other RPC/WSS endpoints have been failing throughout this week. It just hangs and doesn’t return anything. This is happening in BSC ...
user avatar
  • 13
0 votes
0 answers
12 views

Error: The method evm_increaseTime does not exist/is not available

While testing a time-dependent smart contract with truffle, I tried to use openzeppelin test-helpers' increaseTo function to forward time. I required the dependency as shown below, const { time } = ...
user avatar
0 votes
0 answers
11 views

Get correct price value

I am attempting to get the current prices for some tokens from Uniswap and SushiSwap. I am using this function: async getBuyPrice() { const pathToBuy = await this.routerContract.methods....
user avatar
  • 111
0 votes
1 answer
18 views

what is Sync event in solidity

I know Event is an inheritable member of a contract, when an event is emitted, it stores the arguments passed in transaction logs and this things are get stored into the blockchain. But i see there is ...
user avatar
1 vote
1 answer
32 views

Why is emitting an event considered as state-changing?

I put an emit Event(uint256 value) inside a function with view. But I got the below compile error by using npx hardhat compile: TypeError: Function declared as view, but this expression (potentially) ...
user avatar
1 vote
0 answers
14 views

Can I choose network on runtime in hardhat?

I've written a REST API using a hardhat server. I need to send the network through the API parameter. For example, currently, I've set the default network as polygon in config.hardhat.js, and it all ...
user avatar
0 votes
2 answers
78 views

Simple swap (exactInputSingle) on UniswapV3 (Rinkeby) - Transaction has been reverted by the EVM - Fail with error 'LOK'

I am using web3.js trying to make a simple transaction on UniswapV3 Rinkeby using the function exactInputSingle: import Web3 from 'web3'; import * as fs from 'fs'; import { exit } from 'process'; ...
user avatar
  • 1
0 votes
0 answers
11 views

i am trying to send a transaction but it throws an error. still i am not sending any transaction just signing it

eror on terminal if (!cond) throw new Error(msg) ^ Error: Expected private key to be an Uint8Array with length 32 and it's my code const Web3 = require('web3') const Tx = require('ethereumjs-tx')....
user avatar
  • 1
1 vote
0 answers
19 views

Subscribe to smart contract using go-ethereum

I am trying to subscribe to certain smart contract using go-ethereum. Here is the example of my function client, err := ethclient.Dial(config.AppConfig.SmartcontractHost) if err != nil { log.Fatal(...
user avatar

1
2 3 4 5
117