These are chat archives for Nethereum/Nethereum

14th
Jun 2018
Juan Blanco
@juanfranblanco
Jun 14 2018 04:03
hmm yeah good feedback, vscode outputs the whole path as force whole paths to allow for the different libraries etc
I am creating solc .net bindings (but that is not a direct problem)
Juan Blanco
@juanfranblanco
Jun 14 2018 05:28
Btw if you do this@
dotnet tool install -g Nethereum.Generator.Console
you can install the generator
Juan Blanco
@juanfranblanco
Jun 14 2018 08:39
@/all here is the CI myget feed for the ones that cannot wait :) https://www.myget.org/gallery/nethereum
mmotiy
@mmotiy
Jun 14 2018 11:15
@juanfranblanco
Psilon
@Pzixel
Jun 14 2018 13:17
Hi @juanfranblanco
I have following suggestion from Parity team
Try to manage the nonce on your own (i.e. fetch next nonce before sending any transactions and then increment it in your app)
Try pre-signing the transactions (will also require manual nonce management) and then use eth_sendRawTransaction to let Parity only take care of including these transactions to the block.
is it possible with Nethereum?
Juan Blanco
@juanfranblanco
Jun 14 2018 13:21
that is what Nethereum does in the background
when you set the Account(privateKey)
Psilon
@Pzixel
Jun 14 2018 13:22
Nethereum is pre-signing transaction?
Juan Blanco
@juanfranblanco
Jun 14 2018 13:22
of course
Psilon
@Pzixel
Jun 14 2018 13:22
and it's managing nonce?
Juan Blanco
@juanfranblanco
Jun 14 2018 13:22
in memory
per Web3 instance
Psilon
@Pzixel
Jun 14 2018 13:22
how then two instances deal with each other?
they won't create conflicting nonces?
Juan Blanco
@juanfranblanco
Jun 14 2018 13:22
ah.. that is upto you
Psilon
@Pzixel
Jun 14 2018 13:23
well, I have single one
but I was planning to add more
so it's better to have single instance, right?
you can replace your nonce service
and have something else manage your nonce
Psilon
@Pzixel
Jun 14 2018 13:25
when you set the Account(privateKey)
Juan Blanco
@juanfranblanco
Jun 14 2018 13:25
there are two types of Accounts in Netheruem
Account and ManagedAccount
Psilon
@Pzixel
Jun 14 2018 13:25
var account = new ManagedAccount(ethereumSettings.AccountAddress, ethereumSettings.AccountPassword);
var web3 = new Web3(account, ethereumSettings.ParityConnectionString);
I use the latter
Juan Blanco
@juanfranblanco
Jun 14 2018 13:25
in the future might be more
ah...
Psilon
@Pzixel
Jun 14 2018 13:26
I can switch to the former if it gives anything
Juan Blanco
@juanfranblanco
Jun 14 2018 13:26
the ManagedAccount does not sign the transactions
yes
Psilon
@Pzixel
Jun 14 2018 13:26
Ok
Juan Blanco
@juanfranblanco
Jun 14 2018 13:26
you can that is the point of abstracting everything
replace the Account
and magic :D
Psilon
@Pzixel
Jun 14 2018 13:26
Okay
But it doesn't accept address and password
Juan Blanco
@juanfranblanco
Jun 14 2018 13:27
no
Psilon
@Pzixel
Jun 14 2018 13:27
how should I rewrite my code?
Juan Blanco
@juanfranblanco
Jun 14 2018 13:27
it accepts the privave key
Psilon
@Pzixel
Jun 14 2018 13:27
Hm
Juan Blanco
@juanfranblanco
Jun 14 2018 13:27
private key
Psilon
@Pzixel
Jun 14 2018 13:27
Where can I obtain one?
Juan Blanco
@juanfranblanco
Jun 14 2018 13:27
well the private key
is the key correspoding to the ethereum address
so if you use parity
you can go to the keystore
and decrypt the file with your password
Nethereum has the KeyStore also
If you use .net451+ (not standard or core)
Psilon
@Pzixel
Jun 14 2018 13:29
I use core
Juan Blanco
@juanfranblanco
Jun 14 2018 13:29
ah ignore it
Psilon
@Pzixel
Jun 14 2018 13:29
)
Juan Blanco
@juanfranblanco
Jun 14 2018 13:29
there is a shortcut for that
Psilon
@Pzixel
Jun 14 2018 13:29
You can recall that I found one bug when swtiching from 2.0 to 2.1
Juan Blanco
@juanfranblanco
Jun 14 2018 13:29
in Accout to open the keystore file with a password
yeah you did :D
Psilon
@Pzixel
Jun 14 2018 13:30
I could do it manually, I guuess
Juan Blanco
@juanfranblanco
Jun 14 2018 13:31
look that workbook will do it for you
Psilon
@Pzixel
Jun 14 2018 13:34
{
  "id": "0d1533e9-dd7a-a838-68dc-36ddc025c1ab",
  "version": 3,
  "crypto": {
    "cipher": "aes-128-ctr",
    "cipherparams": {
      "iv": "acbabbab8eab2b952ad3cf2bd1aab0ca"
    },
    "ciphertext": "134b54d057c3c0a9ac08b5eae36c46ab8dd45774215ce860afaeb4e8e50c927d",
    "kdf": "pbkdf2",
    "kdfparams": {
      "c": 10240,
      "dklen": 32,
      "prf": "hmac-sha256",
      "salt": "6f9e3ebd99b24becad3e8f773f44df8397cad68694abf7651880528d9552bfe7"
    },
    "mac": "f8939019ec29b46694b5ac07fdf971ec740ca4de23e7ae84a1239f54c617f7d9"
  },
  "address": "6b0c56d1ad5144b4d37fa6e27dc9afd5c2435c3b",
  "name": "master0"
}
what is the key here?
134b54d057c3c0a9ac08b5eae36c46ab8dd45774215ce860afaeb4e8e50c927d?
Juan Blanco
@juanfranblanco
Jun 14 2018 13:38
you need to decrypt it
using your password
check the workbook i just send above
or..
do top of my head..
Account.LoadFromKeyStore(json, password);
Psilon
@Pzixel
Jun 14 2018 13:42
I did
var json = File.ReadAllText(@"C:\Users\Alex\Desktop\master6.txt");
//create a new Nethereum key store service
var service = new KeyStoreService();
//decrypt the json using the password and get the private key
var key = service.DecryptKeyStoreFromJson("", json).ToHex();
key.Dump();
showed something
so I'm probably ok
Juan Blanco
@juanfranblanco
Jun 14 2018 13:42
ah that is a good password "" ;D
Psilon
@Pzixel
Jun 14 2018 13:47
Just fine for a playground:D
Well, it works like a charm on a new network
but my failed network is unable to response on it
Juan Blanco
@juanfranblanco
Jun 14 2018 13:52
the key has not direct relationship with that
well shouldn't
(you can get account does not have enough funds etc)
Psilon
@Pzixel
Jun 14 2018 13:54
I'm not sure what are you talking about
Juan Blanco
@juanfranblanco
Jun 14 2018 13:54
ignore it then
Psilon
@Pzixel
Jun 14 2018 13:54
I'm just saying that I didn't protect my acc with strong password to play with parity
Juan Blanco
@juanfranblanco
Jun 14 2018 13:54
it was just a comment
Psilon
@Pzixel
Jun 14 2018 13:54
ah I've got
well
Juan Blanco
@juanfranblanco
Jun 14 2018 13:54
Well, it works like a charm on a new network
but my failed network is unable to response on it
Psilon
@Pzixel
Jun 14 2018 13:55
Parity guys think that presigning txs could help
Juan Blanco
@juanfranblanco
Jun 14 2018 13:55
my point was that it should not be an issue with pre signing transactions
Psilon
@Pzixel
Jun 14 2018 13:55
well
Juan Blanco
@juanfranblanco
Jun 14 2018 13:55
yes it will
for performance
because they have to unlock the account each time
Psilon
@Pzixel
Jun 14 2018 13:55
PrivateKey has always better performance?
Juan Blanco
@juanfranblanco
Jun 14 2018 13:55
and decrypt it
decryption is expensive as per design
(if they dont cache the private key internally)
Psilon
@Pzixel
Jun 14 2018 13:56
yes, I didn't see they do it
Psilon
@Pzixel
Jun 14 2018 16:20
@juanfranblanco well, I tried this approach
first transaction gives me
Unhandled Exception: Nethereum.JsonRpc.Client.RpcResponseException: Transaction nonce is too low. Try incrementing the nonce.
at Nethereum.RPC.TransactionReceipts.TransactionReceiptPollingService.<DeployContractAndWaitForReceiptAsync>d__8.MoveNext()
it means someone else is writting in the network?
Juan Blanco
@juanfranblanco
Jun 14 2018 16:29
yep
exactly
you should not share your accounts if not needed
Psilon
@Pzixel
Jun 14 2018 16:45
hm
so I can multithread
from different accounts?
Juan Blanco
@juanfranblanco
Jun 14 2018 16:52
you can multithread locally if using the same web3
and if using different nodes
yes of course with different accounts if not managing the nonce
Psilon
@Pzixel
Jun 14 2018 16:54
I mean nonce is a global thing or account-local?
so if I have one app that manages nonce internally then I can't have others?
Juan Blanco
@juanfranblanco
Jun 14 2018 16:54
nonce is specific for an account
Psilon
@Pzixel
Jun 14 2018 16:54
so
I can have 10 apps
with 10 accounts
Juan Blanco
@juanfranblanco
Jun 14 2018 16:54
sure
Psilon
@Pzixel
Jun 14 2018 16:55
and they all can manage nonce internally?
or they should share it in some way?
I'm using Account instead of ManageAccount so I wonder if I can run extra web3 instances
with different accounts
because I was thinking about nonce as it is some unique value across the entire blockchain
and now you say it's account-local
Juan Blanco
@juanfranblanco
Jun 14 2018 16:57
the nonce is driven by the number of transctions
of an account
so if you sending many transactions at the same time you need to manage internally
Psilon
@Pzixel
Jun 14 2018 17:09
so ideally I need to send transactions from multiple accounts?
I'm just trying to figure out best parameters
that provide the best performance in terms of tx/sec
Psilon
@Pzixel
Jun 14 2018 17:25
@juanfranblanco I see Transaction gas price is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce. with single publisher
what could be wrong?
is nonce provider thread safe?
Devedse
@devedse
Jun 14 2018 17:31
Hi guys question, I if I connect to a GETH node using Nethereum, and that GETH node is fully exposed to the internet, will a Web3.unlock account actually send my private key over to the node itself?
As in, if I would connect to a rogue GETH client using Nethereum would they be able to do anything?
Truong Dang Nghia
@DangNghia123_twitter
Jun 14 2018 17:43
hi, i want to get all constract adress of tokens in my wallet because when i want to check tokens balance it must be specificed for each token
Stef Heyenrath
@StefH
Jun 14 2018 18:17
@juanfranblanco That Nethereum.Generator.Console, does it support custom templates to generate c# code?
Psilon
@Pzixel
Jun 14 2018 21:20
@juanfranblanco thank you
after I switched to Account insted of ManagedAccount I'm able to handle 100k txs per hour
This is load graph for ManagedAccount
15 min of fullspeed saving (at 30tx/s)
and then degradation for next 15 minutes
then it's just fails to 0
and all txs are blocked
nothing is working until entire network is restarted with data deletion
and here is today graph
same 30k messages
but now the work at 40/sec
and no degradation
Maybe it should be described somewhere in docs
there is my blood on this research papers ;)