These are chat archives for Nethereum/Nethereum

Oct 2018
Oct 31 2018 07:31
Hello again. I've got another question (not related with the one about receipt's status). I've deployed a new smart contract with 2 functions, both receiving addresses as inputs and finishing with a return statement where one of the input addresses is returned. When I call them from Remix's JS VM, I can see the two outputs in the IDE's transactions window but, if I call the functions from Remix to my private network (injected web3), then only one of the functions returns a proper value and the second one's output is null. I've come across a link ( where is said that only constant functions can return values, but none of mine are constant and as I've explained, one of them is returning the proper value. Now, after this huge introduction (sorry, folks), I'm having the same behaviour when I call my smart contract's function from my C# code through Nethereum.Contract.Functions.CallAsync: the same function that returned the right value in remix works fine in my C# code and the one with the void return is returning a null object here. Is the link's statement right or am I doing something wrong?
Oct 31 2018 08:05

Hey @rsantirso, off the top of my head transaction receipts don't produce output (only input) - so if a function (not view/pure) which does a state change, you won't be able to get the output from the transaction, hence the need for Events.

Remix does it differently since it's running on a sandboxed environment.

Am on the road right now so I'll take another look once I am home. Could you share with me your contract code please so I could take a closer look, in case I am missing anything? Thanks.

Juan Blanco
Oct 31 2018 08:18
Thanks @myutzy
Oct 31 2018 11:11

You're awesome, @EnigmaticUnreal_twitter . I'm gonna write down some tips for beginners (like me) compiled after my conversation with Enigmatic:

1- You can return values from functions but your code can't be dependent on them after transactions. It is right to get and use those returned values after Calls.
2- CallAsync doesn't rely on web3.TransactionManager, so any gas value set in the manager won't affect calls.
3- Derived from previous point, feed CallAsync with a proper gas value.