Pair CometBFT block transactions with their execution results
A block contains transaction bytes while the corresponding application result is available separately. The position inside the same block ties them together.
Fetch both responses for one height
Replace 12000 with a retained height and set RPC to the CometBFT HTTP endpoint. Compare block.data.txs with txs_results and check that both responses identify the expected height.
curl -fsS "$RPC/block?height=12000"
curl -fsS "$RPC/block_results?height=12000"
When a block contains three transactions, result index 1 belongs to transaction index 1, the second entry. Record code, gas_used and events with that transaction. Code zero denotes successful application execution.
Keep block-level events separate
Finalize-block events can represent work performed outside an individual transaction. Avoid attaching every such event to the last transaction. If results are unavailable for a retained block, check local response-retention settings before assuming all its transactions succeeded. github.com CometBFT RPC