How can I get current gas price? I want to calculate the gas fee per transaction. I need to multiply Gas Price by _estimatedGas. I looked at the Gas price on https://bscscan.com/ it's 5 Gwei. Can I get this value through the code?
var _estimatedGas = new HexBigInteger(new BigInteger(35000));
try
{
_estimatedGas = func.EstimateGasAsync(
account.Address,
new HexBigInteger(new BigInteger(_transactionValue)),
new HexBigInteger(new BigInteger(_transactionValue)),
inputParameters).GetAwaiter().GetResult();
taskManager.Logger($"_estimatedGas: {_estimatedGas} \n", 7);
}
catch (Exception e)
{
taskManager.Logger($"Error can't get GAS amount {e.Message} \n \n", 7);
return;
}
taskManager.Logger($"amountMin: {((BigInteger)amountMin-_estimatedGas)} _estimatedGas.Value: {_estimatedGas.Value} _transactionValue: {_transactionValue}. \n \n", 7);
inputParameters[0] = new HexBigInteger((BigInteger)amountMin-_estimatedGas);