TransWikia.com

How to charge a fee in ethereum smart contract transactions

Ethereum Asked on December 26, 2020

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?

One Answer

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

Answered by HelioWallet.com on December 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP