# Ethereum eth_getTransactionByHash RPC method

Ethereum API method that returns the information about a transaction from the transaction hash.

Parameters:

  • hash — the hash of a transaction.

Returns:

  • object — the transaction response object , or null if no transaction is found:
    • hash — the hash of the transaction.
    • nonce — the number of transactions made by the sender before this one, encoded as hexadecimal.
    • blockHash — the hash of the block where this transaction was in. null if pending.
    • blockNumber — the block number where this transaction was in. null if pending.
    • transactionIndex — the integer of the transactions index position in the block. null if pending.
    • from — the address of the sender.
    • to — the address of the receiver. null when it is a contract creation transaction.
    • value — the value transferred in Wei, encoded as hexadecimal.
    • gasPrice — the gas price provided by the sender in Wei, encoded as hexadecimal.
    • gas — the gas provided by the sender, encoded as hexadecimal.
    • input — the data sent along with the transaction.
    • v — the standardized V field of the signature.
    • standardV — the standardized V field of the signature (0 or 1).
    • r — the R field of the signature.
    • raw — the raw transaction data.
    • publicKey — the public key of the signer.
    • chainId — the chain ID of the transaction, if any.

Example:

  • web3.js
  • web3.py
  • eth.rb
  • cURL
const Web3 = require("web3");
const node_url = "CHAINSTACK_NODE_URL";
const web3 = new Web3(node_url);
web3.eth.getTransaction("0xf915903ecc67ab20a5162ae13eec36e3a68ca558765ada1779847e0a0c35479c", (err, tx) => {
    console.log(tx)
})