I'm trying to replay transactions that exist in one chain on another.
I can replicate all transaction arguments that are available through eth_getTransactionByHash
, but now need to sign the transaction. How do I extract the signing information from the committed transaction so that I'm able to resubmit with eth_sendRawTransaction
.
Also welcome responses in web3.py
, web3.js
, ethers.js
or any other preferred json-rpc SDK.
Existing code using web3.py
that doesn't work:
tx = fallback_web3.eth.getTransaction(individual_tx_hash)
transaction = {
"from": tx["from"],
"to": tx["to"],
"gas": tx["gas"],
"gasPrice": tx["gasPrice"],
"value": tx["value"],
"nonce": tx["nonce"],
}
if "data" in tx:
transaction["data"] = tx["data"]
w3.eth.sendTransaction(transaction)
eth_sendRawTransaction
doesn't require you to pass thefrom
value, as it is already embedded in the raw transaction itself (which you need to pass to this function).