eth_getTransactionByHash
Returns information about a transaction for a given hash.
Parameters
transaction hash
: [Required] A string representing the hash (32 bytes) of a transaction.
Returns
A transaction object, or null when no transaction was found. The transaction object will consist of the following keys and their values:
accessList
: [optional] A list of addresses and storage keys accessed by the transaction. See access list transactions.blockHash
: 32 bytes. A hash of the block including this transaction.null
when it's pending.blockNumber
: The number of the block including this transaction.null
when it's pending.chainID
: [optional] chain ID specifying the network. Returned only for EIP-1559 transactions.from
: 20 bytes. The address of the sender.gas
: Gas provided by the sender.gasPrice
: Gas price provided by the sender in wei.hash
: 32 bytes. The hash of the transaction.input
: The data sent along with the transaction.maxPriorityFeePerGas
: [optional] Maximum fee, in wei, the sender is willing to pay per gas above the base fee. See EIP-1559 transactions.maxFeePerGas
: [optional] Maximum total fee (base fee + priority fee), in wei, the sender is willing to pay per gas. See EIP-1559 transactions.nonce
: The number of transactions made by the sender prior to this one.r
: 32 bytes. The ECDSA signaturer
.s
: 32 bytes. The ECDSA signatures
.to
: 20 bytes. The address of the receiver.null
when it's a contract creation transaction.transactionIndex
: The transaction's index position in the block, in hexadecimal.null
when it's pending.type
: The transaction type.v
: The ECDSA recovery ID.value
: The value transferred in wei.yParity
: [optional] Parity (0x0
for even,0x1
for odd) of the y-value of asecp256k1
signature.
Example
Replace <YOUR-API-KEY>
with an API key from your MetaMask Developer dashboard.
Request
- curl
- WSS
curl https://scroll-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getTransactionByHash", "params": ["0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0"], "id": 1}'
wscat -c wss://scroll-mainnet.infura.io/ws/v3/<YOUR-API-KEY> -x '{"jsonrpc": "2.0", "method": "eth_getTransactionByHash", "params": ["0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0"],"id": 1}'
Response
- JSON
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"accessList": [],
"blockHash": "0x0155db99111f10086bad292d3bd0be9472aff9cf0f33d7d35f2db4814ffad0f6",
"blockNumber": "0x112418d",
"chainId": "0x1",
"from": "0xe2a467bfe1e1bedcdf1343d3a45f60c50e988696",
"gas": "0x3c546",
"gasPrice": "0x20706def53",
"hash": "0xce0aadd04968e21f569167570011abc8bc17de49d4ae3aed9476de9e03facff9",
"input": "0xb6f9de9500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000e2a467bfe1e1bedcdf1343d3a45f60c50e9886960000000000000000000000000000000000000000000000000000000064e54a3b0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000de15b9919539113a1930d3eed5088cd10338abb5",
"maxFeePerGas": "0x22b05d8efd",
"maxPriorityFeePerGas": "0x1bf08eb000",
"nonce": "0x12c",
"r": "0xa07fd6c16e169f0e54b394235b3a8201101bb9d0eba9c8ae52dbdf556a363388",
"s": "0x36f5da9310b87fefbe9260c3c05ec6cbefc426f1ff3b3a41ea21b5533a787dfc",
"to": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d",
"transactionIndex": "0x0",
"type": "0x2",
"v": "0x1",
"value": "0x2c68af0bb140000",
"yParity": "0x1"
}
}