It allows fetching specific transactions using an external index, following #32541 (comment).
Currently, electrs and other indexers map between an address/scripthash to the list of the relevant transactions.
However, in order to fetch those transactions from bitcoind, electrs relies on reading the whole block and post-filtering for a specific transaction1. Other indexers use a txindex
to fetch a transaction using its txid 234.
The above approach has significant storage and CPU overhead, since the txid
is a pseudo-random 32-byte value. Also, mainnet txindex
takes ~60GB today.
This PR is adding support for using the transaction’s position within its block to be able to fetch it directly using REST API, using the following HTTP request:
0GET /rest/blockpart/BLOCKHASH.bin?offset=OFFSET&size=SIZE
The offsets’ index can be encoded much more efficiently (<3GB today).
Only binary and hex response formats are supported.