These are chat archives for Nethereum/Nethereum

19th
Mar 2018
gnoblin
@gnoblin
Mar 19 2018 01:52
Hi!
System.Exception: Invalid KeyStore json ---> System.ArgumentNullException: Argument cannot be null.
Parameter name: value
at Newtonsoft.Json.Utilities.ReflectionUtils.IsNullable (System.Type t) [0x00000] in <filename unknown>:0
at Newtonsoft.Json.Linq.Extensions.Value[T,U] (IEnumerable`1 value) [0x00000] in <filename unknown>:0
at Nethereum.KeyStore.KeyStoreKdfChecker.GetKeyStoreKdfType (System.String json) [0x00000] in <filename unknown>:0
at Nethereum.KeyStore.KeyStoreService.DecryptKeyStoreFromJson (System.String password, System.String json) [0x00000] in <filename unknown>:0
at DecipherJob.ThreadFunction () [0x00000] in <filename unknown>:0
at ThreadedJob.Run () [0x00000] in <filename unknown>:0
I'm getting this error on iOS only when deciphering keystore
var keystoreservice = new Nethereum.KeyStore.KeyStoreService();
byte[] bytes = keystoreservice.DecryptKeyStoreFromJson(password, json);
var superKey = new Nethereum.Signer.EthECKey(bytes, true);
var PrivateKey = superKey.GetPrivateKey();
var Address = superKey.GetPublicAddress();
what could be the issue? thanks
gnoblin
@gnoblin
Mar 19 2018 02:13
for some reason also - keystore is different on iOS and on Mac

{"crypto":{"ciphertext":"3e35b34b7488823905b3dc6e44d9d9006e5b056a2e281c394bf7b4af28ed0ac9","cipherparams":{"iv":"cbab520cf210f13f552078b18c3919d6"},"mac":"d9f7b2ebf06e6233982c64e692f64831d88492875a4836355a37cf119d60792b","kdfparams":{"n":262144,"r":1,"p":8,"dklen":32,"salt":"228abcd23a573c8e1bcacc980e2a7127ea2eb319ec386b6edc45928ddbce2fb5"}}}

{"crypto":{"cipher":"aes-128-ctr","ciphertext":"96e62d5ab954edd4c7754557be5f3f0b41371e9361b79276349355b8025bb04b","cipherparams":{"iv":"b48878e5e100a503c2902259d80cf4be"},"kdf":"scrypt","mac":"24806b045ee438e6bad18cb3c0051cdf5de8ac9dcc84249e13f348349d4ba7c3","kdfparams":{"n":262144,"r":1,"p":8,"dklen":32,"salt":"6b849f88cfe99b3773104234186447f169bb832fec4ec30c95c095f2bda283d3"}},"id":"2fac7051-ca35-4d69-adfe-72b0e972acef","address":"0x31d6a536034935D7F5F731eE781f026275725C45","version":3}

could this be the reason for not being deciphered?
heddhshan
@heddhshan
Mar 19 2018 07:08
contract can be gen a C# wrapper class?
Vitaliy Lukanin
@v-lukanin
Mar 19 2018 09:32
@juanfranblanco >> "create transaction, send to sender, validate message, recovering and send" - yes, I can create TransactionInput with DeployContractTransactionBuilder().BuildTransaction() method. Also I can create Nethereum.Signer.Transaction() object for contract deployment transaction. But what is a correct way to convert one of these to string or byte[] to send to client for signing? There is even no Sender address field so I'm a bit confused.
The second question: is there a logic or method that allows to parse signed transaction from string or byte[] so I could validate its parameters?
Juan Blanco
@juanfranblanco
Mar 19 2018 13:28
@heddhshan you can use visual studio code (Solidty extension) for that or the Nethereum.Generator.Console (althought that is going to be depricated and work in progress on the new one)
@gnoblin hmm that should not be the issue
can you file an issue for this?
Vitaliy Lukanin
@v-lukanin
Mar 19 2018 13:30
@v-lukanin I also found that I can use Nethereum.Signer.Transaction.GetRLPEncoded().ToHex() to get string representation of unsigned transaction, but I cannot restore Transaction object based on result string (error: Signature not initiated or calculatated). Need to ensure that this hex string can be used to send to javascript for signing. Am I on the right way?
Juan Blanco
@juanfranblanco
Mar 19 2018 13:32
@v-lukanin you can retrieve the r, s, v from a string if you need
no you are not on the right way
for your server you send the transaction
Vitaliy Lukanin
@v-lukanin
Mar 19 2018 13:33
Ok, can you tell me please how to get a byte code of unsigned contract deployment transaction?
Juan Blanco
@juanfranblanco
Mar 19 2018 13:33
then they will respond with the r,s,v
why dont you pass the transctioninput
that's it
that includes everything
Vitaliy Lukanin
@v-lukanin
Mar 19 2018 13:36
Hm, what format do you mean? I thought I need to convert it to string or to byte array before sending to client
so client could just sign it
Juan Blanco
@juanfranblanco
Mar 19 2018 13:36
hmmm?
are you asking to send this to a geth client?
then use a ManagedAccount and send transaction
Vitaliy Lukanin
@v-lukanin
Mar 19 2018 13:37
no-no, client is a browser (java script) here
I need to create transaction for him and to ensure that he did not modify it when I receive it back signed
Juan Blanco
@juanfranblanco
Mar 19 2018 13:38
then just send a transaction in json and let client format and sign it
then when is back recover it and you are done
Vitaliy Lukanin
@v-lukanin
Mar 19 2018 13:40
I need to think on it. So there is not simple way to convert it to byte code or string that can be used and signed with java script?
Vitaliy Lukanin
@v-lukanin
Mar 19 2018 13:49
I think I really can just send transaction in json format, it is even easier : ) So I'll be able to use Nethereum.Signer.Transaction() when I receive signed bytecode to parse it and validate that it was not changed, correct? I'll check it, thanks!
Juan Blanco
@juanfranblanco
Mar 19 2018 14:07
yep that is the simplest way (for you)
you can do it don't get me wrong
you can see the transaction signer unit test and the transaction signer
if you want raise an issue and put it on the queue to simplify it
JEN
@chukwuemekanweke
Mar 19 2018 14:17
@juanfranblanco Please what's the default gas price for the web3 transaction manager. Also, when specifying a custom gas price. do i do that in gwei or wei
Vitaliy Lukanin
@v-lukanin
Mar 19 2018 15:17
I'm not Juan but it seems to be Transaction.DEFAULT_GAS_PRICE that is currently set to 20000000000 wei
JEN
@chukwuemekanweke
Mar 19 2018 15:19
@v-lukanin thanks
is that wei or gwei?
Vitaliy Lukanin
@v-lukanin
Mar 19 2018 15:21
wei
Juan Blanco
@juanfranblanco
Mar 19 2018 15:33
^^^
JEN
@chukwuemekanweke
Mar 19 2018 15:34
Thanks @v-lukanin && @juanfranblanco
Priyank Jani
@PriyankJani_twitter
Mar 19 2018 20:33
Hey there, I am trying to switch from Ethereum full node to INFURA. Can anyone help me how to change it? I change my URL from "http://localhost:8545" to "https://ropsten.infura.io/KEY" . But still I am facing error.
JEN
@chukwuemekanweke
Mar 19 2018 22:59
your app should use https
You can change that setting from the properties tab of visual studio