0

I am not able to connect to Quorumchain using Nethereum. Below is my code and error response.

I have verified and the port is open in the machine. I am running on a Linux machine, Ubuntu 18.04. I couldn't see any issue in code or port, could someone help to resolve this problem.

I am able to connect to node using geth attach on command line.

Code:

using Nethereum.Quorum; using Nethereum.RPC.Eth.DTOs; using Nethereum.Web3; using Nethereum.Web3.Accounts; using System; using System.Threading.Tasks;

namespace QuorumTest { class Program { public static async Task Main(string[] args) { Console.WriteLine("Hello.. This is the Quorum Test!"); try { var web3Quorum = new Web3Quorum("http://localhost/8001"); var coinbaseAcct = await web3Quorum.Eth.CoinBase.SendRequestAsync(); Console.WriteLine("Coinbase is: {0}", coinbaseAcct); } catch(Exception e) { Console.Write(e); }

} } }

Response:

gethadmin@manojpoc2:~/dotnetapps/QuorumTest/QuorumTest$ dotnet run Hello.. This is the Quorum Test! Nethereum.JsonRpc.Client.RpcClientUnknownException: Error occurred when trying to send rpc requests(s) ---> System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException: Connection refused at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask) at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 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) --- End of inner exception stack trace --- at Nethereum.JsonRpc.Client.RpcClient.SendAsync(RpcRequestMessage request, String route) at Nethereum.JsonRpc.Client.ClientBase.SendInnerRequestAsyncT at Nethereum.JsonRpc.Client.ClientBase.SendInnerRequestAsyncT at Nethereum.JsonRpc.Client.ClientBase.SendRequestAsyncT at QuorumTest.Program.Main(String[] args) in /home/gethadmin/dotnetapps/QuorumTest/QuorumTest/Program.cs:line 18

_

0

I have found the issue in my code, I did not use proper url, I need to give the http://url:port

after correcting my url, the connection is fine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.