2

Don't know what's wrong. Here's the code:

let web3 = Web3("https://api.myetherapi.com:443")
let balanceTask = web3.Eth.GetBalance.SendRequestAsync(account.PublicAddress, 1)
balanceTask.Wait()
balanceTask.Result.ToString()

The API I'm using is https://www.myetherapi.com/ (it works with CURL!).

The exception is:

System.AggregateException: One or more errors occurred.
 ---> EdjCase.JsonRpc.Client.RpcClientUnknownException: Error occurred when trying to send rpc requests(s)
 ---> System.Net.Http.HttpRequestException:
Response status code does not indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at EdjCase.JsonRpc.Client.RpcClient.<SendAsync>d__23`2.MoveNext()
   --- End of inner exception stack trace ---
   at EdjCase.JsonRpc.Client.RpcClient.<SendAsync>d__23`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at EdjCase.JsonRpc.Client.RpcClient.<SendRequestAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Nethereum.JsonRpc.Client.RpcRequestResponseHandler`1.<SendRequestAsync>d__7.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at GWallet.Backend.AccountApi.GetBalance(Account account) in C:\Users\andre_000\Documents\Code\gwallet\src\GWallet.Backend\AccountApi.fs:line 19
---> (Inner Exception #0) EdjCase.JsonRpc.Client.RpcClientUnknownException: Error occurred when trying to send rpc requests(s) ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at EdjCase.JsonRpc.Client.RpcClient.<SendAsync>d__23`2.MoveNext()
   --- End of inner exception stack trace ---
   at EdjCase.JsonRpc.Client.RpcClient.<SendAsync>d__23`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at EdjCase.JsonRpc.Client.RpcClient.<SendRequestAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Nethereum.JsonRpc.Client.RpcRequestResponseHandler`1.<SendRequestAsync>d__7.MoveNext()<---

1 Answer 1

2

I thought that by using web3.Eth.GetBalance API I would already be using the https://api.myetherapi.com/eth endpoint instead of the root https://api.myetherapi.com, but I was wrong, I had to use the former URL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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