These are chat archives for Nethereum/Nethereum
return await web3.Personal.UnlockAccount.SendRequestAsync(MyAddress, MyPrivateKey, 900, Guid.NewGuid());
Response status code does not indicate success: 405 (Method Not Allowed). Error occurred when trying to send rpc requests(s)
Ah. So Infura doesn't allow that rpc call (which makes sense, as unlocking it on that node means everyone else have access to your private keys too).
Try to create a web3 object using your private keys/JSON files instead.
var ecKey = new EthECKey(MyPrivateKey); var account = new Account(ecKey); web3 = new Web3(account, Configuration.Kovan.APIEndpoint); return await web3.Personal.UnlockAccount.SendRequestAsync(MyAddress, MyPrivateKey, 900, Guid.NewGuid());
As far as I know ManagedAccount would only work on local nodes (or your own node), since it relies on the node to have the accounts stored by the client and being able to unlock it via a password.
If you could bear with me with my VB code, would be something like:
Dim privateKey As New Nethereum.Signer.EthECKey("<privatekey>") Dim account = New Nethereum.Web3.Accounts.Account(privateKey) Dim iweb3 = New Web3(account, "https://ropsten.infura.io")
Dim gas As HexBigInteger = Await iweb3.Eth.DeployContract.EstimateGasAsync(abi, bytecode, account.Address, Nothing) Dim receiptHash = Await iweb3.Eth.DeployContract.SendRequestAndWaitForReceiptAsync(abi, bytecode, account.Address, gas, value)