These are chat archives for Nethereum/Nethereum

20th
Feb 2018
Maximilian Weber MWC
@CineTekDev_twitter
Feb 20 2018 00:19
hitting the gas limit usually means there is an issue in your code - like not meeting all requirements when using multiple requires
BradenPorter
@BradenPorter
Feb 20 2018 01:31
@juanfranblanco New to visual studio. Using nethereum w/ xamarin forms for iOS & Android cross platform functionality. Learning a lot from your videos, and saw you had contributed a huge amount of packages on nuget. Installed them all to play around with. My... have you contributed a lot. Just curious, was nethereum a funded project?
Juan Blanco
@juanfranblanco
Feb 20 2018 06:06
@BradenPorter thanks, Nethereum started as a side project 2015 / 2016 then I joined Consensys with the project and I spent 50% of my time on it, and then more during the last year.
Greatsamps
@Greatsamps
Feb 20 2018 11:32
var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
var privateKey = ecKey.GetPrivateKeyAsBytes().ToHex();
var account = new Nethereum.Accounts.Account(privateKey);
this part of the documentation is wrong
Juan Blanco
@juanfranblanco
Feb 20 2018 11:32
well you can pass the bytes directly
Greatsamps
@Greatsamps
Feb 20 2018 11:32

last line should be:

var account = new Nethereum.Web3.Accounts.Account(privateKey);

Juan Blanco
@juanfranblanco
Feb 20 2018 11:33
ah.. yeah changed the namespace
Greatsamps
@Greatsamps
Feb 20 2018 11:33
:)
Juan Blanco
@juanfranblanco
Feb 20 2018 11:33
still thinking that could be in its own package
waiting for when it is more complex
Greatsamps
@Greatsamps
Feb 20 2018 11:34
i'm guessing that it does not actually use web3 for this?
Juan Blanco
@juanfranblanco
Feb 20 2018 11:34
yeah
Greatsamps
@Greatsamps
Feb 20 2018 11:34
probably makes sense to move it then
Juan Blanco
@juanfranblanco
Feb 20 2018 11:34
but it uses most of all the other packages as it has the transaction manager
Greatsamps
@Greatsamps
Feb 20 2018 11:35
mmm, maybe just have them as dependancies.
Juan Blanco
@juanfranblanco
Feb 20 2018 11:35
yeah I am just awaiting to overly confuse everyone
Greatsamps
@Greatsamps
Feb 20 2018 11:35
fun times!
haha
Juan Blanco
@juanfranblanco
Feb 20 2018 11:36
ha ha yeah
ill add it as an issue :)
then it will revert to the original namespace
Greatsamps
@Greatsamps
Feb 20 2018 11:37

we are looking to generate a lot (several thousand) wallet addresses for our app. Would you say from a security perspective, its best to:

a) generate an HD wallet, then encrypt the seed in our DB
b) generate an address for each one we need, then encrypt the private key in our DB
c) generate an address for each, use your key encryption, then encrypt password in our DB

d) none of the above!

if it makes any difference this will be on a microservice that does not have an inbound route from the internet
Juan Blanco
@juanfranblanco
Feb 20 2018 11:39
well for simplicity sake you could use the HD wallet per 1000, and store the seed encrypted in Azure Key Vault
TarrahArshad
@TarrahArshad
Feb 20 2018 11:40
@juanfranblanco how to i get ethereum transaction fee ?
Juan Blanco
@juanfranblanco
Feb 20 2018 11:40
BUT as I guess each account will be related to a separate user, so if anybody guesses the seed
and hopefully padded with a password
they can recover all the addresses
so a) is the most convenient but also the most vulnerable as a seed is shared
Greatsamps
@Greatsamps
Feb 20 2018 11:42
yeah, so that is why i was thinking just generate a fresh one for each user, its not too much hassle
Juan Blanco
@juanfranblanco
Feb 20 2018 11:43
yeah, also usign the keystore format file is rather good, as it harder to crack
Greatsamps
@Greatsamps
Feb 20 2018 11:45
so perhaps option c then?
Juan Blanco
@juanfranblanco
Feb 20 2018 11:45
also even if the chances are 1 in 1 trillion, when generating the keys you need to check if the account already exist
Greatsamps
@Greatsamps
Feb 20 2018 11:45
that was my next question!
is there a call i can use for this?
Juan Blanco
@juanfranblanco
Feb 20 2018 11:46
(Btw 1 in 1 trillion is a guess )
oh i meant in your database
you will store address and encrypted file next to it
so you can validate if the address already exists
Greatsamps
@Greatsamps
Feb 20 2018 11:47
ah ok, got you
Juan Blanco
@juanfranblanco
Feb 20 2018 11:47
obviously checking in the chain if it is already been used also helps
Greatsamps
@Greatsamps
Feb 20 2018 11:47
would i just check the state for that address?
(on chain)
Juan Blanco
@juanfranblanco
Feb 20 2018 11:47
yeah
addresses none in use are going to be removed
anyway
to reduce the size of the chain
Greatsamps
@Greatsamps
Feb 20 2018 11:49
ok makes sense.
is there a maximum size the password can be that is used to secure the keystore foramt?
Juan Blanco
@juanfranblanco
Feb 20 2018 11:50
i cannot remember
Greatsamps
@Greatsamps
Feb 20 2018 11:51
1 way to find out :)
Juan Blanco
@juanfranblanco
Feb 20 2018 11:51
ha ha :)
Andres G. Aragoneses
@knocte
Feb 20 2018 12:28
hey guys, I'm trying to use StandardTokenEIP20.StandardTokenService.GetBalanceOfAsync<BigInteger>(someAddress), but the result is the ETH balance instead of the token balance, am I missing something obvious??? :D
Juan Blanco
@juanfranblanco
Feb 20 2018 12:30
???
hi @knocte
Andres G. Aragoneses
@knocte
Feb 20 2018 12:30
jelou!
yes seriously, I get the ETH balance
tried with 2.0.1 and with v.latest
or if you fancy trying this
i am creating a new code generator for cqs etc at the moment
Andres G. Aragoneses
@knocte
Feb 20 2018 12:33
mmm
what's CQS?
Juan Blanco
@juanfranblanco
Feb 20 2018 12:33
oh sorry
command query separation
Andres G. Aragoneses
@knocte
Feb 20 2018 12:34
definitely the BalanceOf() code looks good, so I'm very confused
Juan Blanco
@juanfranblanco
Feb 20 2018 12:34
yeah going back to your problem
that is really strange
it may have the same balance? in Ether and the token?
(i know it is a rather strange situation)
Andres G. Aragoneses
@knocte
Feb 20 2018 12:35
so the example values I'm using are
I was assuming that DAI is a normal ERC20 token? maybe it's not?
Juan Blanco
@juanfranblanco
Feb 20 2018 12:37
well it used to be
according to etherscan he has 1577546020844666975718
2 ticks
let me launch a new instance of vs
Andres G. Aragoneses
@knocte
Feb 20 2018 12:39
right, and the value I get is 50.3
oh wait!
I don't want you to waste time, I think I might found a bug in my code
be back in 5mins
Juan Blanco
@juanfranblanco
Feb 20 2018 12:41
ha ha ok, you dont waste my time
Andres G. Aragoneses
@knocte
Feb 20 2018 12:43
ok this is really interesting because I think there's some decoding bug , that combined with other precision bug of mine, is getting exactly more or less the same amount of ETH the account has, hahah
Juan Blanco
@juanfranblanco
Feb 20 2018 12:43
ok let me try
Andres G. Aragoneses
@knocte
Feb 20 2018 12:44
so, to begin with, I'm getting 331577546020844666975718
instead of 1577546020844666975718
is it because I'm using BigInteger instead of HexBigInteger?
Juan Blanco
@juanfranblanco
Feb 20 2018 12:44
oh no
hexbiginteger is only for Eth calls
Andres G. Aragoneses
@knocte
Feb 20 2018 12:46
mmmm then why I'm getting the number prefixed with 3s?
so weird
Juan Blanco
@juanfranblanco
Feb 20 2018 12:47
image.png
pointing to infura
Andres G. Aragoneses
@knocte
Feb 20 2018 12:50
can you use StandardTokenService instead?
I was using MEW node, gonna test infura now
same with infura, mmm
Juan Blanco
@juanfranblanco
Feb 20 2018 12:54
yes sure
Andres G. Aragoneses
@knocte
Feb 20 2018 12:59
argh!!! the 3 is a bug of mine
forget it haha
Juan Blanco
@juanfranblanco
Feb 20 2018 12:59
updated the gist
Andres G. Aragoneses
@knocte
Feb 20 2018 12:59
now on to see why I still see the ETH number... which should be mine as well
Juan Blanco
@juanfranblanco
Feb 20 2018 12:59
anyway
btw check the differences
one of using a service and the other just using the message
let me know what you think about the differences
Andres G. Aragoneses
@knocte
Feb 20 2018 13:03
well I prefer .GetBalanceOfAsync<BigInteger> , it's shorter :)
but if I use a nonERC20 of course I will use the other approach which is handy to know
haha brilliant, just located my bug
Andres G. Aragoneses
@knocte
Feb 20 2018 13:08
as my PoC was just dealing with unconfirmed amounts, and I already had code to show confirmed amounts in certain situations, then it was showing the latter (but just ETH as I had not modified that code)
now I have to figure out how to call BalanceOf<> but at a certain block height, to show a confirmed amount
is that possible?
(BTW sorry about the noise when reporting my bug!)
Juan Blanco
@juanfranblanco
Feb 20 2018 13:10
oh it is ok
right that is where the message format helps
because you can do var balance = await contractHandler.QueryAsync<BalanceOfFunction,BigInteger>(balanceOfFunctionMessage, new BlockParameter(10000));
but i guess a combination of a service and messaging will be simpler too
thinking about it now hence I am asking :)
Andres G. Aragoneses
@knocte
Feb 20 2018 13:13
ah nice
yeah the gist is super useful for me now then
Juan Blanco
@juanfranblanco
Feb 20 2018 13:14
also the message includes other options, like value, gasprice, gas etc
Greatsamps
@Greatsamps
Feb 20 2018 13:24
Hi. Circling back to a previous question, how can i exactly get access to the state database. I.e. how can i check if an address is already in use?
can't see to find a way
Andres G. Aragoneses
@knocte
Feb 20 2018 13:39
@juanfranblanco what namespace/assembly is ContractMessage defined in?
oh it's Nethereum.Contracts.CQS
Andres G. Aragoneses
@knocte
Feb 20 2018 13:49
seems like it's only in a new version (not 2.0.1), that's why I didn't find it :)
Juan Blanco
@juanfranblanco
Feb 20 2018 13:54
ah yeah
new version
@Greatsamps check the balance of the account?
Greatsamps
@Greatsamps
Feb 20 2018 13:55
kinda, need to see if an address i have created is in use on the chain
Juan Blanco
@juanfranblanco
Feb 20 2018 14:04
hmm yeah, contracts might have a reference
getStorageAt will return the contract state so that won't work
but trying to figure out what contract has an address store in the state will be rather difficult
Greatsamps
@Greatsamps
Feb 20 2018 14:06
ok, perhaps i just drag it all into our own DB which i was thinking of doing anyway, then its easy to get from there
Juan Blanco
@juanfranblanco
Feb 20 2018 14:11
yeah
that is the way
Greatsamps
@Greatsamps
Feb 20 2018 14:28

I have another question, and its not really netherum related.

I am looking at the Rinkeby testnet block explorer. the first 55 blocks have zero transactions, then at block 55, there is a transaction of 1 eth between 2 addresses.

How did the sender get this 1eth to send?

i have to be missing something here, or perhaps i'm just being a little thick!

Juan Blanco
@juanfranblanco
Feb 20 2018 14:29
from a faucet
Greatsamps
@Greatsamps
Feb 20 2018 14:29
ah i see, let me do some reading on that
thanks :)
Juan Blanco
@juanfranblanco
Feb 20 2018 14:30
a faucet is mainly normally a website (or just an address) that gives ether for the testnet so you dont need to mine it
Greatsamps
@Greatsamps
Feb 20 2018 14:31
ok, which i presume is only a feature enabled on testnet for obvious reasons. On mainnet, would i expect to see transactions providing the mining reward?
thanks for the link
the block reward
Juan Blanco
@juanfranblanco
Feb 20 2018 14:34
yes true
Greatsamps
@Greatsamps
Feb 20 2018 14:35
back to Neth now :) i don't seem to see BlockReward or UnclesReward on the HetBlockWithTransactionHashesByNumber call
does it live somewhere else?
Greatsamps
@Greatsamps
Feb 20 2018 14:42
it does... in the code you have to write yourself!
think i'm good now, thanks for pointers
Juan Blanco
@juanfranblanco
Feb 20 2018 14:46
well you can use the miner address
the block reward you will know it
or should know it
Greatsamps
@Greatsamps
Feb 20 2018 14:47
awesome thanks!
Juan Blanco
@juanfranblanco
Feb 20 2018 14:50
also you have transaction fees
etc
uncle inclusion
the reward is 3 now