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?

  • You charge fee in the contract, what does web3 has to do with this??? – goodvibration Jun 30 '19 at 10:25

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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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