Categories
Cryptocurrency Ethereum Mastering Development

How can I set my custom gas Price and gas Limit?

I want to set my custom gas and gas Price in sendTransaction method.Currently I set it but when i send the transaction gas fee is showing 0.21 ETH in metamask. How can I solve this?

web3.eth.sendTransaction({
   from: currentAccount,
   to: toAddress,
   value: web3.toWei(value, 'ether'),
   gasPrice: web3.toWei("0.00001" , 'ether'),
   gasLimit: '21000',
   chainId: '0x1'
}

Above is my code. How can I solve it?

Leave an answer

Your email address will not be published. Required fields are marked *