These are chat archives for Nethereum/Nethereum

9th
Aug 2018
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 06:32
OH LOL just read the previous few posts and using the event attribute was already discussed before. Lesson learnt to always scroll up before scouring around code. Haha.
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 07:58
@userid2018 - Were you able to pull the events? If you're still having problems just beep. I stepped through the source codes and tried 3.0.0rc1 so I have a better intuition now of what you might be missing.
Juan Blanco
@juanfranblanco
Aug 09 2018 08:00
yes Events are declared as:
[Event("MyEvent")[
public class  MyEvent : IEventDTO {
}
and FunctiouOuput DTOs as following
[FunctionOuput]
public class MyOutput: IFunctionOutputDTO {
}
Reasoning.. for the event we can create the signature, and create filters, validate if a log is for the Event, using the interface it allows us to have extensions that are specific to the event (not others)
for the functioutOutput the interface in the same way allow us to have extensions like DecodeOuput
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:05
image.png
=D
Juan Blanco
@juanfranblanco
Aug 09 2018 08:06
yes and the new code generator in vscode is for 3.0.0 rc1
so you can use it if in doubt :) (also vb.net and f#)
for c# and vb.net you have partials per each message, dto so you can extend them (override / new properties for different decoding) without being over written by the code generator
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:10
Cool! I am gonna spread the word a bit. I think my friends are still using 2.5. :)
Juan Blanco
@juanfranblanco
Aug 09 2018 08:10
BTW FunctionOuput has never flagged an Event, mainly a while ago it the Event attribute was not added, but you can have an Event be also a FunctionOuput (same parameters)
RC1 is because the missing documentation
so not major changes
(structural changes) before release
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:12

BTW FunctionOuput has never flagged an Event, mainly a while ago it the Event attribute was not added, but you can have an Event be also a FunctionOuput (same parameters)

Referring to previous versions (e.g. 2.5.1)?

Juan Blanco
@juanfranblanco
Aug 09 2018 08:13
no even before that
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:13
Sorry if I am a bit slow in catching up. :pray:
Juan Blanco
@juanfranblanco
Aug 09 2018 08:13
like in 1.0
still would have work decoding but not building an EventABI using the Event
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:14
Understood. So it's 3.0.0rc1 which we should update our code to declare Event type with its name, and we can use EventABI.
So far... so good with my understanding?
Juan Blanco
@juanfranblanco
Aug 09 2018 08:15
well the EventAbi has changed slightly (well has many extension associated with it)
but yeah.. now you need the Event name
as it allows you to decode directly without a knowledge of contract (for example)
so it is enforce
for example you can use it to decode directly your logs from a transactionReceipt
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:19
Ah I see what you mean! I can see how that's helpful. I am thinking of using Events for one of my mini projects as storage, so was experimenting with data retrieving.
Thanks Juan. :)
Juan Blanco
@juanfranblanco
Aug 09 2018 08:20
 transactionReceipt.DecodeAllEvents<TransferEventDTO>();
example ^^
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:23
So all we really need to know is how the event is constructed. :) Instead of needing to have the whole contract ABI. Interesting - Will be trying this out.
Juan Blanco
@juanfranblanco
Aug 09 2018 08:24
yes that is the reasoning for the DeploymentMessage and FunctionMessage (old ContractMessage)
construct an object and reuse it across "compatible" contracts
Deployment and FunctionMessage have extensions to DecodeInput too
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:26
So one event listener can work for all other contracts with the same event signature.... Ahhh.
Juan Blanco
@juanfranblanco
Aug 09 2018 08:26
yep
or Function
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:26
nods :D
Juan Blanco
@juanfranblanco
Aug 09 2018 08:27
or FunctionOuput (too) with structs which could be part of a FunctionInput
(that is v2)
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:30
I would be happy to help with updating the documents, but I have not done any real OSS work before so... Probably would bring more trouble than actual help.
Probably I should look into helping with the workbooks.
Everything there is C# so far.
Juan Blanco
@juanfranblanco
Aug 09 2018 08:31
Sure feel free
yes it is c# as it runs the scripting runtime (that is workbooks)
Juan Blanco
@juanfranblanco
Aug 09 2018 08:38
still work in progress
in Roslyn
Juan Blanco
@juanfranblanco
Aug 09 2018 08:43
@EnigmaticUnreal_twitter btw Telerik does great conversions from vb.net <-> c# and viceversa
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 08:45
Oh yes they do. We were using it at my ex-job place when we were doing some decompiling and reverse engineering........... Though I probably should not say that.
I should really learn more C# though.
Juan Blanco
@juanfranblanco
Aug 09 2018 08:46
well it is the same(ish) just the syntax is different
Esteban Gallardo
@EstebanGameDevelopment
Aug 09 2018 09:32
@juanfranblanco I just wanted to thank you for your support. Thanks to you I was able to perform straight Ethereum transactions in my Unity plugin. I will keep developing project using Ethereum for Unity. If anyone is working or interested to work with NEthereum in Unity you can get the asset from the Unity Asset Store. Thanks also to all the NEthereum community!!! https://assetstore.unity.com/packages/add-ons/services/billing/your-ethereum-controller-123787
Juan Blanco
@juanfranblanco
Aug 09 2018 09:35
That is awesome @EstebanGameDevelopment , one thing can you point to the release page? https://github.com/Nethereum/Nethereum/releases/tag/3.0.0-rc1
I will have a go.. when I have a second :)
Juan Blanco
@juanfranblanco
Aug 09 2018 09:40
for the release
Esteban Gallardo
@EstebanGameDevelopment
Aug 09 2018 10:16
@juanfranblanco Sure!! I'll update the description of both packages in the Unity Asset Store soon. I've already updated the information in the README on the GitHub project: https://github.com/EstebanGameDevelopment/YourEthereumBaseProject
Juan Blanco
@juanfranblanco
Aug 09 2018 10:17
cool :)
Esteban Gallardo
@EstebanGameDevelopment
Aug 09 2018 10:21
I don't know if you guys are fans of Reddit, I made a post about it. Usually it gets buried by thousands of other posts, but a little of support could help us to promote NEthereum https://www.reddit.com/r/BlockChain/comments/95uijp/unity_developers_can_use_all_the_power_of/
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 10:22
:clap: :clap: :clap: :clap:
Zeshan Virk
@zeshanvirk
Aug 09 2018 12:22
Can we use Nethereum to interact with Vechain's blockchain?
as its also a fork of Ethereum blockchain
Zeshan Virk
@zeshanvirk
Aug 09 2018 12:52
here is vechain's documentation which is also using web3
https://vechain.github.io/thorify/#/?id=install
Cryt1c
@Cryt1c
Aug 09 2018 13:07
Hi, I am not sure if it's possible to filter for events without using a private key. Does it work if I initialise the web3 object without a private key?
Juan Blanco
@juanfranblanco
Aug 09 2018 13:41
@zeshanvirk i don't know
if they implement the evm and solidity and rpc methods the same yes
i can see they have specific methods
@Cryt1c yes, that will be a read only version , if not unlocking your node before hand and setting the "from" account
Cryt1c
@Cryt1c
Aug 09 2018 13:46
Can I unlock this service afterwards if need be or do i have to create a new one?
Juan Blanco
@juanfranblanco
Aug 09 2018 13:46
sorry just to rephrase..
if you start web3 with the url
you can read the chain , check events etc
if you want to write to the chain you can either:
have an Account with the private key (to sign the transactions before hand)
have a ManagedAccount to sign the transactions using personal_sendTransaction(pass, etc)
or unlock your account and sendTransaction (setting the From as the unlocked account)
Cryt1c
@Cryt1c
Aug 09 2018 13:50
thanks for the explanation. i think i understand now! :)
Juan Blanco
@juanfranblanco
Aug 09 2018 13:52
Short version, you only need your private key to sign transactions
Michael Ilchuk
@Ilchuk-Mihail
Aug 09 2018 13:52
Hi.
Why I can not deploy contract without estimated gas ?
var tx = await web3.Eth.DeployContract.SendRequestAsync(abi, bytecode, myAccount.Address, multiplier);
```        
     web3.TransactionManager.DefaultGas = Transaction.DEFAULT_GAS_LIMIT;
     web3.TransactionManager.DefaultGasPrice = Transaction.DEFAULT_GAS_PRICE;

      var estimateGas = await web3.Eth.DeployContract.EstimateGasAsync(abi, bytecode, myAccount.Address, multiplier);
``` 
error - Message = "intrinsic gas too low"
Juan Blanco
@juanfranblanco
Aug 09 2018 13:54
if use the ContractHandler it will estimate it for you
Michael Ilchuk
@Ilchuk-Mihail
Aug 09 2018 13:55
You have any example?
but that uses ...
(sorry multitasking)
now you can do what you have done yourself
Michael Ilchuk
@Ilchuk-Mihail
Aug 09 2018 13:59
I want to deploy contract (like multisig contract and interact with it) ?
What best solution for it?
Juan Blanco
@juanfranblanco
Aug 09 2018 13:59
first Estimate
and then use that estimate to deploy
i don't know what mutlisig contract you are using
but it is the same as any other contract
"same"
a part from the added complexity of the multisig and what contract you are using
Michael Ilchuk
@Ilchuk-Mihail
Aug 09 2018 14:08
it does not matter, now. I think somenthing like this - https://github.com/ethereum/dapp-bin/blob/master/wallet/wallet.sol
ok, i deploy contract with ContractHandler
but, the same issue
                var contract = web3.Eth.GetContract(abi, contractAddress);
                var multiplyFunc = contract.GetFunction("multiply");
                var transactionHash = await multiplyFunc.SendTransactionAsync(myAccount.Address, 7);
how to estimate for transaction, call contract function ?
Juan Blanco
@juanfranblanco
Aug 09 2018 14:14
the same.. you do call estimate first
and the send Transaction
or you can use the contract handler (same example above)
and that will do it automatically for you
or you can just set your own gas
Michael Ilchuk
@Ilchuk-Mihail
Aug 09 2018 14:22
                var contract = web3.Eth.GetContract(abi, contractAddress);
                var multiplyFunc = contract.GetFunction("multiply");
                var estGas = await multiplyFunc.EstimateGasAsync(myAccount.Address);
                var transactionHash = await multiplyFunc.SendTransactionAsync(myAccount.Address, estGas, null, 7);
Like this ?
One more questions - How get contract without ABI? Get only from address
Juan Blanco
@juanfranblanco
Aug 09 2018 14:44
you need the abi to be able to call a contract
this is required to know how to encode the types, what function to call
(signature)
Michael Ilchuk
@Ilchuk-Mihail
Aug 09 2018 15:02
ok, thanks
AXAGulf
@AXAGulf
Aug 09 2018 16:53
Hi I am using Nethereum + infura and getting an error SocketException: An existing connection was forcibly closed by the remote host
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 16:57
Which part of your code is throwing the error?
Since you explicitly said Infura, guess it works fine on localhost/Ganache?
Enigmatic
@EnigmaticUnreal_twitter
Aug 09 2018 17:02
Gonna go offline in a bit, check and see if it might be because you're on .NET4.5.1, since Infura upgraded to TLS2 :)
image.png
ShermanMeredith
@ShermanMeredith
Aug 09 2018 18:04
hey everyone, Im working in Unity. What happens if there is an overloaded function in the contract?
Does the function getter contract.GetFunction("overloadedFunctionName") care whether there are two functions with the same name? How does the function getter differentiate?
Juan Blanco
@juanfranblanco
Aug 09 2018 19:08
there is no way to work with overloaded methods that way
the best way is to use specific classes for that scenario
@ShermanMeredith