Closed Pet3ris closed 4 years ago
Found the following fix (the mainnet node was returning data
as input
):
def recover_raw_transaction(tx) -> str:
"""Recover raw transaction for replay.
Inspired by: https://github.com/ethereum/eth-account/blob/1d26f44f6075d6f283aeaeff879f4508c9a228dc/eth_account/_utils/signing.py#L28-L42
"""
transaction = {
"to": tx["to"],
"gas": tx["gas"],
"gasPrice": tx["gasPrice"],
"value": tx["value"],
"nonce": tx["nonce"],
}
if "data" in tx:
transaction["data"] = tx["data"]
if "input" in tx:
transaction["data"] = tx["input"]
v = tx["v"]
r = int.from_bytes(tx["r"], "big")
s = int.from_bytes(tx["s"], "big")
unsigned_transaction = serializable_unsigned_transaction_from_dict(transaction)
return encode_transaction(unsigned_transaction, vrs=(v, r, s))
pip freeze
):What is wrong?
I'm running the following code on a recent mainnet transaction hash.
If you see this transaction on Etherscan, you will see that the sender is actually
0x14b95ed55c0825a30c5bf6d4905379e06749b117
, however, when I run this locally, it prints outb'b\xecR$c4\x98\xc1$i\x0cUt\x8f\xe4\x88\xa01\xa95'
, which is0x62ec5224633498c124690c55748fe488a031a935
.There is one custom function I'm using here, which is
recover_raw_transaction
, I've adapted the implementation frometh_accounts
and tested it using the following test. All this function does is recovers the signed raw transaction hash using transaction information from mainnet.Here is the full MuirGlacierTransaction - I've checked that the
to
address and other arguments match this mainnet transaction well, but sender simply doesn't.How can it be fixed
The problem is likely with the
.sender
extraction? Am I using the wrong transaction class for this block?