📦 eth_getRawTransactionByBlockHashAndIndex - Base Chain JSON-RPC Method
📝 Overview
The eth_getRawTransactionByBlockHashAndIndex
method retrieves the raw, RLP-encoded transaction data from a specific position within a block on the Base blockchain. This method is valuable for applications that need to access or verify the exact transaction bytes as they exist on-chain.
💡 Raw transactions contain the complete transaction data in its serialized format, including signatures, allowing for transaction verification, offline analysis, and advanced blockchain tooling.
⚙️ Parameters
Parameter | Type | Description |
---|---|---|
blockHash | String | The 32-byte hash of the block containing the transaction |
transactionIndex | String | The position of the transaction in the block (hex-encoded index) |
🔄 Returns
Raw Transaction Data - Hex-encoded string containing the complete RLP-serialized transaction bytes
🌐 Request
POST https://base-mainnet.chainnodes.org/YOUR-API-KEY
Need RPC API keys?
Get 12.5M archival requests for free today.
🧪 Example
- HTTPS POST Request with a JSON RPC call in the body
- Replace YOUR-API-KEY with the API key from your Chainnodes.org Dashboard
- You can use a different supported network by replacing
base-mainnet
curl https://base-mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getRawTransactionByBlockHashAndIndex","params":["0x54751c3cb4f7c95b249ab5ed702a708a6782cc937b1d399f25be4b40d9e0f5d4","0x0"],"id":1}'
💡 Confusing?
Ask our experienced blockchain developers in Telegram
📊 Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x02f902e70101847735940085215b6afe008301fd7a94c02aaa39b223fe8d0a0e5c4f27ead9083c756cc280b902843593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000642f1f1f00000000000000000000000000000000000000000000000000000000000000020b080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c080a03b4afab91edec37c0cfe9e68f2d65c4c7e9ab23d3453eaa456bdb41e5d22548fa0217ad72b41a611526a45aae9392affba8114c0bd4c25e8ef7f05cda45ef5cee0"
}
🚀 Use Cases
1️⃣ Transaction Verification & Replay
Verify transaction data independently without trusting an RPC provider, or replay transactions in development environments.
// Get raw tx data for cryptographic verification
{"jsonrpc":"2.0","method":"eth_getRawTransactionByBlockHashAndIndex","params":["0x54751c3cb4f7c95b249ab5ed702a708a6782cc937b1d399f25be4b40d9e0f5d4","0x0"],"id":1}
2️⃣ Blockchain Analysis & Forensics
Examine the exact transaction data for security analysis, debugging, or blockchain forensics purposes.
// Examine a suspicious transaction's raw bytes
{"jsonrpc":"2.0","method":"eth_getRawTransactionByBlockHashAndIndex","params":["0xSuspiciousBlockHash","0x5"],"id":1}
3️⃣ Custom Transaction Processing
Build custom transaction processors or indexers that work directly with raw transaction data.
// Process all transactions in a block
// First, get block, then iterate through indexes
{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0xBlockHash", false],"id":1}
// Then for each tx index:
{"jsonrpc":"2.0","method":"eth_getRawTransactionByBlockHashAndIndex","params":["0xBlockHash","0xIndex"],"id":1}
4️⃣ Base-Specific Transaction Analysis
Analyze Base chain-specific transaction fields and encoding formats.
// Get raw transaction for L2 rollup analysis
{"jsonrpc":"2.0","method":"eth_getRawTransactionByBlockHashAndIndex","params":["0xBaseRollupBlockHash","0x0"],"id":1}
5️⃣ Historical Data Archiving
Store raw transaction data for archival or compliance purposes with guaranteed byte-for-byte accuracy.
// Archive a specific transaction's exact binary representation
{"jsonrpc":"2.0","method":"eth_getRawTransactionByBlockHashAndIndex","params":["0xBlockWithImportantTx","0xTxIndex"],"id":1}
🔗 Related Methods
- eth_getRawTransactionByHash - Get raw transaction by transaction hash
- eth_getRawTransactionByBlockNumberAndIndex - Get raw transaction by block number and index
- eth_getTransactionByBlockHashAndIndex - Get decoded transaction by block hash and index
📚 Learn More
🔐 What are raw transactions? Raw transactions are the complete binary representation of transaction data as stored on the blockchain. They contain all transaction fields in RLP-encoded format, including signatures that prove the transaction's authenticity.
🧩 RLP Encoding: Recursive Length Prefix (RLP) is the serialization method used by Ethereum and Base to encode transaction data efficiently for on-chain storage. The raw transaction returned by this method gives you the exact RLP-encoded bytes.
🛠️ Developer Value: Working with raw transactions enables advanced use cases like custom signature verification, transaction decoding, and cross-chain transaction analysis without relying on higher-level APIs.