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
6
votes
4 answers

How to connect Metamask to Angular App using Web3.js?

I have just started exploring Blockchain technologies and made my first smart contract the other day. To continue, I have tried to make a frontend for the smart contract but I am facing difficulty connecting my Angular App to Metamask using…
nlanson
  • 357
  • 1
  • 3
  • 14
6
votes
1 answer

getTransaction vs getTransactionReceipt

What is the difference between two methods web3.eth.getTransaction and web3.eth.getTransactionReceipt in the web3 library? I tried to read this documentation https://web3js.readthedocs.io/en/v1.2.0/web3-eth.html#gettransactionreceipt but the…
Anh Dũng Lê
  • 163
  • 1
  • 1
  • 4
6
votes
1 answer

eth_sendTransaction does not exist/is not available

I'm currently using ERC721PresetMinterPauserAutoId for a smart contract and the Web3.js library in the Node.js backend server. When I try to call the mint function using this Web3 API: var myContract = new…
Kevvv
  • 3,655
  • 10
  • 44
  • 90
6
votes
1 answer

web3 gives " Error: Returned error: invalid sender" when broadcasting transaction

I am new to web3 and ethereum blockchain. I tried broadcasting a transaction using the following code but it always gives me an invalid sender error.The sample code is shown below. const Tx = require('ethereumjs-tx').Transaction; const Web3 =…
pacman
  • 725
  • 1
  • 9
  • 28
6
votes
4 answers

How to get pending transactions in ethereum using web3?

I need to calculate the nonce for successive transactions using web3js in Ethereum, but getTransactionCount does not return pending transactions. Is there a way to get all transactions including both pending and completed transactions using web3js?…
Abhishek Kumawat
  • 780
  • 1
  • 10
  • 25
6
votes
2 answers

Get all Ethereum accounts from Metamask

I want to get all the accounts that a user has added in Metamask. I tried all web3.js methods to get accounts, but I always get just one account which is always the currently selected one. According to web3.js documentation, web3.eth.getAccounts()…
Vishal
  • 345
  • 1
  • 3
  • 10
6
votes
1 answer

ERC20 Tokens Transferred Information from Transaction Hash

EtherScan provides a API for transaction details It's part of Geth/Parity Proxy APIs by name eth_getTransactionByHash, But I am unable to get information what ERC20 token was transferred and how many. I need Token Details and Number of token…
Mangesh
  • 2,257
  • 4
  • 24
  • 51
6
votes
2 answers

Ethereum Web3.js: Intrinsic Gas too low

I have been trying to send a transaction on the Ethereum testnet Rinkeby for the past few days and keep getting this error no matter how much I increase the gas to. "Unhandled rejection Error: Returned error: intrinsic gas too low" The data I am…
6
votes
1 answer

What is the difference between web3.eth.accounts.create and web3.eth.personal.newAccount

As I understand when using web3.eth.accounts.create(), it doesn't add the account to chain (I'm using ganache-cli for testing), but web3.eth.personal.newAccount() does. Is it the main purpose or is it a bug? Is there other differences? web3.js…
Galti
  • 135
  • 3
  • 11
6
votes
2 answers

Filter out empty address in web3.js

How to detect empty address that has initial value of 0x0000000000000000000000000000000000000000 in web3.js? What I'm doing now is: if (address !== '0x0000000000000000000000000000000000000000') { ... } Is there any simpler way to filter out…
viz
  • 1,247
  • 16
  • 27
6
votes
1 answer

Gas requirement of function high: infinite

Below is my smart contract. When I put it in remix, I get warnings on each of the following functions. Gas requirement of function MedicalRecord.addNote(bytes32,bytes32) high: infinite. Gas requirement of function MedicalRecord.getDoctorsNames()…
bak
  • 206
  • 2
  • 9
6
votes
1 answer

How to save and retrieve data on Ethereum blockchain with Solidity and Web.js

The below code only returns a receipt but I want it to return a tuple of data, like in the contract below. How do I get it to return the data? I can't find a good tutorial on how to save and retrieve data. I know this is an expensive use case, I'm…
Matthew Harrison
  • 878
  • 11
  • 17
6
votes
2 answers

Truffle error: Error encountered, bailing. Network state unknown. Review successful transactions manually

Every time I try to deploy truffle migrate --reset my Organization.sol contract, I get the following error: Error encountered, bailing. Network state unknown. Review successful transactions manually. I Googled the error and apparently this is due…
Red Ghost
  • 302
  • 2
  • 12
6
votes
1 answer

Send Raw Transaction Ethereum infura nodejs npm

I'm currently trying to implement an ethereum Node Connection to my Typescript/ Node Project. I'm connection to the "Infura" node server where i need to sign my transaction locally. Well, anyway. I'm signing my transaction using the npm package…
5
votes
2 answers

ethers web3Modal Property 'providers' does not exist on type 'typeof import(...)'

I am trying to add web3 wallet connect button onto my webpage but I am getting this error and I am not able to resolve it since a long time. It is a nextjs react application. const InvitesPage: NextPage = () => { let web3Modal: any; useEffect(()…