For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_getTransactionByHash - Polygon

Example code for the eth_getTransactionByHash json-rpc method. Сomplete guide on how to use eth_getTransactionByHash json-rpc in GetBlock.io Web3 documentation.

The eth_getTransactionByHash method returns the information about a transaction requested by transaction hash. This is one of the most commonly used methods for checking transaction details.

Parameters

Parameter
Type
Required
Description

transactionHash

string

Yes

32-byte transaction hash

Request

cURL
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionByHash",
    "params": ["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],
    "id": "getblock.io"
}'
request.js
import axios from 'axios';

const url = 'https://go.getblock.io/<ACCESS-TOKEN>/';

const payload = {
    jsonrpc: '2.0',
    method: 'eth_getTransactionByHash',
    params: ["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],
    id: 'getblock.io'
};

axios.post(url, payload, {
    headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));

Response

Response (JSON)
{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "hash": "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
        "blockHash": "0x...",
        "blockNumber": "0x...",
        "from": "0x...",
        "to": "0x...",
        "value": "0x...",
        "gas": "0x...",
        "gasPrice": "0x..."
    }
}

Response Parameters

Field
Type
Description

jsonrpc

string

JSON-RPC version (2.0)

id

string

Request identifier

result

varies

Transaction object or null if pending or not found

Use Case

The eth_getTransactionByHash method is useful for:

  • Transaction verification

  • Payment confirmation

  • Transaction tracking

  • Debugging

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN

-32600

Invalid Request

Malformed request body

-32602

Invalid params

Invalid method parameters

Web3 Integration

Last updated

Was this helpful?