I wonder if there is an equivalent to bitcoind's getrawtransaction, i.e., a command to dump a raw transaction in hex format, given its hash id.

I am working preferably in geth.

5 Answers 5


There is eth.getRawTransaction(<txhash>) now.

Edit: Please check that you're using an up-to-date version of geth. It's part of the current release (v.1.8.6) and was introduced some time ago. You can also see it in the source code: https://github.com/ethereum/go-ethereum/blob/ca64a122d33008c155c35a9d0e78cfbcafb1820a/internal/web3ext/web3ext.go (look for getRawTransaction)
https://github.com/ethereum/go-ethereum/blob/ec8ee611caefb5c5ad5d796178e94c1919260df4/internal/ethapi/api.go (look for GetRawTransactionByHash)

input: transaction hash
output: bytes of the corresponding transaction

  • Can you please improve & expand this answer by providing links to documentation and the call/response?
    – tayvano
    Jun 12, 2017 at 22:19
  • Is this real? It seems that this call does not exist
    – blues
    Jan 10, 2018 at 11:40
  • 1
    There isn't eth.getRawTransaction(). What are you talking about?
    – rustyx
    Apr 24, 2018 at 15:11
  • 1
    I am probing a Geth client version 1.8.15 and this method does not seem to exist. This call returns 405 Method Not Allowed: curl -i -X POST --data '{"jsonrpc":"2.0","method":"eth_getRawTransaction","params":["0x14f00d6f024a1d19d1d93948627020c5b75fc6b2a9fabb256dd2320953834d96"],"id":1}' <client_url> The same happens if the method is eth_getRawTransactionByHash. Oct 14, 2018 at 12:42

There is an "undocumented" method eth_getRawTransactionByHash from JSON-RPC

curl -H "Content-Type: application/json" -X POST --data \
'{"jsonrpc":"2.0","method":"eth_getRawTransactionByHash","params":["<TX_HASH>"],"id":1}' http://localhost:8545

<TX_HASH> - transaction id

  • If I call this, I get 405 Method Not Allowed. This method does not seem to exist on version 1.8.15. Oct 14, 2018 at 12:46
  • But it does work in Geth v1.9.11 Jan 28, 2020 at 17:14

Have a look at getTransactionByHash() of the JSON-RPC API.


Returns the information about a transaction requested by transaction hash.


DATA, 32 Bytes - hash of a transaction
params: [

Object - A transaction object, or null when no transaction was found:

hash: DATA, 32 Bytes - hash of the transaction.
nonce: QUANTITY - the number of transactions made by the sender prior to this one.
blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending.
blockNumber: QUANTITY - block number where this transaction was in. null when its pending.
transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending.
from: DATA, 20 Bytes - address of the sender.
to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.
value: QUANTITY - value transferred in Wei.
gasPrice: QUANTITY - gas price provided by the sender in Wei.
gas: QUANTITY - gas provided by the sender.
input: DATA - the data send along with the transact
  • 3
    That returns a json description, not the raw transaction
    – oriol
    Jul 26, 2016 at 16:06
  • It is possible to construct the raw transaction from the data returned from the getTransactionByHash() RPC call. Oct 14, 2018 at 12:39

You can also find the raw transaction hex on etherscan.io by going to a transaction, picking Tools & Utilities and choosing Get Raw TxHash. See for example:


If you want to do this programatically with geth, I present a solution for that here: Can I get the raw transaction using Nethereum?


You can do it this way in Python:

import web3
from eth_account._utils.legacy_transactions import (

w3 = web3.Web3(web3.HTTPProvider("https://eth-mainnet.alchemyapi.io/v2/XXXXXXXXXXXXXXXXXXXXXXXXXXX"))
tx = w3.eth.getTransaction(hash)

def recover_raw_transaction(tx):
    """Recover raw transaction for replay.

    Inspired by: https://github.com/ethereum/eth-account/blob/1d26f44f6075d6f283aeaeff879f4508c9a228dc/eth_account/_utils/signing.py#L28-L42
    transaction = {
        "chainId": tx["chainId"],
        "nonce": int(tx["nonce"], 16),
        "maxPriorityFeePerGas": int(tx["maxPriorityFeePerGas"], 16),
        "maxFeePerGas": int(tx["maxFeePerGas"], 16),
        "gas": int(tx["gas"], 16),
        "to": Web3.toChecksumAddress(tx["to"].lower()),
        "value": int(tx["value"], 16),
        "accessList": tx["accessList"],
    if "data" in tx:
        transaction["data"] = tx["data"]
    if "input" in tx:
        transaction["data"] = tx["input"]
    v = int(tx["v"], 16)
    r = int(tx["r"], 16)
    s = int(tx["s"], 16)
    unsigned_transaction = serializable_unsigned_transaction_from_dict(transaction)
    return "0x" + encode_transaction(unsigned_transaction, vrs=(v, r, s)).hex()

raw_tx = recover_raw_transaction(tx)

If some basic fields like access_list are missing when you retried the tx by hash, add them manually.

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.