These are chat archives for Nethereum/Nethereum

19th
Sep 2018
Lyon.Nee
@LyonNee
Sep 19 2018 02:58 UTC
Who can give me an API manual?
thanks
Juan Blanco
@juanfranblanco
Sep 19 2018 09:10 UTC
@KevinSmall i will be there :)
@TarrahArshad check the blockchain storage project, or parity trace_filters or etherscan :)
@LyonNee you can check the Nethereum.readthedocs.org
all the rpc apis are the same as the standard Ethereum rpc apis
cesarsld
@cesarsld
Sep 19 2018 10:13 UTC
Hello everyone! I am trying to watch one event of an existing contract on the ethereum blockchain. I set up this code to do so : https://pastebin.com/fRSUbNtw
But keep getting the error Error occurred when trying to send rpc requests(s) when creating the filter. Am I missing something?
Juan Blanco
@juanfranblanco
Sep 19 2018 10:16 UTC
@cesarsld infura does not support filters
so you need to use get all changes from a block ranges (mainly get logs)
check this recent workbook on events and see if it helpls
cesarsld
@cesarsld
Sep 19 2018 10:18 UTC
oh! I didn't know infura didn't support filters, what other service supports them? I was going crazy last night reading all the documentation
cesarsld
@cesarsld
Sep 19 2018 10:19 UTC
Thank you, will take a look
cesarsld
@cesarsld
Sep 19 2018 11:41 UTC
Alright, I understand it a bit better. I changed my filter from CreateFilterAsyn() to CreateFilterInput(firstBlock, lastBlock) and not get any error! But my log remains null now...
function to get logs : var logs = auctionSuccesfulEvent.GetAllChanges<AuctionSuccessfulEvent>(filterAll);
ah nevermind...
I forgot to put await keyword. I got a result
Michael Ilchuk
@Ilchuk-Mihail
Sep 19 2018 11:52 UTC
Does Nethereum library have some methods for encryption and decryption private keys ?
I mean simple encryption with password, without storing files.
Juan Blanco
@juanfranblanco
Sep 19 2018 11:56 UTC
No it doesn't, you could use the same mechanism as the KeyStore, but just keeping the json as a string
also if is not "fast" enough alter the cost
(obviously less secure)
Michael Ilchuk
@Ilchuk-Mihail
Sep 19 2018 11:59 UTC
Maybe I can use some Aes algo in .net

one more question

I have error when i estimate gas, to contract function

Message = "Destination array was not long enough. Check the destination index, length, and the array's lower bounds.\r\nParameter name: destinationArray"

Function parameters - address _to, uint256 _amount, bytes32 _msgHash, bytes _signature,

What is wrong ?

var messageHash = Web3.Sha3(messageToSign);

Michael Ilchuk
@Ilchuk-Mihail
Sep 19 2018 12:06 UTC
When I convert messageHash.HexToByteArray(), signedMessage.HexToByteArray()
I had error -> Message = "Invalid value for type 'Nethereum.ABI.Encoders.IntTypeEncoder': System.Byte[] (System.Byte[])"
Juan Blanco
@juanfranblanco
Sep 19 2018 13:29 UTC
that is the abi / contract type?
i see sorry :) Function parameters - address _to, uint256 _amount, bytes32 _msgHash, bytes _signature,
is your FunctionMessage correct?
Michael Ilchuk
@Ilchuk-Mihail
Sep 19 2018 13:47 UTC
Sorry, error not in parameters. Error in this function Ecrecover inside contract
About encryption - I good to use Aes ?
Juan Blanco
@juanfranblanco
Sep 19 2018 13:51 UTC
well whatever is your favourite encryption method
Juan Blanco
@juanfranblanco
Sep 19 2018 13:59 UTC
bu yeah aes is good
Michael Ilchuk
@Ilchuk-Mihail
Sep 19 2018 17:20 UTC

@juanfranblanco

I create sign with Nethereum :

                    var messageToSign = "abc";
                    var messageHash = Web3.Sha3(messageToSign);
                    var signer = new MessageSigner();
                    var signedMessage = signer.Sign(messageHash.HexToByteArray(), userAccount.PrivateKey);

And based on https://hackernoon.com/a-closer-look-at-ethereum-signatures-5784c14abecc -
( In section : Let’s take a look at the exact functions used in Ethereum to do the signing)

If I adding the prefix - "\x19Ethereum Signed Message:\n32"; I gets error.

Do I need add this prefix to message?

Code from my contract :

  //  validate signature
    bytes32 prefixedHash = ECRecovery.toEthSignedMessageHash(_msgHash); 
    address signer = ECRecovery.recover(prefixedHash, _signature);
And one more thing, does it matter when to add the signature? in Nethereum lib or in my contract
Sergio Piedrahita
@spied001
Sep 19 2018 23:27 UTC
@juanfranblanco I am getting an rpc timeout exception, is there a way to modify the timeout value?
never mind, I just found out how to do it