These are chat archives for Nethereum/Nethereum

14th
Feb 2018
Juan Blanco
@juanfranblanco
Feb 14 2018 04:22 UTC
@doreegekku cool thanks, can you create an issue explaining the steps and info to reproduce?
@jsheely in Infura you can GetAllChanges for an event, it is actually safer as you control the block number range
Regarding the other issue, if you can put more info i can investigate
bluuman
@bluuman
Feb 14 2018 06:02 UTC
security risk to use etherscan.io api instead of my own node? i want to move my project to a small computer (maybe Raspberry Pi).
Juan Blanco
@juanfranblanco
Feb 14 2018 06:32 UTC
none
you are mainly signing your transactions
oh...
sorry you meant etherscan.io to get information about your accounts / contracts
well i don't see a major issue as Matt is awesome, but there is always a risk. In a similar way you may be connecting to a rogue node to sync
bluuman
@bluuman
Feb 14 2018 06:39 UTC
yes, i'm needing to get block info using api
but it's not a professional tool
just my personal
ah, but signing own tx and sending is safe, i understand
still debating this, i'll figure it out
Juan Blanco
@juanfranblanco
Feb 14 2018 07:32 UTC
well you can connect to infura also
or any public node
etherscan gives you more info
l-vitall
@l-vitall
Feb 14 2018 10:21 UTC
I'm getting BigInteger from my contract (wei), but it is a problem to calculate percent on it (to split amount for several parts for example) since it is all integers. No Math methods like Round() is available for BigInteger. Could you tell me please what is common practice to handle such cases? I used multiplication and then division approach but If I calculate same things with doubles and Math.Round then I have slightly different result (because no bankers rounding is used and so on)
Juan Blanco
@juanfranblanco
Feb 14 2018 11:00 UTC
i have "created" also BigDecimal
but overall depends on your use case
to work with very high numbers I will work in Ether then convert to wei
truncating any extra precission
l-vitall
@l-vitall
Feb 14 2018 11:20 UTC
I'll review BigDecimal, thanks. Using Ether would be best solution but won't it cause too much precision lost? There are some intermediate units like Finney, Szbo and so on. My use case is to use only part of several bets to get final amount (to take percentage of each one). Not a high numbers. I'm trying to understand what precision loss is treated as OK in such cases.. But also we should not overflow the decimals.
Juan Blanco
@juanfranblanco
Feb 14 2018 11:26 UTC
well if wei is the smallest unit
there is much space to work
but if you think about it
any extra precision will be lost regardless
as the result will be the same
as long as you work with the bigdecimals all the time
and rounding does not happen before hand
l-vitall
@l-vitall
Feb 14 2018 11:33 UTC
ok, thanks. By the way, thank you for Nethereum - it's very useful and it is really nice to work with it : )
Juan Blanco
@juanfranblanco
Feb 14 2018 11:40 UTC
Thanks :)
She Jong Shon
@kkagill
Feb 14 2018 11:40 UTC
hey juan
var account = Nethereum.Web3.Accounts.Account.LoadFromKeyStoreFile(accountFilePath, string password);
the type name LoadFromeyStoreFile does not exist in the type Account
Juan Blanco
@juanfranblanco
Feb 14 2018 11:42 UTC
ah if you are using portable or netstandard
you need to do it yourself
(it is not going to work the same in ios, android, etc)
She Jong Shon
@kkagill
Feb 14 2018 11:43 UTC
not in netcore Nethereum.Geth library?
Juan Blanco
@juanfranblanco
Feb 14 2018 11:43 UTC
the load from key store is very simple
it mainly calls
so you just need the json
She Jong Shon
@kkagill
Feb 14 2018 11:48 UTC
oh nice this is what i want
questeion, using ManagedAccount class can still sign the transaction?
proBeejay141
@proBeejay141
Feb 14 2018 12:56 UTC
please how can i get the current gas price to send ether from one account to another, like bitcoin transaction fee
Jonathan Sheely
@jsheely
Feb 14 2018 14:12 UTC
@juanfranblanco The other issues were mainly my fault. But the one I'm dealing with right now appears to be a race condition
I'm pointing Nethereum at a Geth 1.8.0 instance. When making that switch the SendTransactionAndWaitForReceiptAsync fails with unknown transaction but if I split it out and do SendTransactionAsync() and then do a while loop check on Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transaction); myself with a 1 second delay. It will usually work the second or third try. Going against geth --testnet
I haven't added the Nethereum source to my project yet to step through it. But my hunch is it's returning a different error result now so instead of returning null it returns the error code.
image.png
Otherwise I would expect this to be doing the same thing I'm doing ^^
Juan Blanco
@juanfranblanco
Feb 14 2018 17:15 UTC
@kkagill that mainly used Geth or parity to sign the transaction (using the account in their KeyStore)
@proBeejay141 you can check the average on previous blocks or use the default
@jsheely I put a delay to not create an unnecessary load when mining normally takes 15 seconds
Jonathan Sheely
@jsheely
Feb 14 2018 17:19 UTC
I handled it myself by using Polly and that seems to work fine.
@juanfranblanco I finally got event calls to not error. But they always return empty
Not sure I understand the whole intent of the filterAll. Is that saying that it would at the time of calling the function return every event of that name from the beginning of time?
var filterAll = await multiplyEvent.CreateFilterAsync();
Jonathan Sheely
@jsheely
Feb 14 2018 17:31 UTC
My current thought is that CreateFilterAsync() marks the block and you only get events from that point in time.
When calling GetFilterChanges(). Now I just need to figure out how to get ALL events that have ever been fired.
Jonathan Sheely
@jsheely
Feb 14 2018 18:56 UTC
Hmm So I guess I'm not doing this right.
Getting index out of bounds error when trying to use specific ranges for the filter inputs
var latestBlock = await blockChain.Client.Eth.Blocks.GetBlockNumber.SendRequestAsync();
var filter = userRegisteredEvent.CreateFilterInput(new BlockParameter(2644254), new BlockParameter(latestBlock));
var changes = await userRegisteredEvent.GetAllChanges<UserRegistered>(filter);
Jonathan Sheely
@jsheely
Feb 14 2018 19:13 UTC
Seems the index out of bounds was a serialize issue. Not an event fetching problem.
[Parameter("address", "user", 1, true)] model attributes are important!
Juan Blanco
@juanfranblanco
Feb 14 2018 19:48 UTC
FilterAll mainly does not include any topics
So it returns all logs without filtering for a specific index
Jonathan Sheely
@jsheely
Feb 14 2018 19:50 UTC
So why does GetAllChanges() not have an empty constructor?
Seems like the default for that function should be Doing BlockParameter.CreateEarlist() and CreateLastest() by default