Skip to main content

starknet_getTransactionByBlockIdAndIndex

Get the details of a transaction by a given block id and index

Get the details of the transaction given by the identified block and index in that block. If no transaction is found, null is returned.

Parameters#

ParameterTypeDescription
block_idstringBlock reference ("latest", "l1_accepted", block hash, or block number)
indexintegerTransaction index in the block

Request#

{
"jsonrpc": "2.0",
"method": "starknet_getTransactionByBlockIdAndIndex",
"params": [
{
"block_hash": "0x05abbad1e5"
},
1
],
"id": 1
}

Returns#

Transaction details at the specified index

Errors#

CodeMessage
24Block not found
27Invalid transaction index in a block

Examples#

curl -X POST https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "starknet_getTransactionByBlockIdAndIndex",
"params": [
{
"block_hash": "0x05abbad1e5"
},
1
],
"id": 1
}'