Documentation Index
Fetch the complete documentation index at: https://beta.docs.sqd.dev/llms.txt
Use this file to discover all available pages before exploring further.
- POST your data request to
/streamor/finalized-streamand you shall receive a JSON lines stream:outputs - By default the Portal will only include blocks with data matching the request filters. However, the stream will always include the first and the last blocks of the block range it covered, even if they have no matching data.
- The portal may end stream before it reaches
toBlock. You can omittoBlockfor open-ended streaming. - To get the rest of the data, the client must adjust the
fromBlockfield to the number of the last received block plus one. When streaming unfinalized data from/stream, they must also includeparentBlockHashinto the request.
Handling forks on /stream
- Chain forks / reorgs sometimes make some of the data from
/streamobsolete. The portal will detect that using theparentBlockHashfield of the request and respond with an HTTP 409 containing a sample of new consensus blocks. When that happens, the client must roll back any changes to its own state made due to orphan blocks’ data, then send anotherPOST /streamthat starts from an earlier block to attempt to fetch the updated chain. - Post-rollback request must contain
parentBlockHash. If the Portal detects that the block is still not in the updated chain, it’ll return a 409 again. Be prepared to process several of these in a row. - To make state management easier for the client, Portal may return
X-Sqd-Finalized-Head-NumberandX-Sqd-Finalized-Head-Hashheaders with each response from/stream. The block from these headers and blocks below it won’t ever reorganize. - That doesn’t mean that
X-Sqd-Finalized-Head-Numberis a non-decreasing value: Portals can be behind load balancers and the value may decrease when the load balancer switches to a lagging instance. The client should trust the guarantees provided by either instance and treat the highest block returned with these headers as a high water mark for finalized blocks.
