These are chat archives for Nethereum/Nethereum

9th
Oct 2018
Andres G. Aragoneses
@knocte
Oct 09 2018 05:56
would be useful to have those stacktraces in an Nethereum issue
and a link to the .net framework's HTTP bug
Juan Blanco
@juanfranblanco
Oct 09 2018 05:57
yep :)
Andres G. Aragoneses
@knocte
Oct 09 2018 06:42
(otherwise we're just gossiping like naughty neighbours x-D )
Juan Blanco
@juanfranblanco
Oct 09 2018 06:43
@spied001 ^^
so my guess is the usual limit of http connections, forcing drop outs. On the rpc client perspective I could put the retry similar to what I used to used for socket exhaustion in the BlockchainStorage
just need to catch that exception and do a retry
Miguel Jerónimo Álvarez
@mjeronimoa
Oct 09 2018 09:19
Hi,
I'm taking some time measures in order to improve the performance of my App, and I would like to know if it is normal that it takes about 2/3 seconds to get an Ethereum account using something like:
var account = new Wallet(wordlist, null).GetAccount(address);
Is there any way I can improve this times?
Juan Blanco
@juanfranblanco
Oct 09 2018 09:21
if you store the account index it will be faster
as it might be iterating
but that does not take normally very long
Miguel Jerónimo Álvarez
@mjeronimoa
Oct 09 2018 09:24
and how can I store the account index?
Juan Blanco
@juanfranblanco
Oct 09 2018 09:25
i am guessing this won't be a one off
so if you look at metamask
they have already stored your accounts and the index of your accounts based on your seeds
(i don't know if has changed much.. )
then all that data is encrypted
Miguel Jerónimo Álvarez
@mjeronimoa
Oct 09 2018 09:30
the problem I find it is that I need to create the wallets "on the go", so I think this will not solve my problem
what would be the consequences of creating the account using:
var account = new Wallet(wordlist, null).GetAccount(address,1);
?
Juan Blanco
@juanfranblanco
Oct 09 2018 09:31
@mjeronimoa ?
mainly your wallet is created with a word list, from there the seed is created, and you can derive many private keys from that seed
Miguel Jerónimo Álvarez
@mjeronimoa
Oct 09 2018 09:33
ok, I didn't know there was a relationship 1 to N with the mnemonic and secret password
Juan Blanco
@juanfranblanco
Oct 09 2018 09:34
because an address is passed
then that needs to be found
so you need to get all the private keys
and from there create an address
until is found
so if the address is the first one should be fast
if it is the 10000 it won't be as fast
Miguel Jerónimo Álvarez
@mjeronimoa
Oct 09 2018 09:35
ok, clear enough
Juan Blanco
@juanfranblanco
Oct 09 2018 09:36
some multithreading could be done
but I don't know what side will be best (ie your side)
or the wallet side
Miguel Jerónimo Álvarez
@mjeronimoa
Oct 09 2018 09:38
thanks a lot, you gave me a better understanding of how everything works
Juan Blanco
@juanfranblanco
Oct 09 2018 09:38
:)
Miguel Jerónimo Álvarez
@mjeronimoa
Oct 09 2018 09:38
I can now try a few approaches
Juan Blanco
@juanfranblanco
Oct 09 2018 09:38
let me know how it goes
and if is something that can be added
Miguel Jerónimo Álvarez
@mjeronimoa
Oct 09 2018 09:39
sure, and thanks again
Yuu0704
@Yuu0704
Oct 09 2018 14:48
I am using Netherem 2.5.1.
I succeeded in creating a wallet.
I sent ETH to this wallet. But I failed.
How do you solve this problem?
Juan Blanco
@juanfranblanco
Oct 09 2018 14:58
If you can post some snippets of your code we might be able to help
also what error you are getting
FrozenKiwi
@FrozenKiwi
Oct 09 2018 16:20
Hi Everyone. I'm having a bit of trouble with signing messages. Can anyone think of any reasons why the hash generated by Nethereum might not by symmetric with recovery (by Ethers.JS & MyEtherWallet)

var message = "{\"timestamp\":1539100305013.0}";
var signer = new Nethereum.Signer.MessageSigner();
var signature = signer.HashAndSign(message, TheAccount.PrivateKey);

The signature here is different to the sig generated by other packages. HashAndEcRecover recovers the correct address in Nethereum, but cannot be recovered by those other packages

turtlewen
@turtlewen
Oct 09 2018 17:57
hi everyone
may i know for visual studio 2013 how to install the nethereum, my nuget manager cannot search for nethereum nuget
turtlewen
@turtlewen
Oct 09 2018 18:11
image.png
how to i solve this problem
FrozenKiwi
@FrozenKiwi
Oct 09 2018 18:53

Ok - I figured out the hashing problem. It seems that Nethereum double-hashes it's messages:

SignAndHash calls: HashAndHashPrefixedMessage - it hashes the message, adds the prefix, and then hashes the result.

Ethers, on the other hand, simply appends the ethereum prefix, then hashes the result:

https://github.com/ethers-io/ethers.js/blob/9b118af304124e71ce7ddbe60549204b181a8888/src.ts/utils/hash.ts#L46:17

Juan Blanco
@juanfranblanco
Oct 09 2018 20:03
@FrozenKiwi this is based on what geth does
@turtlewen this uses the latest version of nuget
you can download Visual Studio Community which is free
turtlewen
@turtlewen
Oct 09 2018 20:05
but can i update my nuget in my visual studio 2013?
cause i need to code for asp.net
i familiar with visual studio ultimate 2013><
Juan Blanco
@juanfranblanco
Oct 09 2018 20:06
can you not open in visual studio 2017
you have the same features
I don't think you will miss any at all
turtlewen
@turtlewen
Oct 09 2018 20:07
i not sure it can open in vs 2017 or not, but it is miner different from 2017 and 2013
so u more suggest me use 2017 to run the nugget ??
yeah it seems you only can get upto v2
turtlewen
@turtlewen
Oct 09 2018 20:10
must at least in which version??
Juan Blanco
@juanfranblanco
Oct 09 2018 20:11
have you tried the portable version of nethereum?
that includes all the packages as portable
turtlewen
@turtlewen
Oct 09 2018 20:12
image.png
it also failed
Juan Blanco
@juanfranblanco
Oct 09 2018 20:13
this is failing in most common libraries, ie the Newtonsoft Json
turtlewen
@turtlewen
Oct 09 2018 20:14
but the newtonsoft json i had added into the references
Juan Blanco
@juanfranblanco
Oct 09 2018 20:14
your are better off moving to the latest IDE
turtlewen
@turtlewen
Oct 09 2018 20:15
now i installing for visual studio 2017
hopefully it will not have any issues in vs 2017
Juan Blanco
@juanfranblanco
Oct 09 2018 20:15
well that is what we use in a daily basis
turtlewen
@turtlewen
Oct 09 2018 20:15
if have any issues again , can i pm/dm u ??
Juan Blanco
@juanfranblanco
Oct 09 2018 20:16
well i am going to bed now.. it will be async
turtlewen
@turtlewen
Oct 09 2018 20:16
okok , anyway thank for ur help, it really useful for me
Juan Blanco
@juanfranblanco
Oct 09 2018 20:18
well I wished it had work :)
what framework are you targetting?
nethereum supports from net451
turtlewen
@turtlewen
Oct 09 2018 20:18
actually im working on my final year project
i dont have much knowledge on nethereum
my final year project is related to ethereum
Juan Blanco
@juanfranblanco
Oct 09 2018 20:19
ah ok, I thought you were looking for backwards compatibility with a very old project
turtlewen
@turtlewen
Oct 09 2018 20:19
so i need to discover all of it by mydel
myself
i not so powerful, haha im just a degree student from malaysia
Juan Blanco
@juanfranblanco
Oct 09 2018 20:20
yes use 2017, even the community edition has more stuff than 2013, for example support to develop mobile applications with Xamarin, UWP etc
turtlewen
@turtlewen
Oct 09 2018 20:20
all the ethereum stuff my college didnt teach at all, so i need to discover it using limited time
FrozenKiwi
@FrozenKiwi
Oct 09 2018 20:20

@juanfranblanco Thanks for the explanation. I haven't looked into geth, but it does appear that ethereum itself does only single-hashes the message:

function getOriginAddress(bytes32 signedMessage, uint8 v, bytes32 r, bytes32 s) constant returns(address) {
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes32 prefixedHash = keccak256(prefix, signedMessage);
return ecrecover(prefixedHash, v, r, s);
}

Juan Blanco
@juanfranblanco
Oct 09 2018 20:23
@FrozenKiwi sorry my fault
can you not use this?
So you have HashAndSign
or just Sign
the Sign does what you want
HashAndSign.. does.. HashAndSign ie Double hashing
or if you want you can
UTF8EncodeAndSign
FrozenKiwi
@FrozenKiwi
Oct 09 2018 20:25
Ah. Actually that does kinda make sense. I did try and use the 'Sign' function, but I have a suspicion I may have fed it the wrong data looking at it a 2nd, 3rd, or perhaps 19th time
Juan Blanco
@juanfranblanco
Oct 09 2018 20:25
if you are working with strings
FrozenKiwi
@FrozenKiwi
Oct 09 2018 20:25
I am
damn. I thought I had been pretty thorough going over that class
Ok, let go back to my test strings! I thought it was an odd issue to run into! Thanks Juan muchly!
Juan Blanco
@juanfranblanco
Oct 09 2018 20:27
no bother, my pleasure :)
FrozenKiwi
@FrozenKiwi
Oct 09 2018 20:31
yup, that worked perfectly. I'll just go delete that issue I logged...
Juan Blanco
@juanfranblanco
Oct 09 2018 20:32
great :) happy it works
Michael Ilchuk
@Ilchuk-Mihail
Oct 09 2018 21:52

Hi. I had subscribe to transfer event

                var tokenService = new StandardTokenService(web3, "token address");
                var transferEventHandler = tokenService.GetTransferEvent();
                var filterAllTransferEventsForContract = transferEventHandler.CreateFilterInput();
                var allTransferEventsForContract = await transferEventHandler.GetAllChanges<TransferEventDTO>(filterAllTransferEventsForContract);

//but I get 0 event, 
// when I add blockParams 
var filterAllTransferEventsForContract = transferEventHandler.CreateFilterInput(new BlockParameter(4125368), new BlockParameter(4169121));
// I get some events

What I missed ?

@juanfranblanco
What is best way to monitor contract transfer event ?
Maybe some web socket or just store last checked block , and periodically run this code, to check some range
for example , each 20 sec, run this code and change range from last checked block to current
Michael Ilchuk
@Ilchuk-Mihail
Oct 09 2018 21:57
One more questions -> Which limit gets event for one time (100, 1k , ...) ?
TarrahArshad
@TarrahArshad
Oct 09 2018 22:53
@juanfranblanco {"insufficient funds for gas * price + value"}