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

getrawtransaction - Litecoin

Example code for the getrawtransaction JSON-RPC method. Complete guide on how to use getrawtransaction JSON-RPC in GetBlock Web3 documentation.

Returns the raw transaction data.

Parameters

Parameter
Type
Description

txid

string

The transaction id.

verbose

boolean

Optional. True for JSON object. Default=false.

Request examples

cURL
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getrawtransaction",
    "params": ["txid123...", true],
    "id": "getblock.io"
}'
axios.js
import axios from 'axios';

const data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "getrawtransaction",
    "params": ["txid123...", true],
    "id": "getblock.io"
});

const config = {
    method: 'post',
    url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data)))
    .catch(error => console.log(error));

Response

response.json
{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "txid": "txid123...",
        "hash": "txid123...",
        "version": 2,
        "size": 225,
        "vsize": 144,
        "weight": 573,
        "locktime": 0,
        "vin": [],
        "vout": [],
        "hex": "0200000001..."
    }
}

Response Parameters

Field
Type
Description

txid

string

The transaction id.

size

number

The transaction size in bytes.

vin

array

Array of input objects.

vout

array

Array of output objects.

Use Case

The getrawtransaction method is essential for:

  • Transaction inspection

  • Block explorer functionality

  • Transaction verification

  • Debugging transactions

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN.

Integration Notes

The getrawtransaction method helps developers build robust applications that interact with the Litecoin blockchain.

Last updated

Was this helpful?