I am using following code to generate a new transaction using web3.js & metamask:

var web3dictdata = {
  gasPrice: web3.toHex(10),
  gasLimit: web3.toHex(210000),
  to: "0x92EB887e5de9f2C73C08483831F47dc0CD8f7B0c",
  value: web3.toWei(0.01, "ether"),

web3dictdata.data = "0x7770334469734b58777148446a4d4f5177345f4370634b59777154436e634f52777148436e4d4b56777076446b4d4b657770374372384b66777072446b634b657771544371734b5877345f436f734f4a77706e436d634f5477707a446a384f4e";

web3.eth.sendTransaction(web3dictdata, function(error, receipt) {
  if (error)
  } else {

But whenever I am launching it, it ends up in generating a new transaction filled with the data, 'to' address along with the value of a transaction. The missing points are:

  • gasPrice
  • gasLimit

User, in order to successfully send a transaction, has to fill the gas Price on his own, which totally destroys my vision of the application


enter image description here enter image description here

  1. The parameter is gas instead of gasLimit. I've ran into this issue several times.

  2. It looks like gasPrice is getting through correctly. It shows 0,00000001 gwei, which is 10 wei, because that's what you're passing in. You have to convert gwei to wei to get the correct value using `web3.utils.toWei("10", "gwei").

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.