These are chat archives for Nethereum/Nethereum

6th
Dec 2018
Juan Blanco
@juanfranblanco
Dec 06 2018 04:28
@rsantirso mainly that function is going to validate that the address has been signed by the sender. So it needs to be abi encoded as per the logic, and signed, then you pass the r,v,s
Juan Blanco
@juanfranblanco
Dec 06 2018 04:43
@hessam94 that will be due to an error in your transaction
why you don't get the log in the transaction receipt
Mosin Pathan
@mosinms7711
Dec 06 2018 09:17
How to send wallet address in CallDeserializingToObjectAsync method...
MANOJKUMARCH
@MANOJKUMARCH
Dec 06 2018 09:23

Hi, I am trying to work on Quorum and I have created a node with Quorum which is running with raft. When I make a transaction to Quorum chain with below code, I see the error "unable to send RPC request(s)". I see the error when trying to get the coinbase account itself.

public static async Task Main(string[] args)
{
Console.WriteLine("Hello.. This is the Quorum Test!");
try
{

            var web3Quorum = new Web3Quorum("http://127.0.0.1/8001/");
            var gasEstimate = new Nethereum.Hex.HexTypes.HexBigInteger(40000);
            var coinbaseAccount = await web3Quorum.Eth.CoinBase.SendRequestAsync();
            var TxInp = new TransactionInput("Test Data Quorum", "0xa5a85c234bca3D4BF29f7Bd7AD7D458dea8Ea8E9");
            var txId = await web3Quorum.Eth.Transactions.SendTransaction.SendRequestAsync(TxInp);
        }
        catch(Exception e)
        {
            Console.Write(e);
        }

    }
Juan Blanco
@juanfranblanco
Dec 06 2018 10:10
@mosinms7711 what are you trying to do?
@MANOJKUMARCH your port is wrong
correct?
Matthew Morrison
@matthewsmorrison
Dec 06 2018 10:13
@juanfranblanco morning - any response from the Kaleido team yet? I've had no further luck fixing that issue
Dave Whiffin
@Dave-Whiffin
Dec 06 2018 10:38
@mosinms7711 Hi - can you provide more detail on what you are trying to achieve?
Mosin Pathan
@mosinms7711
Dec 06 2018 10:40
@Dave-Whiffin @juanfranblanco i am trying to get data from smart contract but i am getting error saying “Value was either too large or too small for an Int32."
Dave Whiffin
@Dave-Whiffin
Dec 06 2018 10:41
@mosinms7711 Can you provide a snippet of your existing code?
Juan Blanco
@juanfranblanco
Dec 06 2018 10:41
@matthewsmorrison no not yet
Mosin Pathan
@mosinms7711
Dec 06 2018 10:41

ABI: { ""constant"": true, ""inputs"": [], ""name"": ""getFilesOfOwner"", ""outputs"":
[ { ""components"":
[ { ""name"": ""fileName"", ""type"": ""bytes32"" },
{ ""name"": ""kfsHash"", ""type"": ""string"" } ]

Code:

var contract = await this.Init(AppConstants.contractAbi, AppConstants.contractAddress);

var readFunction = contract.GetFunction("getFilesOfOwner");

var transactionHash = await readFunction.SendTransactionAsync(AppConstants.walletAddress);
//var resultlistImages = await readFunction.CallAsync<allImages>();
var receipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash);

if(receipt!=null)
{
var resultlistImages = await readFunction.CallDeserializingToObjectAsync<allImages(); // var resultlistImages = await readFunction.CallAsync<allImages>();
}

Model:
[FunctionOutput]
public class allImages
{
[Parameter("bytes32", "fileName", 1)]
public byte[] imageName { get; set; }
[Parameter("string", "kfsHash", 2)]
public string imageHash { get; set; }
}

Matthew Morrison
@matthewsmorrison
Dec 06 2018 10:43
@MANOJKUMARCH trying pulling a list of all accounts from the Quorum node before anything else. This will let you know if you have successfully connected to the node.
Juan Blanco
@juanfranblanco
Dec 06 2018 10:43
ok great :)
@mosinms7711 are you using returning a struct ?
you won't be able to load an abi yet that way
Mosin Pathan
@mosinms7711
Dec 06 2018 10:45
Yes...
@juanfranblanco getFilesOfOwner function returns struct object...
Juan Blanco
@juanfranblanco
Dec 06 2018 10:49
ok let me do a quick sample
MANOJKUMARCH
@MANOJKUMARCH
Dec 06 2018 11:02

@matthewsmorrison Hi, I am actually trying to pull the coinbase account from the node and its creating the issue, so which means I am not connected to node. But I do not see any issue with the code or the port used, and so couldn't proceed.

Below is the code

            var web3Quorum = new Web3Quorum("http://127.0.0.1/8001/");
            var gasEstimate = new Nethereum.Hex.HexTypes.HexBigInteger(40000);
            var coinbaseAccount = await web3Quorum.Eth.CoinBase.SendRequestAsync();

Below is the error

Nethereum.JsonRpc.Client.RpcClientUnknownException: Error occurred when trying to send rpc requests(s) ---> System.OperationCanceledException: The operation was canceled.
at System.Net.Http.HttpClient.HandleFinishSendAsyncError(Exception e, CancellationTokenSource cts)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Nethereum.JsonRpc.Client.RpcClient.SendAsync(RpcRequestMessage request, String route)

Juan Blanco
@juanfranblanco
Dec 06 2018 11:03
var web3Quorum = new Web3Quorum("http://127.0.0.1/8001/");
should be var web3Quorum = new Web3Quorum("http://127.0.0.1:8001");
@MANOJKUMARCH
MANOJKUMARCH
@MANOJKUMARCH
Dec 06 2018 11:19
@juanfranblanco Thanks Juan, I will work on it
Juan Blanco
@juanfranblanco
Dec 06 2018 11:39
@mosinms7711
and here is the code generated contract definition using vs code or console
note we currently don't code generate the structs as it is still experimenta
that is marked in the file
if you run the check you will notice the msg.sender is already defined (the same as we use in web3) so you will only get the results for the Nethereum test account
if you wanted to change the sender in a call just create the FunctionMessage instance and set the from address (use it as a parameter of an overload)
Juan Blanco
@juanfranblanco
Dec 06 2018 11:45
also there is a sample with no structs (as it might be easier if you don't need them yet)
Mosin Pathan
@mosinms7711
Dec 06 2018 11:54
Thank you @juanfranblanco
Roy
@Shammah
Dec 06 2018 19:43
Are there by any chance Resharper settings I can import for this project to conform to some kind of style guidelines?
Juan Blanco
@juanfranblanco
Dec 06 2018 20:11
just use default, although UPPER case for static constants, only issue private with underscore / not underscore has been broken in some areas. I might do a pass to normalise all the private fields.
I will **
comments, no comments if not necessary, that is huge effort to maintain with not added value
meaningful names, variables :)
and most important (and painful) ensure support for the lowest versions of the frameworks
Roy
@Shammah
Dec 06 2018 20:15
Alright
Tom Ryan
@a7coretryan
Dec 06 2018 20:40
@juanfranblanco do you have a method to uninstall a filter (eth_uninstallFilter)?
Juan Blanco
@juanfranblanco
Dec 06 2018 20:41
yeah web3.Eth.Filters.UninstallFilter
.SendRequestAsync
Tom Ryan
@a7coretryan
Dec 06 2018 20:42
perfect - thanks
Juan Blanco
@juanfranblanco
Dec 06 2018 20:43
no bother
fruor
@fruor
Dec 06 2018 22:05
seems the StartAuctionsAndBidRequestAsync and StartAuctionsAndBidRequestAndWaitForReceiptAsync can't do the gas estimation
i get from my local nodes (Ropsten):
Parity: RpcResponseException: The execution failed due to an exception.
Geth: RpcResponseException: gas required exceeds allowance or always failing transaction
StartAuctionRequestAsync seems to work though, just without a bid :)
fruor
@fruor
Dec 06 2018 22:10
Nethereum/Nethereum#276
this was closed in June, so I guess the nuget version should be fine?
anyway, will try now with the git version
fruor
@fruor
Dec 06 2018 22:16
Can I set the gas and gasprice myself?
just found examples to do that in transfers
Juan Blanco
@juanfranblanco
Dec 06 2018 22:17
yes you can do that yourself
just use the function message instead
you can also estimate and add more gas
parity sometimes has problems estimating
fruor
@fruor
Dec 06 2018 22:19
yes, parity and gas just don't like each other
Juan Blanco
@juanfranblanco
Dec 06 2018 22:19
:)
fruor
@fruor
Dec 06 2018 22:20
could you give me an example for function message?
Juan Blanco
@juanfranblanco
Dec 06 2018 22:20
oh sure
because you are using the service, there is an overload that takes the message (like the TransactionFunction)
in that sample you can see the TransactionFunction that has the Gas property which you can set manually together with some estimate
fruor
@fruor
Dec 06 2018 22:40
ok, estimate gas like in that example creates the same errors
I could send this to the blockchain though:
var startAuctionsMessage = new StartAuctionsAndBidFunction()
{
GasPrice = gasprice,
Gas = gas,
Hashes = myhashes,
SealedBid = sealedBid
};
var andthat = await registrarService.StartAuctionsAndBidRequestAndWaitForReceiptAsync(startAuctionsMessage);
but tx failed with 10% gas used and reverted :(
do I need to fill in ALL fields now, like nonce etc.?
fruor
@fruor
Dec 06 2018 22:48
Nevermind, of course and it works :-D
thank you good Sir
Juan Blanco
@juanfranblanco
Dec 06 2018 23:44
no you don't need to populate all the fields (just in case)