These are chat archives for Nethereum/Nethereum

28th
Sep 2017
Chandra Sekhar
@tcsekhar
Sep 28 2017 00:23

I created few smart contracts which stored lets say a string value during each transaction - historically in a private blockchain. If I have the transaction address, is there a way to pass in the transaction address and get the value stored in that transaction?

Can you please share some code which will allow me to do this?

Juan Blanco
@juanfranblanco
Sep 28 2017 06:20
You can use events check the docs for samples
amjadDev
@amjadDev
Sep 28 2017 07:13
is token transfer is automated in erc20 token or we need to trigger any event?
@juanfranblanco
@kaista82_twitter
Juan Blanco
@juanfranblanco
Sep 28 2017 07:20
? Events are written to the log
@amjadDev have a look at the erc20 contract
amjadDev
@amjadDev
Sep 28 2017 07:22
ye i saw this
not implemented yet
Juan Blanco
@juanfranblanco
Sep 28 2017 07:23
Also I recommend to go through the videos/ docs if not done already to understand events
amjadDev
@amjadDev
Sep 28 2017 07:23
but i want to know that erc20 starnd alow automatic token transfer once ether recived?
or we have to do it manully throughe event by triggering
Juan Blanco
@juanfranblanco
Sep 28 2017 07:24
The erc20 standard is a token standard not made to receive Ether
That will be done in another type of contract that will allow for the exchange of Ether for tokens
I do not recommend you to do it if you don't have the expertise in solidity
But you can have a look at any ico, or solidity library like dappsys or Zeppelin
amjadDev
@amjadDev
Sep 28 2017 07:34
okay
Juan Blanco
@juanfranblanco
Sep 28 2017 07:51
Also note that the standard is an interface you can do whatever you like internally
Scot Wallace
@nestforce
Sep 28 2017 08:55
Hi, when upgrading to 2.0.0, I got the error like this
Nethereum.JsonRpc.RpcClient.2.0.0 : Nethereum.JsonRpc.RpcClient.2.0.0 : EdjCase.JsonRpc.Client [1.3.1, ), Nethereum.JsonRpc.Client [2.0.0, ), Newtonsoft.Json [9.0.1, )[1.3.1, ), Nethereum.JsonRpc.Client [2.0.0, ), Newtonsoft.Json [9.0.1, ) doesn't exist in my project.
and I check the version of EdjCase.JsonRpc.Client and Newtonsoft.Json , they are 2.0.0 and 10.0.3.
Is it possible to build Nethereum based on those versions ? Thanks.
Juan Blanco
@juanfranblanco
Sep 28 2017 08:56
The edjcase will not move version after further testing
it might be replaced eventually all together
Newtonsoft has been ugraded now in master
Scot Wallace
@nestforce
Sep 28 2017 08:58
understood, thanks for your reply. I can only wait for that day XD
Juan Blanco
@juanfranblanco
Sep 28 2017 08:59
you can downgrade to 9.0.1 for the time being
any reason you are jusing EdjCase on version 2.0 ?
Scot Wallace
@nestforce
Sep 28 2017 09:01
seems like some other libs depend on that.
Juan Blanco
@juanfranblanco
Sep 28 2017 09:01
Nethereum should be the only one using that, I understand the Json library
I will push something tonight with the update for Newtonsoft
Scot Wallace
@nestforce
Sep 28 2017 09:02
let me try to downgrade to 1.3.1
Chandra Sekhar
@tcsekhar
Sep 28 2017 13:49
I went through the events and I wasn't able to find code which queries a older/historical transaction and gets the value that was stored then in that smart contract. The examples I'm seeing are getting the value thats stored but it gets only the latest value - not the historic time value for that specific transaction. Can you please help?
Example: I created a smart contract on the 20th, set a value of "20" to a variable calling a function, and I have the transactionid for this. Now, today is the 28th, and I have the old transactionid. Now I need to check what the value was set during that transaction which happened on the 20th.
Juan Blanco
@juanfranblanco
Sep 28 2017 13:53
so mainly you want to query the state of a contract
not a transaction
Chandra Sekhar
@tcsekhar
Sep 28 2017 13:53
yes state of the contract. Sorry for the confusing words
Juan Blanco
@juanfranblanco
Sep 28 2017 13:53
for a specific block
Chandra Sekhar
@tcsekhar
Sep 28 2017 13:54
All I have is the transaction id or hash from that previous transaction
Juan Blanco
@juanfranblanco
Sep 28 2017 13:59
when you do a call you pass the blockNumber you are interested
you get the blockNumber from your transaction id
Chandra Sekhar
@tcsekhar
Sep 28 2017 14:02
         var documentsFunction = contract.GetFunction("getName");
        receipt = await MineAndGetReceiptAsync(web3, transactionHash1);
        var result = await documentsFunction.CallAsync<string>();
This is what I was using and its always getting the latest value. How do I pass in the blockNumber
Juan Blanco
@juanfranblanco
Sep 28 2017 14:02
one of the overloads
Chandra Sekhar
@tcsekhar
Sep 28 2017 14:03
ok
Alexander Yarushin
@aayarushin
Sep 28 2017 14:05
Hi @juanfranblanco! Is there a mapping between types in C# and solidity that you can share?
Juan Blanco
@juanfranblanco
Sep 28 2017 14:05
those are in the abi library
Chandra Sekhar
@tcsekhar
Sep 28 2017 14:05
thank you
but if you look at the code generator
that gives you a simple perspective of default types
Alexander Yarushin
@aayarushin
Sep 28 2017 14:11
Found these - mappings?
image.png
Juan Blanco
@juanfranblanco
Sep 28 2017 14:11
yeah
still nothing is perfect
Alexander Yarushin
@aayarushin
Sep 28 2017 14:13
GetTypeMap yes
I also wonder about default (unasssigned) values
address I already know has 0x0 as default
how about other types?
Juan Blanco
@juanfranblanco
Sep 28 2017 14:14
is not just that
people might use bytes32 as a string
or int
or byte[]
int default is a bigInteger
lots of obscure mappings
that are not relly default
really
Alexander Yarushin
@aayarushin
Sep 28 2017 14:15
The reason I wonder about defaults is also to check for unassigned values....
in solidity :)
Juan Blanco
@juanfranblanco
Sep 28 2017 14:15
ah.. good point
it will return
an 0 based byte[]
so ints / uints will be 0 (not -1)
Alexander Yarushin
@aayarushin
Sep 28 2017 14:17
will bool be false? :)
Juan Blanco
@juanfranblanco
Sep 28 2017 14:17
yes
:)
so everything will need some user business logic to handle their solidity logic
Alexander Yarushin
@aayarushin
Sep 28 2017 14:18
very useful ...
Juan Blanco
@juanfranblanco
Sep 28 2017 14:18
but users should do that
Alexander Yarushin
@aayarushin
Sep 28 2017 14:19
have to
Juan Blanco
@juanfranblanco
Sep 28 2017 14:19
ie what int they want to use
Alexander Yarushin
@aayarushin
Sep 28 2017 14:19
:)
Juan Blanco
@juanfranblanco
Sep 28 2017 14:19
ha ha yeah :D
Alexander Yarushin
@aayarushin
Sep 28 2017 14:20
all bytes[], int, uint have default 0?
Juan Blanco
@juanfranblanco
Sep 28 2017 14:20
check remix
contract Test {
    int public intTest;
    byte public byteTest;
    string public stringTest;
    uint public uintTest;
}
you will see the output
but solidity might change tomorrow :)
blob
Juan Blanco
@juanfranblanco
Sep 28 2017 14:33
so yes (sorry if not clear )
not aiming to be cryptic :D
Sebastian Giro
@SebastianGiro
Sep 28 2017 16:53

Hey guys, can anybody help me?

I was able to generate a new private key and address in Unity using Nethereum.Signer.EthECKey.GenerateKey(). But now I need to encrypt it and save it in the device (and later decrypt it). There is a lib for that or I need to create it?

kai
@kaista82_twitter
Sep 28 2017 16:54
Keystoreservice i think its called
Sebastian Giro
@SebastianGiro
Sep 28 2017 16:55
Can't find it in the unity dll's files :(
Load from the account class
Sec ill find save
Sebastian Giro
@SebastianGiro
Sep 28 2017 17:02
I think in Unity I don't have Accounts or KeyStorage
At least I can't find it in the tree or with a deep search
kai
@kaista82_twitter
Sep 28 2017 17:03
Ohhhhh unity
Sebastian Giro
@SebastianGiro
Sep 28 2017 17:03
Yep :P
image.png
kai
@kaista82_twitter
Sep 28 2017 17:07
Erm never used the unity stuff im afraid Juan is the man you need
Fernando Garcia
@fergarrui
Sep 28 2017 17:07

Hi! I think the last question and I am good to go!
I successfully added the .dlls to an Unity project, everything is fine, I can query for blockNumbers, gasPrice and this kind of stuff.
Now I want to call a contract, but the 'Contract' class is not included in any of those .dlls, right? So I imported Nethereum-portable to the project. It finds the class 'Contract' now, but there is a conflict because of Function is now duplicated under the same namespace I guess (as you can see I am new to C# development), the error I get is:

CS0433 The type 'BlockParameter' exists in both 'Nethereum.Portable, Version=1.0.6478.30829, Culture=neutral, PublicKeyToken=null' and 'Nethereum.RPC, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' Assembly-CSharp D:\Unity\Projects\ProyectEth\Assets\test.cs

Would be fine if Contract class is in any of those Unity's dlls, maybe I am missing something but if I don't add the Nethereum-Portable, I can't find 'Contract'.

Thanks a lot!

kai
@kaista82_twitter
Sep 28 2017 17:32
You wont be able to have both
Sebastian Giro
@SebastianGiro
Sep 28 2017 17:33
@kaista82_twitter ok, Thanks for your help anyway :)
Sorry sebastian just wait for juan
He will help
Hes a nice guy
Sebastian Giro
@SebastianGiro
Sep 28 2017 17:35
Cool thanks! <3
Juan Blanco
@juanfranblanco
Sep 28 2017 17:46
you cannot use any of the "normal" libraries with unity
Sebastian Giro
@SebastianGiro
Sep 28 2017 17:47
Hi @juanfranblanco , Yep I know.
So I will need to create a lib to store the keys and encrypt them right?
Juan Blanco
@juanfranblanco
Sep 28 2017 17:48
my bad I have not include them on the zip release
Sebastian Giro
@SebastianGiro
Sep 28 2017 17:48
lol
Good to know, I'll wait for the new .zip then. Thanks a lot!
Juan Blanco
@juanfranblanco
Sep 28 2017 17:49
give 5 / 10 minutes
Sebastian Giro
@SebastianGiro
Sep 28 2017 17:50
Lunch time then
Juan Blanco
@juanfranblanco
Sep 28 2017 17:50
need to automate the unity part
Juan Blanco
@juanfranblanco
Sep 28 2017 17:57
@SebastianGiro @fergarrui libraries are there now
Sebastian Giro
@SebastianGiro
Sep 28 2017 17:58
Nicee, I will try it
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:05
I'm having a weird error (warning?) with the contracts file
Juan Blanco
@juanfranblanco
Sep 28 2017 18:05
sure what is the problem
might need to do a full repackaging
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:06
TypeLoadException: Could not load type 'Nethereum.Contracts.Contract' from assembly 'Nethereum.Contracts, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
Juan Blanco
@juanfranblanco
Sep 28 2017 18:06
hmmm
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:06
image.png
Full message
I deleted all the .meta files and the folder of the netherum files, and imported it again from scratch
Juan Blanco
@juanfranblanco
Sep 28 2017 18:08
yep
let me do a full rebuild again
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:08
:D
Juan Blanco
@juanfranblanco
Sep 28 2017 18:09
like I said I need to automate this :D
blob
that is working
let me upload it again
Juan Blanco
@juanfranblanco
Sep 28 2017 18:13
thanks for the feedback
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:15
We are doing a proof of concept with netherum, to do a big project later, so I might be asking you more questions in the future :)
Juan Blanco
@juanfranblanco
Sep 28 2017 18:16
excellent
added the files again
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:17
(Y) Also, there is no slack for netherum right?
Juan Blanco
@juanfranblanco
Sep 28 2017 18:17
no there is not
I thought about creating a forum
maybe rocket chat
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:18
The problem with the forums = slow response rate
Juan Blanco
@juanfranblanco
Sep 28 2017 18:19
yes true
but they are good to keep the history
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:19
Yep
Juan Blanco
@juanfranblanco
Sep 28 2017 18:19
you cannot win
btw any reason you would prefer slack?
(if you do)
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:23
I have the app installed, and I use it all the time, and I had find some bugs in gitter that I don't have in slack.
But it's not a mayor issue. Its just to have everything under the same app
(Also in slack you have threads)
By the way, great work on the library, it has been super useful for us. (Working the new .zip). Thanks a lot!
Juan Blanco
@juanfranblanco
Sep 28 2017 18:33
yes true about the threads
only thing is that slack is not as user friendly to register
maybe rocket chat
as it will help to bring different communities
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:34
I never tried it. I will have a look later
Juan Blanco
@juanfranblanco
Sep 28 2017 18:34
like unity :), dapps, enterprise, cloud, etc
it is like slack but you have control over it
as you can host it, so registration is not such a bad experience
actually I have not tested the mobile side
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:35
Oh, and slack mobile works very well
Juan Blanco
@juanfranblanco
Sep 28 2017 18:36
it does
but gitter does too actually
Sebastian Giro
@SebastianGiro
Sep 28 2017 18:39
Indeed
The problem having more than 1 place to talk, is that you are not going to have all the people in the same place. And it will be a pain too keep with all the communication channels
Juan Blanco
@juanfranblanco
Sep 28 2017 18:50
yes slack will help on all the different topics
not just technical
and different communities
Fernando Garcia
@fergarrui
Sep 28 2017 20:18
Thanks a lot, Juan