Sidecar Query Server (SQS) is an off-chain server tailored to performing expensive query tasks.
The high-level architecture is that the chain reads data at the end of the block, parses it, and then writes it into a Redis instance. There is no persistent storage. All data gets cleared and overwritten at the end of the block.
The sidecar query server then reads the parsed data from Redis and serves it to the client via HTTP endpoints.
The goal is to perform computationally and data-intensive tasks outside of nodes or clients. For example, swap routing falls under this category because it requires all pool data for performing a complex routing algorithm.
Indeed, swap router is the main functionality currently present in SQS.
Find the available endpoints below:
/router/quote?tokenIn=<tokenIn>&tokenOutDenom=<tokenOutDenom>
Description: returns the best quote it can compute for the given tokenIn and tokenOutDenom
Parameters:
tokenIn
the string representation of the sdk.Coin for the token intokenOutDenom
the string representing the denom of the token outAdditionally, there is an endpoint for retrieving all pools instrumented with TVL data:
/pools
Description: returns all pools in the chain state instrumented with denoms and TVL if available
Parameters: IDs
- list of specific pool IDs to retrieve.
The swap router component is in an early stage. In some instances, competing implementations may provide more optimal quotes. We are still perfecting the quote quality and will announce stability in the subsequent releases.
For power clients, we recommend running an in-house infrastructure of SQS. Our public endpoints are designed to handle only the Osmosis frontend traffic. However, you can find the public APIs below for simple integrations:
Production: https://sqs.osmosis.zone
This is a geo-distributed deployment across 3 regions that is used by the production application https://app.osmosis.zone.
It operates on data from osmosis-1
mainnet.
Staging: https://sqs.stage.osmosis.zone
This is a deployment that is used by our stage app https://stage.osmosis.zone/. It is less stable and may experience downtime due to experimental features.
It operates on data from osmosis-1
mainnet.
Testnet: https://sqs.testnet.osmosis.zone
This is a testnet deployment made against osmo-test-5
testnet state.
This environment exposes all endpoints listed below.
Running your own SQS requires a mainnet node for data ingest at
the end of every block. In the future, we will separate the two
into separate binaries. Currently, SQS is enabled via
config when running a chain node.
To begin the process:
Install Docker
Redis
service.Sync a mainnet node on the current mainnet Osmosis release (ref)
Enable SQS ingest in app.toml
The router has several configuration parameters that are set via app.toml
.
See the recommended enabled configuration below: