I am using the nethereum package in .Net and trying to invoke a smart contract with web3. Initially it was working fine, but suddenly I am getting an error while trying to get the transaction count. This is the code I am using:

var web3 = new Web3("https://rinkeby.infura.io/");

//getting the error from below line.
var txCount = await web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(DefaultAccount, Nethereum.RPC.Eth.DTOs.BlockParameter.CreatePending());

Error message:

Error occurred when trying to send rpc requests(s)
Inner exception: The underlying connection was closed: An unexpected error occurred on a send.

Can anyone help me?


Shouldn't you add the api-key also to the url? Like https://rinkeby.infura.io/YOUR-API-KEY ?

See also https://www.infura.io/docs/gettingStarted/makeRequests

| improve this answer | |

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.