Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I need help on how to charge a transaction fee in ethereum smart contract using web3? Also which web3 API can be used to check the validation of enough gas on the frontend of smart contract?
Do you want to estimate the fee of the transaction?
let gasPrice = new BigNumber(15).times(1000000000);
let gasLimit = new BigNumber(21000);
let estimateFee = new BigNumber(gasPrice.times(gasLimit)).dividedBy(1000000000000000000).toString();
Required, but never shown