1

My transaction ran out of gas. When this occurs, the contract returns the sent ether to the senders wallet, right? It doesn't show yet in my wallet and it happened yesterday, 16 hours ago. The support of the exchange is not reacting.

  • Can someone kindly advice me what to do?
  • How can I prevent such happening in the future?

Thanks a lot.

1
  • 1
    When your transaction runs out of gas you are right, any transferred ethers (or any state change in general) is reverted immediately. You only lose the amount of gas that was used. If you are still not seeing the sent funds in your wallet something else is going wrong. Can you provide the transactionID? Nov 4 '17 at 9:46
2

Can someone kindly advice me what to do?

When a transaction fails, all the changes done to the state are reverted and the ethers if supplied are sent back to the sender (but the gas supplied is not consumed).

Now if your transaction has failed and balance is not updated. This may be possible that your exchange has some technical glitch. They may not have handles cases of the failed transaction.

If the exchange has given you the private keys (which generally they don't), you can withdraw your balance from any other platform like MEW.

Else you could check the balance your account holds currently ahs shoot an email to the exchange support with all the details and wait for their response.

How can I prevent such happening in the future?

You should probably estimate gas before sending a transaction. That's easy if you are a programmer. You need web3.js for this. I am adding a code snippet for estimating gas for a contract function.

var contractAbi = eth.contract(AbiOfContract);
var myContract = contractAbi.at(contractAddress);
// suppose you want to call a function named myFunction of myContract
var getData = myContract.myFunction.getData(function parameters);
var estimatedGas = web3.eth.estimateGas({to:Contractaddress, from:Accountaddress, data: getData});

Note: You could supply gas a bit higher than that estimated by estimateGas method because the excess amount of gas is refunded.

You can have a look at this stack question for refrence.

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.