These are chat archives for Nethereum/Nethereum

22nd
Nov 2017
abhishek
@triston_abhi_twitter
Nov 22 2017 08:13
Hi Guys,
I am getting error "exceeds block gas limit" when sending transaction to contract function.
HexBigInteger estimategas = await con.GetFunction("functionname").EstimateGasAsync(transaction.Hash);
I am trying to get estimate gas from this function.
ChinhP
@Chinh-P
Nov 22 2017 10:18
maybe you need to set more gas for your transaction, currently how much did you set
abhishek
@triston_abhi_twitter
Nov 22 2017 10:25
I am getting Gas from below function
HexBigInteger estimategas = await con.GetFunction("functionname").EstimateGasAsync(transaction.Hash);
and set this value to object.
web3.TransactionManager.DefaultGas = estimategas.Value;
web3.TransactionManager.DefaultGasPrice = Nethereum.Signer.Transaction.DEFAULT_GAS_PRICE;
This works perfect for me till today.
But Today I am getting "exceeds block gas limit" error
Juan Blanco
@juanfranblanco
Nov 22 2017 11:19
@triston_abhi_twitter your gas supplied is bigger that the block gas limit
abhishek
@triston_abhi_twitter
Nov 22 2017 11:34
How we can calculate estimate Gas price?
Juan Blanco
@juanfranblanco
Nov 22 2017 11:38
you have calculated it
the problem is that your block gas limit is lower than the gas needed
so you are supplying too much gas
abhishek
@triston_abhi_twitter
Nov 22 2017 11:40
So basically let's say If I am getting this error the I have to reduce gas then send transaction?
abhishek
@triston_abhi_twitter
Nov 22 2017 11:48

you have calculated it
the problem is that your block gas limit is lower than the gas needed

Is there any code that can check, block has this much minimum and maximum gas?

So We can send Gas accordingly.
Juan Blanco
@juanfranblanco
Nov 22 2017 12:22
image.png
the latest block will tell you this
if you control the mining you can define this too
nice explanation here ^^
i would put it in the genesis
to start with
if you are planning to use it in a private chain
if not.. change your contract function to reduce the parameters etc
abhishek
@triston_abhi_twitter
Nov 22 2017 13:15
@juanfranblanco
I am storing value in my contract function.
What I figure is
If I am sending 64 character to function then transaction fee is 0.00095689
And If I am sending 100 character to function then transaction fee is 0.00156895
So this fess is depending on how much character we are storing to contract
And to execute contract function Gas is used and based on Used gas this transaction fees calculate
This is what I understand
So am i right?
Juan Blanco
@juanfranblanco
Nov 22 2017 16:15
yes thats about it, the more you store, calculate (opcodes used) your gas increases
Tatigo
@tatigo
Nov 22 2017 16:31
What to do when my contract method returns more then 1 param?
I'm using function handlers in Nethereum
QueryAsync<>
and [Function()] attributes
Juan Blanco
@juanfranblanco
Nov 22 2017 17:43
hi!
you need to use FunctionOutput
and create your output class
just add more properties
to your class
@tatigo ^^^^^^^^^
Tatigo
@tatigo
Nov 22 2017 17:51
@juanfranblanco thanks!
Babu Pillai
@b-pillai
Nov 22 2017 22:45
Hi Juan, Appreciate your work…
A basic question, I am having trouble getting the nethereum.tutorial or any projects to work having issues with references.
It seems like something with the build version. I am using visual studio community 2017 is that an issue?
Severity Code Description Project File Line Suppression State
Warning MSB3243 No way to resolve conflict between "System.Diagnostics.TraceSource, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Diagnostics.TraceSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Diagnostics.TraceSource, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily. Nethereum.Tutorials.Core C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 1964