I made ERC20 token.
And I am going to implement to send token using web3.py.
Here I want to calculate gas price and gas limit using token transaction.
If anyone know about that, please help me.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
You will need to call web3 estimateGas function with the following parameters:
from: <sender public address> to: <recipient public address> data: <data>
The transaction fee is calculated based on what data is required. In your case, the method decimals() and transfer() is called to interact with your ERC20 standard token contract.
After acquiring the gas estimation, use web3 getGasPrice() function to get median gas price used in the last block. Multiply estimated gas and median gas price, you should be able to get your estimated transaction fee in wei format. Use web3.utils.fromWei to convert it to eth denomination.