sei-chain icon indicating copy to clipboard operation
sei-chain copied to clipboard

[BUG] eth_getTransactionByBlockNumberAndIndex The specified block height and index cannot obtain transaction information

Open 0x-wen opened this issue 10 months ago • 2 comments

Seid version

Chain ID chain_id : 1329

Describe the bug Request data through an rpc interface

#!/bin/bash

RPC_URL="https://evm-rpc.sei-apis.com"
BLOCK_NUMBER=136337023
TRANSACTION_INDEX=3

BLOCK_NUMBER_HEX="0x$(printf %x $BLOCK_NUMBER)"
TRANSACTION_INDEX_HEX="0x$(printf %x $TRANSACTION_INDEX)"
echo "BLOCK_NUMBER_HEX: $BLOCK_NUMBER_HEX, TRANSACTION_INDEX_HEX: $TRANSACTION_INDEX_HEX"

# 1. w3.eth.get_block_receipts(BLOCK_NUMBER)
GET_BLOCK_RECEIPTS_RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockReceipts\",\"params\":[\"$BLOCK_NUMBER_HEX\"],\"id\":1}" "$RPC_URL")
echo "eth_getBlockReceipts Response: $GET_BLOCK_RECEIPTS_RESPONSE"

# 2. w3.eth.get_transaction_by_block(BLOCK_NUMBER, TRANSACTION_INDEX)
GET_TRANSACTION_BY_BLOCK_RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"$BLOCK_NUMBER_HEX\", \"$TRANSACTION_INDEX_HEX\"],\"id\":1}" "$RPC_URL")
echo "eth_getTransactionByBlockNumberAndIndex Response: $GET_TRANSACTION_BY_BLOCK_RESPONSE"

# eth_getTransactionByBlockNumberAndIndex 
# Response: {"jsonrpc":"2.0","id":1,"result":null}

To Reproduce

  1. Specify block height and transaction index
  2. BLOCK_NUMBER_HEX: 0x820567f, TRANSACTION_INDEX_HEX: 0x3
  3. eth_getTransactionByBlockNumberAndIndex
  4. Response: {"jsonrpc":"2.0","id":1,"result":null}

Expected behavior Get the transaction information correctly

Screenshots

Additional context

0x-wen avatar Mar 13 '25 12:03 0x-wen

Title : Inconsistent transactionIndex between eth_getBlockReceipts and eth_getTransactionByBlockNumberAndIndex

Description : We've identified a data inconsistency in transaction indexing when using different JSON-RPC methods on Sei Network

  1. Via eth_getBlockReceipts (block receipts response):
{
  "transactionHash": "0x2d934f14a93abafc8f894fd48dbc9a88f31c4a193aa2247f46225df878305510",
  "transactionIndex": "0x3"  // Index 3
}
  1. Via eth_getTransactionByBlockNumberAndIndex (direct transaction query):
{
  "hash": "0x2d934f14a93abafc8f894fd48dbc9a88f31c4a193aa2247f46225df878305510",
  "input": "0x",
  "nonce": "0x145",
  "to": "0x863221244596659ae10c4383021b4da3ace907c1",
  "transactionIndex": "0x9"  // Index 9
}

Impact: This discrepancy breaks the fundamental assumption that a transaction's index should be immutable and consistent across all block-related queries. This may cause errors in:

  • Block explorers
  • DApps relying on transaction ordering
  • Indexing services

Expected Behavior: Both methods should return identical transactionIndex values for the same transaction hash.

Additional Context:

  • Observed in block: 136337023
  • Potential root cause: Suspect block processing logic inconsistency between transaction execution context and post-block indexing.

0x-wen avatar Mar 18 '25 06:03 0x-wen

Please try to recheck this on atlantic-2 testnet. The logIndex was not being set correctly. Historical data will not be fixed retroactively however.

cordt-sei avatar Apr 01 '25 22:04 cordt-sei

Thank you for opening this issue and taking the time to share your thoughts. We’d love to keep moving this forward, but we need a bit more information from you. Please add any additional details within the next 2 day(s) so we can continue collaborating on a solution together. If we don’t hear back, the issue will close automatically — but you’re always welcome to reopen it when you’re ready.

github-actions[bot] avatar Nov 22 '25 12:11 github-actions[bot]

We’re closing this issue for now as we haven’t received additional input. Please know that your effort is appreciated — and when you’re ready to revisit this, we’ll be here to pick it up again. Thank you for contributing and helping us improve Sei.

github-actions[bot] avatar Nov 24 '25 12:11 github-actions[bot]