5

I have looked to split and sell my etc and have successfully split with test transactions replaying on classic, however the main transaction has not replayed for 24 hours and I would like to force a replay. I have both blockchains available.

I have tried taking the output of web3.eth.getTransaction(hash) on ETH and tried recreating it with ethereumjs-tx signed and unsigned on classic without much success.

I haven't seen a method to get the raw hex of a transaction in geth to inject it via web3.eth.sendRawTransaction

My alternative is to perform the same transaction I did on ETH but on ETC

  • 3
    Why don't you just send the same transaction on the other chain? That seems far simpler than trying to replay – Tjaden Hess Oct 22 '16 at 3:48
1

Lets say we have this tx: https://etherscan.io/tx/0x1f3f3ced1fde1cbc638b3e1ba2b12d890157977208442e8686d03fc4d332225c

  1. Take same input raw data and resubmit it without changing chaindId: Lets take Raw tx data:

https://etherscan.io/getRawTx?tx=0x1f3f3ced1fde1cbc638b3e1ba2b12d890157977208442e8686d03fc4d332225c

So we get:

0xf8708352d1d685028fa6ae0083015f909465f4dc1a4aef2842c1ae61dfa3db7a69f25b7aff8802e45e9ccc5e1af28026a0ba87b88da31453501f9738e35d6c4f416524f92ea215d6f07b3df5f4216a41f8a0578c288d369a6f9ee073e25e745888f9099e54b604411bce1b456a6dcf3937af

now lets try sending it to POA.network chain cURL:

curl --data '{"method":"eth_sendRawTransaction","params":["0xf8708352d1d685028fa6ae0083015f909465f4dc1a4aef2842c1ae61dfa3db7a69f25b7aff8802e45e9ccc5e1af28026a0ba87b88da31453501f9738e35d6c4f416524f92ea215d6f07b3df5f4216a41f8a0578c288d369a6f9ee073e25e745888f9099e54b604411bce1b456a6dcf3937af"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST https://poa.infura.io

Response: {"jsonrpc":"2.0","error":{"code":-32010,"message":"Invalid chain id."},"id":1} It's because POA.network chain is protected with EIP-155 and doesn't allow us to send it.

So, lets take same tx and change chainId value to resubmit tx. which if we ask rpc server getTransactionByHash

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x1f3f3ced1fde1cbc638b3e1ba2b12d890157977208442e8686d03fc4d332225c"],"id":1}' -H "Content-Type: application/json" -X POST https://mainnet.infura.io | jq '.'

-

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0x35af3597e1496acef6eb972c68243709ffc214c4b4a6f160581c4e670f67dd94",
    "blockNumber": "0x5ab068",
    "from": "0x829bd824b016326a401d083b33d092293333a830",
    "gas": "0x15f90",
    "gasPrice": "0x28fa6ae00",
    "hash": "0x1f3f3ced1fde1cbc638b3e1ba2b12d890157977208442e8686d03fc4d332225c",
    "input": "0x",
    "nonce": "0x52d1d6",
    "to": "0x65f4dc1a4aef2842c1ae61dfa3db7a69f25b7aff",
    "transactionIndex": "0x52",
    "value": "0x2e45e9ccc5e1af2",
    "v": "0x26",
    "r": "0xba87b88da31453501f9738e35d6c4f416524f92ea215d6f07b3df5f4216a41f8",
    "s": "0x578c288d369a6f9ee073e25e745888f9099e54b604411bce1b456a6dcf3937af"
  }
}

Now, lets re-send same tx onto ETC chain with ethereumjs-tx: POA.network has chainId = 99

const EthereumTx = require('ethereumjs-tx')
const chain = 99;

const txParams = {
  nonce: '0x52d1d6',
  gasPrice: '0x28fa6ae00',
  gasLimit: '0x15f90',
  to: '0x65f4dc1a4aef2842c1ae61dfa3db7a69f25b7aff',
  value: '0x2e45e9ccc5e1af2',
  data: '0x',
  chainId: chain,
  r: "0xba87b88da31453501f9738e35d6c4f416524f92ea215d6f07b3df5f4216a41f8",
  s: "0x578c288d369a6f9ee073e25e745888f9099e54b604411bce1b456a6dcf3937af",
  v: chain * 2 + 35
}


const tx = new EthereumTx(txParams)

const serializedTx = tx.serialize()
console.log('0x' + serializedTx.toString('hex'))

Please notice how we re-calculated v value: v: chain * 2 + 35 OR you can do: v: chain * 2 + 36 (reference: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md)

Now lets run it: node txGenerator.js and we get

0xf8718352d1d685028fa6ae0083015f909465f4dc1a4aef2842c1ae61dfa3db7a69f25b7aff8802e45e9ccc5e1af28081e9a0ba87b88da31453501f9738e35d6c4f416524f92ea215d6f07b3df5f4216a41f8a0578c288d369a6f9ee073e25e745888f9099e54b604411bce1b456a6dcf3937af

so lets send it to rpc node

curl --data '{"method":"eth_sendRawTransaction","params":["0xf8718352d1d685028fa6ae0083015f909465f4dc1a4aef2842c1ae61dfa3db7a69f25b7aff8802e45e9ccc5e1af28081e9a0ba87b88da31453501f9738e35d6c4f416524f92ea215d6f07b3df5f4216a41f8a0578c288d369a6f9ee073e25e745888f9099e54b604411bce1b456a6dcf3937af"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST https://poa.infura.io

response: {"jsonrpc":"2.0","error":{"code":-32010,"message":"Insufficient funds. The account you tried to send transaction from does not have enough funds. Required 209385510302513906 and got: 0."},"id":1}

So we have successfully changed V value, but the account doesn't have funds to make a tx

Similar way you can use for any other CHAIN-IDs

| improve this answer | |

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.