1

Sample code below (simplified for illustrative purposes only):

var a = new ManagedAccount(mOwner, mOwnerPwd);
var w = new Web3(a, mNodeUrl);
w.TransactionManager.DefaultGas = mGasLimit;
w.TransactionManager.DefaultGasPrice = mGasPrice;
Contract c = w.Eth.GetContract(mVAbi, mVAdd);

var r = c.GetFunction("issueCoin").
    SendTransactionAsync(mOwner, To, Value).Result;

Thread.Sleep(10000);

var rcpt = w.TransactionManager.TransactionReceiptService.PollForReceiptAsync(r).Result;

No matter how long I sleep, the rcpt.Status is always NULL, even when I deliberately let the transaction runs out of gas and failed, the rcpt.Status is still NULL.

My question now is, how can I check and ensure a transaction is successful?

  • Have you tried using filters? I'm sorry I don't have experience with nethereum, but seems like that's what you need and then get the filter logs or listen to changes. – DaveIdito Jun 19 '18 at 3:28
  • Daveldito, the Transfer event only tells the From, To and Value but didn't have status to indicates the transaction is successful. Can I assume as long as I received the Transfer event means that my transaction had already succeed? – s k Jun 19 '18 at 7:08
  • @s k the event log includes the transaction hash in which the event was logged, then using the transaction hash you can find the transaction receipt and read the status. – DaveIdito Jun 19 '18 at 7:19
  • Based on this answer ethereum.stackexchange.com/questions/4085/… , yes that means the transaction was successful. But I hope you do realize there's a difference between event and transaction receipt. – DaveIdito Jun 19 '18 at 7:22

Your Answer

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

Browse other questions tagged or ask your own question.