Enabling Querying by tx hash for old blocks

Recently, few users noticed that they weren’t able to query old txs by their txhash and reached out to the team. This post explains the reason for this behaviour and the solution.

We have a flag in bor called txlookuplimit, which has been inherited from geth (refer Command-line Options | Go Ethereum)

  --txlookuplimit value               Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (default: 2350000)

This was introduced in geth v1.10.0, quoting the release notes:

Geth 1.10.0 contains some changes which remove unnecessary data in the blockchain database. In particular, Geth no longer keeps transaction inclusion info for all transactions, and instead limits the storage of inclusion records to one year. For application developers, this change means that very old transactions can no longer be accessed by hash.
Note: if you would like to disable this behavior and keep inclusion information for all historical transactions, you can re-enable indexing using the --txlookuplimit=0 command-line flag.

Since the default value of 2.35M blocks translates to around 55 days on our chain (with 2 sec block time), this could prove to be quite low for certain use cases. Based on the use cases your node is serving, you can increase the value to a higher no of blocks or make it 0 if you want to maintain the txs index of the entire chain (especially for RPC providers). But please note that this will increase the storage requirements.


Thank you @sandeep, appreciate the update.