fuel-core
fuel-core copied to clipboard
Help `fuel-indexer` fetch transactions efficiently
- Currently on the fuel-indexer, when fetching transactions for a block, we're grabbing the transaction fragments, and then making requests to fuel-core via the GQL client, for each transaction fragment
- Meaning, we're making a GraphQL request for each transaction (not very efficient)
- It would be great if, for a given block, we could either fetch the transactions in bulk OR, if we could have the transactions included in the block itself
- We tried some previous work with this in https://github.com/FuelLabs/fuel-core/issues/764
- This issue also references the original issue in fuel-indexer
- @xgreenx, @Voxelot mentions I should reach out to you personally about this :)
- Happy to provide any other details
You should already be able to fetch blocks with all transactions and any additional data via GraphQL.
On the rust side, you can reuse types from fuel-core-client
and compose them into the type that should fetch all data in one run. For example, you can define FullBlock
type that fetches Transaction
instead of TransactionIdFragment
, which should return the full block for you. if you need some additional data from transactions, you can define your own Mytransaction
that returns limited/extended fields.

Hmm, the FuelClient::query
function is private but with https://github.com/FuelLabs/fuel-core/pull/1175 you can write your own queries=)
Solved on the indexer side https://github.com/FuelLabs/fuel-indexer/issues/288