2

Can you decode this transaction:

Etherscan tx:

0x02f8740181f1843b9aca00851535cf027f82520894e0e5d2b4edcc473b988b44b4d13c3972cb6694cb8801ea8d467f558e1e80c001a07eb3335f4fd4de25ec3452c08882f28fb098b2eaa37a332941f918d869f5c2ada059b9d4aa997c7fa34f1b167f98a12432bb1a4a35660d723a9c19bb76b4cd025d

What I need is the decoding formula for the new eth raw transactions

2
  • Maybe add some context. Where did it come from. Is there are URL or a etherscan tx you can point to....
    – j2abro
    Apr 22, 2022 at 20:05
  • It's a signed tx
    – Ini
    Nov 27 at 1:49

2 Answers 2

3

You can decode your transaction here: https://rawtxdecode.in/. Here is the decoded response for your raw tx:

{
  "chainId": "1",
  "type": "EIP-1559",
  "valid": true,
  "hash": "0x0a7d81c47b5a298e190315eb465f73124deb68faa9fa4e5ed372911fc0051dc9",
  "nonce": "241",
  "gasLimit": "21000",
  "maxFeePerGas": "91097072255",
  "maxPriorityFeePerGas": "1000000000",
  "from": "0x5B588e36FF358D4376A76FB163fd69Da02A2A9a5",
  "to": "0xe0e5d2b4edcc473b988b44b4d13c3972cb6694cb",
  "publicKey": "0x04340f792af13fb8ebfe147c9c6c9d0b515a636501069df3b98dec3477dbcc8eb06c06ac1d5ee2895410d8641285b2365b6ed89016fd870ce74e8f6f65240932c2",
  "value": "138078072511761950",
  "v": "01",
  "r": "7eb3335f4fd4de25ec3452c08882f28fb098b2eaa37a332941f918d869f5c2ad",
  "s": "59b9d4aa997c7fa34f1b167f98a12432bb1a4a35660d723a9c19bb76b4cd025d"
}
1
  • How would you do the same via ethers or web3 or some other lib without relying on a website?
    – Ini
    Nov 27 at 1:49
0

It is not an exact answer of the question. But it helps to prepare the ethereum transaction data EIP-1559.

We can check the hex using the broadcast transaction link provided by etherescan. It returns TxID if the raw data is valid. Otherwise shows error.

for goerlie testnet : https://goerli.etherscan.io/pushTx

Steps to prepare a EIP-1559 transaction using web3j

1.RawTransaction.createTransaction(chainId, nonce, gasLimit, to, value, data, maxPriorityFeePerGas, maxFeePerGas)
2. TransactionEncoder.encode(rawTransaction) // from sept1
3. Hash.sha3(encodedTx) // from step2
4. Sign the hash using private key 
5. Convert the sign to Sign.SignatureData

Then Prepare the raw transaction

public String prepareRawTransactionWithSignature(RawTransaction transaction, Sign.SignatureData signatureData) {

    // encode signature data
 List<RlpType> values = transaction.getTransaction().asRlpValues(signatureData);
 RlpList rlpList = new RlpList(values);
 byte[] encoded = RlpEncoder.encode(rlpList);
 if (!transaction.getType().equals(TransactionType.LEGACY)) {
        encoded = ByteBuffer.allocate(encoded.length + 1)
                .put(transaction.getType().getRlpType())
                .put(encoded)
                .array();
 }
    String serializedTxHex = Numeric.toHexString(encoded);
 log.info("Serialized tx {}", serializedTxHex);
 return serializedTxHex;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.