These are chat archives for Nethereum/Nethereum

4th
May 2018
snowycrypto
@snowycrypto_twitter
May 04 2018 05:24
Anyone know how to integrate core libraries into Unity3d?
For ex, the Nethereum.HDWallet core library doesn't seem to be included in the release 2.2.1 Unity3d
snowycrypto
@snowycrypto_twitter
May 04 2018 05:38
Then rebuild?
Apologies, I'm new to C#
jandroalvarez
@jandroalvarez
May 04 2018 06:24
@juanfranblanco thanks for the snippet, i'll try it out and i'll let u know!
jandroalvarez
@jandroalvarez
May 04 2018 07:02
No luck
byte[] nonceTest = "0x2fcf354bbb8cf7f338a3b5b7a068043a2c91140b6fbd03ae32f7b1d6eddf124a".HexToByteArray();
var contentFilterId = await pushed.CreateFilterAsync("0x4481D6d6BF93B4c16994Cf5cf4885c55b8A0777D", "0x928014e42199b7C9f7A37b0a78060D7EA4C23ea0", nonceTest, BlockParameter.CreateEarliest(), BlockParameter.CreateLatest());
This time I've hardcoded all the parameters getting them directly from the blockchain
Trycoder
@Trycoder
May 04 2018 07:04
@juanfranblanco Are Signing a transaction and new Account(Privatekey) functions the same?
jandroalvarez
@jandroalvarez
May 04 2018 07:04
same RpcResponseException: "invalid argument 0: hex has invalid length 64 after decoding"
@juanfranblanco here you have the solidity code for the event as you asked me yesterday
event Pushed(
        address indexed publisher,
        address indexed thing,
        bytes content,            
        bytes key,
        bytes32 indexed nonce 
    );
Juan Blanco
@juanfranblanco
May 04 2018 08:03
@Trycoder when sending the transaction yes
if you use the Account(privateteKey) your transactions are signed with that key
@jandroalvarez try with this "0x3031303230333034000000000000000000000000000000000000000000000000"
although the other one is 32 bytes too :)
Juan Blanco
@juanfranblanco
May 04 2018 08:11
i have used your nonce value on my tests and is ok
this is my solidity
event PushedResult(address indexed first, address indexed second, bytes32 third, bytes32 fourth, bytes32 indexed fifth);
what client are you using?
Geth / Parity / Ganache
jandroalvarez
@jandroalvarez
May 04 2018 08:21
Geth
Juan Blanco
@juanfranblanco
May 04 2018 08:21
what version of Nethereum?
latest?
do you have a problem running my test?
jandroalvarez
@jandroalvarez
May 04 2018 08:22
geth version is 1.8.1
how can i check the nethereum version?
sorry but i'm quite newbie
Juan Blanco
@juanfranblanco
May 04 2018 08:23
oh if you just got the latest nuget
you are ok
jandroalvarez
@jandroalvarez
May 04 2018 08:23
oh nethereum sorry
i read ethereum :)
2.4.0
if im not wrong...
let me check
yes
latest
2.4.0
Juan Blanco
@juanfranblanco
May 04 2018 08:24
yes is that..
jandroalvarez
@jandroalvarez
May 04 2018 08:25
i have the same issue on Portable and web3 net.standard versions
Juan Blanco
@juanfranblanco
May 04 2018 08:25
only thing that differs from my test and yours is that i used a blocknumber
yeah they are all the same
jandroalvarez
@jandroalvarez
May 04 2018 08:25
i've got the portable on a PCL called from Xamarin.Android
Juan Blanco
@juanfranblanco
May 04 2018 08:26
ah.. xamarin now supports netstandard (just a comment)
jandroalvarez
@jandroalvarez
May 04 2018 08:26
web3 is called from a netstandard
i tried it out but they have some issues on dependencies management
and installing the netstandard on my PCL forces me to install it too on the droid project
otherwise it does not compile
hence i decided to stick to the PCL for avoiding this issue
Juan Blanco
@juanfranblanco
May 04 2018 08:27
oh sure.. it was just a thought in case you did not know, obviously you do know!!!
jandroalvarez
@jandroalvarez
May 04 2018 08:27
yes :9
:)
but thanks anyway
let me try your nonce
Juan Blanco
@juanfranblanco
May 04 2018 08:28
ok back to your problem, I cannot see any differences
i tried with yours and was fine
maybe change the Block Earliest
for a block number
you will need that anyway
as it is a big range normally and you dont get any results
from geth
jandroalvarez
@jandroalvarez
May 04 2018 08:29
ok i'll try
give me two minutes
Juan Blanco
@juanfranblanco
May 04 2018 08:30
        var eventPushed = contractHandler.GetEvent<PushedResultEventDTO>();
        var filter = await eventPushed.CreateFilterAsync(addressFrom, addressFrom, bytes,
            new BlockParameter(receipt.BlockNumber), BlockParameter.CreateLatest());
i did try your nonce and it was fine
jandroalvarez
@jandroalvarez
May 04 2018 08:32
i don't think that it makes any difference but I'm getting the pushed event like this:
var contract = new Web3(EthereumEndpoint).Eth.GetContract(Abi, Address);
Event pushed = contract.GetEvent("Pushed");
var contentFilterId = await pushed.CreateFilterAsync("0x4481D6d6BF93B4c16994Cf5cf4885c55b8A0777D", "0x928014e42199b7C9f7A37b0a78060D7EA4C23ea0", otherNonce, BlockParameter.CreateEarliest(), BlockParameter.CreateLatest());
i'm gonna change the block number
as u said
Juan Blanco
@juanfranblanco
May 04 2018 08:34
oh it won't make any difference they way you are doing it
jandroalvarez
@jandroalvarez
May 04 2018 08:36
same error removing the Block Earliest
var contentFilterId = await pushed.CreateFilterAsync("0x4481D6d6BF93B4c16994Cf5cf4885c55b8A0777D", "0x928014e42199b7C9f7A37b0a78060D7EA4C23ea0", nonceTest, new BlockParameter(6960710), BlockParameter.CreateLatest());
anyway what i don't understand
is the error message
{"invalid argument 0: hex has invalid length 64 after decoding"}
this is thrown by the rpc client, right?
Juan Blanco
@juanfranblanco
May 04 2018 08:38
yes it is
but it is actually complaining about the parameter 0
what is your contract address?
jandroalvarez
@jandroalvarez
May 04 2018 08:39
0x406c2d562E3cc410588e9Fd9e3Cd35d8571D3715
parameter 0 is the first parameter of the CreateFilterAsync or the contract address?
Juan Blanco
@juanfranblanco
May 04 2018 08:42
well in theory is the blockparameter earliest
jandroalvarez
@jandroalvarez
May 04 2018 08:42
however if i don't send the nonce, it works fine
Juan Blanco
@juanfranblanco
May 04 2018 08:42
from
yes you mentioned that
jandroalvarez
@jandroalvarez
May 04 2018 08:43
just a reminder :)
Juan Blanco
@juanfranblanco
May 04 2018 08:43
which is the confusing part
ok let me use your event exactly :)
and same parameters
jandroalvarez
@jandroalvarez
May 04 2018 08:46
ok!
var contentFilterId = await pushed.CreateFilterAsync("0x4481D6d6BF93B4c16994Cf5cf4885c55b8A0777D", "0x928014e42199b7C9f7A37b0a78060D7EA4C23ea0", BlockParameter.CreateEarliest(), BlockParameter.CreateLatest());
                var pushedChanges = await pushed.GetAllChanges<PushedResultEventDTO>(contentFilterId);

                var contentFilterId2 = await pushed.CreateFilterAsync(pushedChanges[0].Event.Publisher, pushedChanges[0].Event.Thing, pushedChanges[0].Event.Nonce, BlockParameter.CreateEarliest(), BlockParameter.CreateLatest());
                var pushedChanges2 = await pushed.GetAllChanges<PushedResultEventDTO>(contentFilterId2);
i've tried calling once without the nonce and then i called it again with the nonce returned by the previous result
as expected, second called it didn't work out
Juan Blanco
@juanfranblanco
May 04 2018 08:50
have you tried only with one filter
just a thought..
jandroalvarez
@jandroalvarez
May 04 2018 08:51
what do u mean? just sending one parameter
¿?
Juan Blanco
@juanfranblanco
May 04 2018 08:52
just looking at your code
i mean the simplified version
only creating one filter contentFilterId2
jandroalvarez
@jandroalvarez
May 04 2018 08:53
that was previous code
just creating one filter with three topics
maybe i'm not getting it
Juan Blanco
@juanfranblanco
May 04 2018 09:06
oh i have reproduced it
jandroalvarez
@jandroalvarez
May 04 2018 09:06
good news!
did u find out the root cause?
Juan Blanco
@juanfranblanco
May 04 2018 09:06
it is the event
i pressume is due to having two dynamic types before the indexed bytes 32
the event it is in the logs
and can be decoded
jandroalvarez
@jandroalvarez
May 04 2018 09:07
ook
Juan Blanco
@juanfranblanco
May 04 2018 09:07
so it points an issue with geth
jandroalvarez
@jandroalvarez
May 04 2018 09:07
so first bytes32 and then all the remaining bytes
u say that it must be a geth issue?
Juan Blanco
@juanfranblanco
May 04 2018 09:08
yeah.. i do normally put the indexed attributes at the beginning
jandroalvarez
@jandroalvarez
May 04 2018 09:08
cool
Juan Blanco
@juanfranblanco
May 04 2018 09:08
but it should not be a problem as geth would just pick the topisc
jandroalvarez
@jandroalvarez
May 04 2018 09:08
i'll try it out and i'll talk to the person that developed the contract
to let him now
Juan Blanco
@juanfranblanco
May 04 2018 09:09
let me test it first :)
jandroalvarez
@jandroalvarez
May 04 2018 09:09
i'll let u know if it fixes the problem
yeah of course!
Juan Blanco
@juanfranblanco
May 04 2018 09:09
ill raise an issue
jandroalvarez
@jandroalvarez
May 04 2018 09:09
ok i wait for your test
before doing anything
Juan Blanco
@juanfranblanco
May 04 2018 09:27
ok it is all fine with the right indexed order
"right" I thought this was not an issue now
ill raise it to see if is a bug
jandroalvarez
@jandroalvarez
May 04 2018 09:28
cool
i'm checking the code
and u changed from dynamic to static size
other solution is moving the last indexed parameter to the third position
right?
Juan Blanco
@juanfranblanco
May 04 2018 09:28
the test i did yesterday my types were all bytes32
correct
when using yours it failed
but moving it fixes the issue
jandroalvarez
@jandroalvarez
May 04 2018 09:29
perfect
let me know if u open the issue to geth
thank u very much for your help!!!
Juan Blanco
@juanfranblanco
May 04 2018 09:31
thanks for reporting it :)
jandroalvarez
@jandroalvarez
May 04 2018 09:31
np ;-)
Juan Blanco
@juanfranblanco
May 04 2018 09:31
I knew it was something funny going on there
jandroalvarez
@jandroalvarez
May 04 2018 09:32
yes it was quite weird....
i have to leave the room right now
tell me if u open the issue to geth
just for tracking it :)
Juan Blanco
@juanfranblanco
May 04 2018 09:32
yes of coruse
course*
jandroalvarez
@jandroalvarez
May 04 2018 09:32
:D
bye!!
Juan Blanco
@juanfranblanco
May 04 2018 09:48
ethereum/go-ethereum#16678
@jandroalvarez ^^
nibirc
@nibirc
May 04 2018 11:28
@juanfranblanco , Hallo Sir, while trying to transfer ether in Rinkeby (I am running geth to sync rinkeby on my laptop locally), I am getting unknown account error. Here is the code used:
Account ac = new Account(Account1PK);
TokenService.web3= new Web3(ac);
var res=web3.TransactionManager.SendTransactionAsync(Account1, Account2, new HexBigInteger(1)).Result;
Please suggest
The account has been created in a different laptop using Ethereum Wallet.
Psilon
@Pzixel
May 04 2018 11:32
@juanfranblanco how could CallAsync return null?
I mean i have local network and this code works fine
but when I'm connected no another one it return null
I'm running the very same integration test
which deploys a contract and then calls one method
with same parameters such as gas etc
ah I see
I have to update to byzantium on this network too
sorry for bothering)
CryptoAaron
@CryptoAJC
May 04 2018 11:38
big shoutout to this framework mind, my work wanted it in aps.net, would be borked with Nethereum !
so thansk team !
Psilon
@Pzixel
May 04 2018 11:43
I didn't get a single word :D
dimonkov
@dimonkov
May 04 2018 12:07

@juanfranblanco ,
Hi, just wanted to ask which version of Newtonsoft.Json your Unity3d package uses?
I know it is Newtonsoft.Json 9.0.1 for .Net 3.5,
but is it an official one from nuget, or some kind of fork?
Cause I've heard that official one is incompatible with AOT compilation.

Anyway, I'm asking this because I was experimenting with the new "Experimental" support for .Net 4.6 in unity 2017, and had no luck importing Nethereum as libraries, only as Raw source code and after some tweaking and c# 7 feature removal(Unity is still at c# 6) I was able to get Web3 to work.

Now .Net 4.6 support (NetStandard 2.0 too) made it into Unity 2018 and it is stable, so It would be cool to finally import the Nethereum as libraries, but they depend on Newtonsoft.Json version 10.

By the way, thank you for the great library you are making.

Juan Blanco
@juanfranblanco
May 04 2018 12:08
You can use Experimental with Nethereum out the box
but AOT does not work
and other features
hence the specific Unity3d stuff
dimonkov
@dimonkov
May 04 2018 12:09
Yes, I know, that unity version of this package works.
Juan Blanco
@juanfranblanco
May 04 2018 12:09
so you can use vanilla nethereum with hololens
now for aot ios webgl etc
dimonkov
@dimonkov
May 04 2018 12:10
However, I was trying to use web3 with async/await style
Juan Blanco
@juanfranblanco
May 04 2018 12:10
answering your question use the Unity3d json.net
ah..
yes that won't work
nibirc
@nibirc
May 04 2018 12:10
Can anyone point me to right direction please?
Juan Blanco
@juanfranblanco
May 04 2018 12:10
so you can use vanilla if you are just targetting hololens for example
dimonkov
@dimonkov
May 04 2018 12:10
And I was able to do so, but had to import Nethereum.Web3 as source code, and tweak it a bit
Juan Blanco
@juanfranblanco
May 04 2018 12:10
or windows etc
i have ran it
too
out of the box
that was the original thought
then it all broke apart
in webgl
so..
your question / answer it is the json.net for unity3d
there is a link in the sample
flappy eth
dimonkov
@dimonkov
May 04 2018 12:13
Ok, thank you.
Will still be experimenting with it.
Juan Blanco
@juanfranblanco
May 04 2018 12:13
this is unity3d on experimental
and the link for unity3d
json.net
is...
(building the excitement)
dimonkov
@dimonkov
May 04 2018 12:16
Thanks
Juan Blanco
@juanfranblanco
May 04 2018 12:16
ill check the netstandard support
but yeah.. that will be for the new proejects
jandroalvarez
@jandroalvarez
May 04 2018 12:17
@juanfranblanco thanks for opening the issue! Let's see how it goes... :)
dimonkov
@dimonkov
May 04 2018 12:18
Ok, nice to hear that.
Btw - what are target settings for the dlls in the example?
I might want to recompile them to stay up to date.
Juan Blanco
@juanfranblanco
May 04 2018 12:19
those are the .net461
for the sample
dimonkov
@dimonkov
May 04 2018 12:19
Ok.
Juan Blanco
@juanfranblanco
May 04 2018 12:19
but why not try netstandard they will be the same :)
@nibirc I cannot understand what is your issue
did you actually check the code i sent you in your issue and test it?
poiting to infura?
dimonkov
@dimonkov
May 04 2018 12:45
@juanfranblanco ,
Hm, tried to add Hdwallet dll to the example (extracted it from nuget), both .Net 4.5 and netcore 1.1 versions cause this error:
Unloading broken assembly Assets/Plugins/Nethereum.HdWallet.dll, this assembly can cause crashes in the runtime
Any ideas?
Should I compile one for 461 then?
dimonkov
@dimonkov
May 04 2018 13:18
Sorry, I was stupid. I've downloaded the most recent version, but forgot to update dependencies as well.
snowycrypto
@snowycrypto_twitter
May 04 2018 16:31
@juanfranblanco is there a way to integrate core libraries into Unity3d (ex. Nethereum.HDWallet)?
Some of the core libraries aren't in the release 2.2.1 Unity3d
Would I need to add some ProjectReference's to this file: https://github.com/Nethereum/Nethereum/blob/master/src/Nethereum.Unity/Nethereum.Unity.csproj and rebuild the project?
Juan Blanco
@juanfranblanco
May 04 2018 17:23
no only the ones compiled
for unity3d
the other ones do not support 3.5
snowycrypto
@snowycrypto_twitter
May 04 2018 17:24
I see
Juan Blanco
@juanfranblanco
May 04 2018 17:24
from the conversation above
you could use vanilla nethereum
if using the experimental
and not care much yet about aot
snowycrypto
@snowycrypto_twitter
May 04 2018 17:25
Experimental unity correct?
Juan Blanco
@juanfranblanco
May 04 2018 17:26
yeah
snowycrypto
@snowycrypto_twitter
May 04 2018 17:26
Got it
I know you've probably explained somewhere
But can you repeat some insight into why some core libraries don't work with Unity 3.5?
Juan Blanco
@juanfranblanco
May 04 2018 17:27
because the use stuff that is not compatible with .net 3.5
like async
or the http client
(async )
or the file system
or networking
hopefully soon this won't be the case
snowycrypto
@snowycrypto_twitter
May 04 2018 17:29
Haha, makes sense
Juan Blanco
@juanfranblanco
May 04 2018 17:29
with the netstandard support
but still you will need the new version
(won't be the case, won't be necessary for aot)
like wasm with .net
snowycrypto
@snowycrypto_twitter
May 04 2018 17:30
Any idea if I can get functionality of Nethereum.HDWallet library into Unity 3.5 from some other library?
Juan Blanco
@juanfranblanco
May 04 2018 17:31
no mainly that uses Nbitcoin in the background
snowycrypto
@snowycrypto_twitter
May 04 2018 17:31
I was getting away with everything already in the Nethereum.Unity build but wanted to generate some mnemonics :P
Juan Blanco
@juanfranblanco
May 04 2018 17:31
so that is rather large
the truth is that is only a couple of classes but there are depdencies
on their custom bouncy castle
snowycrypto
@snowycrypto_twitter
May 04 2018 17:32
Makes sense, bummer then
nibirc
@nibirc
May 04 2018 17:32
@juanfranblanco , Sir, can you please help me with the Unknown account error, i am getting.
Juan Blanco
@juanfranblanco
May 04 2018 17:32
oh.. it won't be long til is supported
snowycrypto
@snowycrypto_twitter
May 04 2018 17:32
Thanks for the responses @juanfranblanco
Juan Blanco
@juanfranblanco
May 04 2018 17:33
if not i would do a mini port of that
snowycrypto
@snowycrypto_twitter
May 04 2018 17:33
Awesome, I'd really appreciate it
Juan Blanco
@juanfranblanco
May 04 2018 17:33
it won't take long
snowycrypto
@snowycrypto_twitter
May 04 2018 17:33
:smile:
Juan Blanco
@juanfranblanco
May 04 2018 17:33
final words :D
joking apart, yes it wont be an issue with the newer version
love netstandard :)
snowycrypto
@snowycrypto_twitter
May 04 2018 17:36
:fire:
Juan Blanco
@juanfranblanco
May 04 2018 17:58
@nibirc your issue is strange that will normally happen when you are trying to connect locally using a ManagedAccount and the account is not there, but you are signing using Account.
Also it might be you have not synced
have you tried the sample I gave you connecting directly to infura?
dimonkov
@dimonkov
May 04 2018 22:56

@juanfranblanco ,
still cannot import them as assemblies.
Well, technically I can, and It even works with the Unity port of Newtonsoft.Json dll, but it creates a whole another issue - when I try to use JObject somewhere in my scripts, it starts complaining that:

error CS0012: The type `Newtonsoft.Json.Linq.JObject' 
is defined in an assembly that is not referenced. 
Consider adding a reference to assembly
 `Newtonsoft.Json, Version=9.0.0.0, Culture=neutral,
 PublicKeyToken=30ad4fe6b2a6aeed'

And obviously Unity port of Newtonsoft.Json isn't signed and has it's PublicKeyToken=null 😆

So I guess, that my best bet is to continue importing Nethereum as source code into my Plugins folder.

Maybe I'll even create a separate fork of it to keep it up to date, and replace c# 7 code with c# 6 one (cause unity won't compile any c# 7 source code).

Again, wanted to say thank you for this awesome project.
Keep up the good work 👍.

dimonkov
@dimonkov
May 04 2018 23:20

Forgot to mention, that I've tried downgrading Nuget package for Newtonsoft.Json to 9.0.1 for all Nethereum projects. Thus, Version=9.0.0.0 is listed in the error above.
If I just extract Nethereum assemblies from Nuget packages (Nethereum version 2.4.0) it prints the same error, but wants Newtonsoft.Json version of 10.0.0.0.

I'm thinking, if I could somehow compile Nethereum libraries with Unity port of Newtonsoft.Json as a dependency instead of the one from Nuget?
Will this work?