Caveat: I tried to provide links to my transactions and addresses in etherscan.io, but I "need at least 10 reputation to post more than 2 links."
I have an account that I want to sweep. I want to sweep the ETH to a funds splitting contract (ETC/ETH). I'm only interested in sweeping the ETH balance and my goal is for the account to end up with a balance of zero (e.g. no dust).
This is the fund splitting contract I'm trying to use: 0x1e143b2588705dfea63a17f2032ca123df995ce0
It seems as if the gas required for this operation is 29,717. For example, here is a sample transaction I sent to the contract, which according to etherscan.io required that amount of gas: 0x7cd52325c0945d0de975a6713abdc50659c0c62ef523a1a99f2ad2a2d4128a8f
However, if I send a transaction and limit the amount of gas to 29,717, my transaction fails. For example, here is a sample transaction I sent to the contract with a gas limit of 29,717, which failed due to lack of gas: 0xcd31481b4dd9410daa22c8a47f9a4b29ef4a305877174eb346433bb4e6b03089
(TX)
I discovered the minimum amount of gas that I need to specify for one of these transfers to work is 31,991:
- Transaction with 31,991 gas which worked:
0x7cd52325c0945d0de975a6713abdc50659c0c62ef523a1a99f2ad2a2d4128a8f
(TX) - Transaction with 31,990 gas which failed:
0x8c92fde3cf07b3cdbf4dcc54ed6ccfb072f22933ab556612f3d23317a2466280
(TX)
However, when the tx goes through, it seems as if it only used 29,717 gas. For example:
Account 0x19d90f1106c600bd8a70b5775776b4ecdc7a945b
(address) had a balance of 0.01282711 ETH
(at block 1964300
).
I sent transaction 0xb57c8b5aede3070e2fb80ea9a21ec43293cb5c7392ccb36357388422e9055509
(TX) with the following details:
- Value:
0.01218729 ETH
- Gas:
31991
- Gas Price:
20000000000 Wei
So:
- Balance before TX:
0.01282711 ETH
- Amount to send:
0.01218729 ETH
- Supposed cost of TX:
Gas
*Price
=0.00063982 ETH
- Balance - Amount to send - Supposed cost of TX = ZERO!
However, as you can see, account 0x19d90f1106c600bd8a70b5775776b4ecdc7a945b
(address) has a balance of 0.00004548 ETH
.
This in turn means that the actual cost of the TX was 0.00059434 ETH
: Actual Cost of TX = Balance before TX - Amount sent - Actual End Balance = 0.01282711 - 0.01218729 - 0.00004548 = 0.00059434.
At a gas price of 20000000000 Wei
, this means the amount of gas used was: 29717
(0.00059434/0.00000002 = 29717)
So the question are:
- Why are the transactions which specify a gas limit of
29717
failing? - How do I sweep the funds so the ending balance of an ETH account is zero when using the contract above?
System information
Geth version: 1.4.10-stable-c2eea630 OS & Version: Linux
Expected behaviour
Transaction 0x19d90f1106c600bd8a70b5775776b4ecdc7a945b should've been successful.
Actual behaviour
Transaction 0x19d90f1106c600bd8a70b5775776b4ecdc7a945b failed due to lack of gas.
Steps to reproduce the behaviour
Use the transfer(address)
function of contract 0x1e143b2588705dfea63a17f2032ca123df995ce0
by sending some amount and limit the amount of gas to 29717
Here is a sample transaction to this contract you can send via the JSON-RPC API:
'{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0xe7c7d161800ebb5112d7d892510e9f1dafc4010c","to":"0x1e143b2588705dfea63a17f2032ca123df995ce0","value":"0x1F99A58657EED0","data":"0x1a69523000000000000000000000000029d5527caa78f1946a409fa6acaf14a0a4a0274b"}],"id":6}'