1

I am using the geth javascript console, trying to split pre-fork ETH using the ReplaySafeSplit v2 contract 0xaBbb6bEbFA05aA13e908EaA492Bd7a8343760477 (code here).

I am doing this as follows:

splitteraddr = "0xaBbb6bEbFA05aA13e908EaA492Bd7a8343760477"
abi = [{"constant":false,"inputs":[{"name":"targetFork","type":"address"},{"name":"targetNoFork","type":"address"}],"name":"split","outputs":[{"name":"","type":"bool"}],"type":"function"}]
splitter = eth.contract(abi).at(splitteraddr)

preforkaddr = eth.accounts[0]
newethaddr = eth.accounts[1]
etcaddr = <a classic ether wallet address>

personal.unlockAccount(preforkaddr)
splitter.split.sendTransaction(newethaddr, etcaddr, {from: preforkaddr, value: web3.toWei(0.01, 'ether'), gas: 100000, gasPrice: web3.toWei(100, 'gwei')})

However, this results in: Error: Cannot send value to non-payable function.

From what I understand so far, since v0.4.0 of solidity, functions need to be explicitly modified using payable (stated here). The ReplaySafeSplit contract appears to have been compiled using v0.3.5 and the split function does not include this modifier.

Does this prevent my transaction from taking place through some mechanism built into geth? I can see by looking at the contract's transaction history that regular transactions are taking place so the contract is clearly usable.

Is there a workaround in geth? Am I getting something wrong somewhere?

1

Since the deploy of EIP 155, the replay protection is no longer needed.

But if you really need it you can modify the contract ABI adding "payable":true before "type":"function". I didn't test this myself so you should try with a small amount first.

  • Thanks. I had eventually concluded that protection is no longer needed after coming across EIP155. There are still plenty of transactions running through it though. I also wondered about using a modified ABI (although didn't try it). But I wondered whether deviating from the "official" ABI would (a) work at all, or (b) lead to unexpected problems? – nick101 Jun 24 '17 at 20:27

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.