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

Listening to broadcasted transactions using geth --syncmode light

Since my attempts of using Web3.py to get pending txpool content rely on methods unsupported by Infura (and other) endpoints, I am trying to run a lightweight geth peer. I am using the following ...
0
votes
1answer
45 views

Is there a way to retrieve private key of ganache account with web3?

web3.eth.getAccounts() returns list of accounts. Is there a way around to get the private key of one of the account from the list returned from the above code?
0
votes
0answers
10 views

Events stop triggering after a while

I created a script that subscribes to PairCreated event on Uniswap using Web3 and Infura API. The event works for a few minutes but stops working after a while (timeouts?). How can I make it watch the ...
0
votes
0answers
43 views

Error: Returned error: gas required exceeds allowance (12487794) or always failing transaction

I am trying to use a script which uses web3.js to transfer a specific amount of ERC20 tokens .I have made this script in such a way that if account doesnt has ether value it will try again and again ...
0
votes
0answers
21 views

the best way to monitor my own account transactions in openethereum

Please I want to know if I subscribe to pendingTransactions with web3 will it monitor and send notifications of accounts pending Transactions only or all pending transactions on Ethereum network. my ...
0
votes
0answers
8 views

All requests routed to submodule when changing its provider in web3js

Using web3.js 1.2.11, I expect the last part of the following code to route requests from the web3.eth.personal module to the IPC socket, and requests on web3.eth to TCP port 7545. let Web3 = require('...
0
votes
0answers
7 views

Rerendering causes results to display twice (possibly caused by async event emission)

This may seem like a web developer problem at first but i think it pertains to how function calls are done in solidity. So basically i have a voting application which triggers an event every time a ...
0
votes
2answers
29 views

Offline creation of signed contract transactions with web3js v1.2.11

I'm attempting to sign a contract transaction offline using web3js v1.2.11. signingAddr = //my eth address signingPk = //my private key // docs: The options object for the contract instance. from, ...
0
votes
1answer
27 views

web3.utils.toWei(web3.utils.fromWei(…))

Is it warranted that web3.utils.toWei(web3.utils.fromWei(x)) is equal in numeric value to x (provided that x is a 256 bit number represented as a string)? If it is not warranted, how to obtain a value ...
0
votes
0answers
65 views

Query returned more than 10000 results with getPastEvents

I am writing a function to sync all transactions on a particular contract from a particular account in my local database to build a dashboard for account owners. I need to fetch all the past transfer ...
0
votes
2answers
14 views

Web3 works on mainnet, not on Ropsten

I have an identical contract on the Mainnet and Ropsten. Both work fine in Remix. Using a python program on my Windows machine, I find that I get an error accessing the Ropsten contract, but not the ...
0
votes
1answer
42 views

MetaMask displaying wrong value when making RPC sendTransaction call

I have been trying to send a transaction using an RPC call with MetaMask's window.ethereum.request injected method. I have successfully sent a transaction before, by using the web3js method web3.eth....
1
vote
1answer
39 views

geth mining not working without --allow-insecure-unlock (geth 1.9.16-stable-ea3b00ad)

I am running a private ethereum blockchain with POA geth --port 3000 --networkid 42 --datadir=./blkchain --maxpeers=5 --rpc --rpcport 8543 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --rpcapi &...
0
votes
0answers
14 views

Signing text with special UTF8 characters browser vs node web3js

I am attempting to get consistent signatures / recovery for text containing special characters. For example, the bitcoin symbol U+20BF, ₿ Junk address and private key: ...
1
vote
0answers
15 views

Filter past events with condition

Is it possible to filter past events with a boolean condition? For example I have the following event: event ExampleEvent(uint256 exampleNumber); In my js code I can filter these events with the == ...
0
votes
2answers
56 views

Why do blockchain networks like Ethereum utilize JSON RPC calls and not REST APIs or graphQL?

I'm sorry. This might be a silly question but I am very much new to backends and networking protocols. I can write decent smart contracts but I don't know much about the backend. So... I wanted to ...
0
votes
1answer
26 views

call a contract function which creates a new contract in web3.js makes an error VM Exception while processing transaction: revert

At first I'm developing with truffle v5.1.34, Node v10.16.0, Web3 v1.2.4 To make it simple, I have a Two contracts, DApp and User What i'm doing is call a DApp contract function which creates a new ...
0
votes
1answer
14 views

How to check the current MetaMask network?

How to check the current MetaMask network? For example, if the current network is Rinkeby, I need the string "rinkeby".
0
votes
1answer
40 views

How to make this interact with metamask

I've been trying to make my contract be callable by metamask (so a popup will occur telling the user to confirm) but it does not seem to work, heres what I have come up with so far. Can anyone give me ...
0
votes
1answer
35 views

unable to see the first address using web3.eth.getAddress()

I tried to see all address using web3.eth.getAccounts() It's run perfectly. Next I tried to see the first address using web3.eth.getAccounts().then(function(accounts) {return accounts[0]}) It's also ...
0
votes
0answers
9 views

Trouble making an affiliate program with Ethereum

Is it possible to make an affiliate program with Ethereum without requiring a new user to register before he starts to earn or spend money? (but instead using his Ethereum wallet address as his ...
0
votes
1answer
55 views

ipfs.add is not working

I am trying to upload my file to IPFS and save its hash to my Ethereum contract but neither ipfs.add nor ipfs.files.add is working for me... I have tried usin for loop i.e. for await (const result of ...
0
votes
1answer
46 views

How to set values for Solidity contract state variables from JavaScript front-end?

I am trying to set values to the following contract public state variables from a frontend javascript code. But it seems not working. Contract public state variables: // Current state of the auction. ...
0
votes
1answer
14 views

Web3js events and their callback functions are not aware of component state?

I have problem with web3js 1.2.9 Events triggering works fine and data is alright but I cannot figure out how to use component state in this functions that are triggered by event. I cannot access ...
0
votes
1answer
28 views

WEB3.JS problem

I am trying to use the library “ethereumjs-tx” but it does not work. I get this error message: “TypeError: Tx is not a constructor” on the code “const tx = new Tx(txObject)”. Here is my code: const Tx ...
0
votes
1answer
48 views

Use web3.js without MetaMask

I have <script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.2.9/web3.min.js"></script> How to use this web3.js on browsers without MetaMask (for read-only Ethereum queries)...
0
votes
1answer
31 views

How to use erc20 token in integer, not decimal

I want to use number as normal integer, not in decimal. For example, when I use uniswap function IUniswapV2Router02Instance.methods.swapETHForExactTokens(1, , , ).send() in my project, an argument ...
1
vote
0answers
22 views

How to get event from geth ethereum node using web3.js

I have created a simple contract where I am trying to write a value to a state variable in solidity smart contract, and emit that written value. I am using Truffle v5.1.28 (core: 5.1.28) Solidity - 0....
1
vote
0answers
15 views

Getting name/decemals of unstandardized token on Ethereum blockchain with web3.js

I understand how to call methods of name/symbol or decemals on ERC-20 tokens but what about tokens that do not have such.. for example this token here https://etherscan.io/token/...
0
votes
1answer
194 views

Warning! Error encountered during contract execution [Reverted] web3

When calling from Remix IDE, it executes successfully. But when calling from web3 v1.2.9, it gives the above error. Here is the contract : https://ropsten.etherscan.io/address/...
1
vote
2answers
37 views

Get current metamask account method not working anymore

I was using the following method to access the selected account on metamask through web3 v1: //metamask method that refresh the active account in the web this.web3.currentProvider....
0
votes
0answers
23 views

Web3 IPC provider connect?

I am using Infura web3 provider to connect etherum but I want to use IPC provider(more secure), How to use IPC provider in ethereum web3.
0
votes
0answers
35 views

Disabling nonce check for go-ethereum for a private test net when using web3js batch requests to send tx

I am using web3js batch.add and batch.execute to send tx for an ethereum private testnet that I have created. I send tx using batch.add and batch.execute (don't prefer to use promises since they ...
0
votes
0answers
19 views

Why does my smart contract method fail when called via Web3.js with more than one argument?

Observation(s): When calling a compiled smart contract method via Web3.js, my contract method createOrder succeeds when the method only accepts (1) argument. Upon updating and re-compiling the smart ...
0
votes
0answers
36 views

Insufficient funds for gas * price + value in Ropsten

I write API for smart contract but its shown error "Insufficient funds for gas * price + value"? My try I have increased my address balance but it's showing the same error. I have changed my ...
0
votes
0answers
9 views

web3.eth.accounts.wallet.create() works on desktop Chrome but not on mobile

The following lines of code work (a generator function of redux-saga in my React app) on desktop Chrome. However, it does not work on desktop Safari, iOS, and mobile Chrome (on Android). Did not works ...
0
votes
1answer
28 views

Which method is efficient to log data in blockchain? Send an event via smart contract or send data in a transaction without value?

I want to log data in Ethereum block-chain. It is obvious that we can create a smart contract that emits events and retrieve data from it. But is sending a transaction with data but no ETH value (just ...
0
votes
1answer
24 views

Error when retrieving the instance of a deployed contract

I have developed a EnergyExchange DApp in the Ganache local network with React that consist of one main contract "EnergyExchange". This main contract has a function to deploy new Agent ...
0
votes
1answer
16 views

Error when calling a get function from a deployed contract instance

I have developed a EnergyExchange DApp in the Ganache local network with React that consist of one main contract "EnergyExchange". This main contract has a function to deploy new Agent ...
0
votes
0answers
24 views

How to connect local private geth nodes to the web page without using metamask or mist?

I'm developing a web wallet similar to meta mask that can make transactions or can create accounts from UI. Frontend is developed using React. Blockchain is implemented in geth.I'm using truffle react ...
0
votes
1answer
19 views

how to check instantly when a user charges amount to his address generated by our app

Our app needs to detect and create a charging order asap whenever a user charges an amount of ETH/USDT(ERC20). Due to the limit of infura API, we decided to set up our own ETH nodes and use JAVA to ...
0
votes
0answers
67 views

How to estimate gasLimit of ERC20 contracts in web3.php project?

I am using web3.php project in my Ethereum based project. A part of this project is sending ERC20 tokens, and in this regard, I need to estimate gas limit of transaction. For this purpose, I found the ...
0
votes
0answers
39 views

how to send transaction without private key ganache?

I need access to oracle accounts (whose private keys i do not have) to test my contract. I'm trying to use ganache to fork my local node with the accounts unlocked through the ganache api, but ...
0
votes
1answer
22 views

What is the equivalent of “buildTransaction” of web3Py in web3JS?

I'm using Node to interact with my smart contract. I understand that I need to first sign my transaction before sending it. In one of the StackExchange answers I see that it can be done using ...
0
votes
0answers
34 views

How to perform Web3 & MetaMask user sign in

I'm new to blockchain development and would like to build an app with node.js, express.js, next.js, web3, meta mask for user sign in. Are there any good docs that would help me out thank you.
0
votes
0answers
32 views

`web3.eth.abi.decodeParameters()` not returning correct values

I call to a method that returns two contract addresses, like this, where method is the method object taken from the ABI (triple-checked that already): web3.eth.call( { from: account, ...
1
vote
1answer
26 views

Does the term “Ethereum ECDSA signature” have a consistent meaning?

If you were writing some instructions and one of them was: Provide the Ethereum ECDSA signature of the file using the person's Ethereum address. Would the above instruction have a consistent meaning ...
0
votes
0answers
24 views

GETH full node genesis mismatch

I was running a full node GETH client for main net Ethereum in a server. The server crashed and was shut for around 8 hours. But after fixing the server and running the full node the GETH doesnt run. ...
0
votes
1answer
40 views

Error: Returned error: VM Exception while processing transaction: revert when using methods.MyMethods.Send

I am writing a simple betting application that will return double the ether deposited by the player, provided they guess correctly the random number generated by the virtual slot machine. it works ...
1
vote
1answer
40 views

The send transactions “from” field must be defined using Infura web3

when I try to send my transaction using infura I get this error "The send transactions "from" field must be defined" My problem is my web3 object. When I used Metamask and ...

1
2
3 4 5
80