Questions tagged [web3js]

Use this tag with questions about programming for the Ethereum JavaScript API.

Web3.js is open source and continuously updated since 2015. It has everything you need to start interacting with the Ethereum blockchain, giving easy access to accounts, events, smart contracts.

Useful links

2372 questions
14
votes
4 answers

Get token transfer detail from transaction hash with web3js

With web3js, how do you figure out that there was 40000 tokens transfer from the transaction's hash?
Chris Peng
  • 896
  • 1
  • 10
  • 23
14
votes
2 answers

Rinkeby: "replacement transaction underpriced"

I've been running a local Rinkeby node (in order to use websocket events) which was working fine for a while, but suddenly I have been getting "Returned error: replacement transaction underpriced". I am sending 10x the average gas price and I'm…
M1Reeder
  • 692
  • 2
  • 7
  • 22
13
votes
4 answers

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

Showing an error while calling solidity contract, which is deployed already in ropsten-infura. I'm using web3(@0.19.1) for calling contract. Anybody faced the same issue?
Aditya V
  • 548
  • 2
  • 8
  • 17
13
votes
2 answers

React Native and web3 v1.0.0

I've managed to run React Native and web3@0.19.0 with both rn-nodeify and ReactNativify successfully. I'm aware that web3 v1.0 does build the modules dynamically, but I'm wondering if anyone has been successful in integrating web3@1.0.0 into React…
user2067956
12
votes
2 answers

How can you transfer SOL using the web3.js sdk for Solana?

How can you transfer SOL using the web3.js sdk for Solana?
anondevpepe
  • 287
  • 1
  • 4
  • 8
12
votes
2 answers

Angular + web3.js: Module not found: Error: Can't resolve 'crypto'

I'm trying to get started with Angular and Web3.js to work with some Ethereum contracts. To reproduce: ng new npm install web3 --save ng serve package.json: { "name": "ng-eth", "version": "0.0.0", "scripts": { "ng": "ng", "start":…
Darthg8r
  • 12,377
  • 15
  • 63
  • 100
12
votes
3 answers

What to do about "transaction nonce too high" errors in RSK?

I have a decentralised application deployed on RSK, and has been working for several months. Everything works correctly using the public node, however infrequently, we start getting a totally random error: Unknown Error: { "jsonrpc": "2.0", …
7alip
  • 895
  • 6
  • 11
12
votes
2 answers

Web3 and Angular 11 broken dependencies

I'm trying to create Ethereum dapp with Angular. I was following that article: https://medium.com/blockchain-developer/learn-how-to-create-your-own-dapp-with-angular-9-part-iv-truffle-7704dc4269ab However, when I added web3 to app with npm install…
Szymon Żak
  • 491
  • 1
  • 3
  • 17
12
votes
3 answers

web3 websocket connection prevents node process from exiting

I have a node js process that creates a web3 websocket connection, like so: web3 = new Web3('ws://localhost:7545') When the process completes (I send it a SIGTERM), it does not exit, but rather hangs forever with no console output. I registered a…
Andy Pang
  • 387
  • 4
  • 10
12
votes
5 answers

calling smart contracts methods using web3 ethereum

Trying to work around the blockchain using Ethereum, I'm facing problems when trying to interface with a deployed contract. What I would try to achieve is to call a method to display information added to a private blockchain deployed locally using…
SKYnine
  • 2,708
  • 7
  • 31
  • 41
11
votes
4 answers

How fix "BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default" error?

I want use "web3" and "walletconnect/web3-provider" package on vue & laravel 8. I install it by npm i --save web3 @walletconnect/web3-provider command and after that I add follows codes for import to vue. import Vue from "vue"; import Web3 from…
Amin
  • 387
  • 1
  • 6
  • 17
10
votes
2 answers

How can I calculate the average gas cost per a transaction on RSK?

I want to calculate an average gas fee paid for all transactions on the RSK within the last three months. I tried to query the RSK blockchain using the Web3.js library. To get transaction data for just a single block height, I had to do: const…
Irene Patrikios
  • 249
  • 1
  • 5
10
votes
1 answer

How to get the price of a BEP20 token?

I would like to calculate the price of a BEP20 token in BNB. I checked poocoin and pancakeswap how they calculate the price. As I see they call continously the bsc-dataseed through web3.js, but I didn't find the solution yet. The current status of…
Erik
  • 101
  • 1
  • 1
  • 4
10
votes
1 answer

How to get pending transactions on BSC

I am trying to get pending transactions from the mempool on BSC using a websocket - the same way I was getting pending transactions on the Ethereum network: web3Ws = new Web3(new…
Crypto Miner
  • 125
  • 1
  • 2
  • 5
10
votes
4 answers

Web3.js extending the window interface type definitions

Web3.js web3 into the window object. Browser Wallets like MetaMask inject ethereum into the window object. In typescript right now to mitigate compile errors I'm casting as follows (window as any).ethereum After looking in the Web3 repository and…
Xavier
  • 831
  • 3
  • 9
  • 22