Re: Fetch all blocks using node sdk #fabric-sdk-node

Mark Lewis

The blocks in Fabric are just a chain of sequentially numbered blocks. They are not indexed by creation time. If you want to index them by creation time (or rather the timestamp of transactions contained within the block?) then I think the earlier suggestion of creating your own store is likely your best approach. You don't necessarily need to store all the blocks in your own off-chain database. You could maybe just build your own block index and then use the existing APIs to retrieve blocks in the numbered range derived from your index for a given date range as required.

Using the block eventing client API should be much quicker to retrieve a sequential set of blocks than requesting each one individually using the qscc chaincode:

This sample might be helpful:

Join to automatically receive all group messages.