FAQ
What are some real-world applications for which Squid SDK was a good fit?
Here is an incomplete list:
- DeFi dashboards, tracking addresses and internal transactions
- NFT marketplaces, with a dynamic sets of NFT contracts to watch
- Historical price feeds, tracking Uniswap trades and Chainlink oracle contracts
- Mining smart contract deployments and the bytecode
- Real-time bots (<1sec delay) triggered by on-chain activity
How does Squid SDK handle unfinalized blocks?
The SQD Network only serves finalized blocks and is typically ~1000 blocks behind the tip. The most recent blocks, as well as the unfinalized blocks are seamlessly handled by the SDK from a complementary RPC data source, set by the chain
config. Potential chain reorgs are automatically handled under the hood. See Indexing unfinalized blocks for details.
I want to call processor.run()
from somewhere inside my app. Is that possible?
processor.run()
is designed to be the top-level call and will try to control execution at the process level. For example, if a finite block range is specified in the processor config it will shutdown the parent process with process.exit()
when it reaches the end.
For this reason we do not recommend to use processor.run()
as a regular function in your applications. It is usually preferable to run the processor as a child process.
If you absolutely have to do it, please set the SQUID_PROCESSOR_EXIT_DISABLED
environment variable to false
.
What is the latency for the data served by the squid?
Since the ArrowSquid release, the Squid SDK has the option to ingest unfinalized blocks directly from an RPC endpoint, making the indexing real-time.
Typically this is achieved by polling HTTP RPCs, but that becomes unfeasible for some low block time, high data rate networks such as Arbitrum. For latency-critical applications on such networks please use WSS RPC endpoints.
How do I enable GraphQL subscriptions for local runs?
Add --subscription
flag to the serve
command defined in commands.json
. See Subscriptions for details.
How do squids keep track of their sync progress?
Depends on the data sink used. Squid processors that use TypeormDatabase
keep their state in a schema, not in a table. By default the schema is called squid_processor
(name must be overridden in multiprocessor squids). You can view it with
select * from squid_processor.status;
and manually drop it with
drop schema squid_processor cascade;
to reset the processor status.
Squids that store their data in file-based datasets store their status in status.txt
by default. This can be overridden by defining custom database hooks.
Is there a healthcheck endpoint for the indexer?
Yes, the processor exposes the key prometheus metrics at the ${process.env.PROMETHEUS_PORT}/metric
endpoint. The squids deployed to the SQD Cloud also publicly explose the metrics, see Monitoring in the Cloud
Do squids have a debug mode?
Yes. To see all debug messages, set the SQD_DEBUG
anv variable to *
:
SQD_DEBUG=*
You can also enable debug messages just for a specific namespace. For example,
SQD_DEBUG=sqd:processor:archive
will show only the messages related to your squid's queries to the SQD Network.