debug_getRawHeader
https://api.triport.io/v1/ethReturns the RLP-encoded bytes of a block header, as a single hex string.
debug_getRawHeader returns the consensus-layer RLP encoding of a single block
header as a 0x-prefixed hex string. This is the exact byte sequence that is
hashed to produce the block hash, so it is the canonical input for verifying a
header or re-deriving its hash off-chain.
Use it when you need the raw header bytes rather than the decoded JSON object
that eth_getBlockByNumber / eth_getBlockByHash return — for example to feed
a light-client verifier, to recompute and check a block hash, or to relay a
header to another system that expects RLP.
This is a pro-tier method in the eth_debug category. It is rate-limited to
5 requests per second on the pro tier and 15 requests per second on the
business tier, with burst.
Parameters
The method takes a single positional parameter: the block to encode.
blockstringrequired"0x10d4f"), a 32-byte block hash, or a tag ("latest", "earliest", "pending", "safe", "finalized").Response
Response fields
| Field | Type | Description |
|---|---|---|
result | string | The RLP-encoded block header as a 0x-prefixed hex string. |
Errors
| Code | Meaning | When it happens |
|---|---|---|
| -32002 | tier_insufficient | Your plan is below the pro tier required for eth_debug methods. |
| -32003 | rate_limited | You exceeded the per-second limit for your tier (5 rps pro / 15 rps business). |
See the shared errors page for the full error envelope and retry guidance.
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io/v1/eth", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "debug_getRawHeader",
params: ["latest"],
}),
});
const { result } = await res.json();
console.log(result); // "0xf90222..."TypeScript SDK (@triport/sdk)
import { Triport } from "@triport/sdk";
const triport = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });
const rawHeader = await triport.eth.request("debug_getRawHeader", ["latest"]);
console.log(rawHeader);Python (triport-sdk)
import os
from triport import Triport
triport = Triport(api_key=os.environ["TRIPORT_API_KEY"])
raw_header = triport.eth.request("debug_getRawHeader", ["latest"])
print(raw_header)Notes
- The
blockargument accepts the same forms as the standard block selectors: a hex block number, a 32-byte block hash, or a tag such as"latest"or"finalized". - The Keccak-256 hash of the returned bytes equals the block hash, which lets you verify a header without trusting the decoded JSON fields.
- For the decoded, human-readable header and its transactions, use
eth_getBlockByNumberoreth_getBlockByHashinstead. To fetch the raw RLP of a full block (header plus body), see the companioneth_debugmethods.