Roman Akhtariev
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Sidecar Query Server: Integrator Guide ## Introduction 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. ## Osmosis Swap Router Indeed, swap router is the main functionality currently present in SQS. Find the available endpoints below: 1. GET `/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 in - `tokenOutDenom` the string representing the denom of the token out 2. GET `/router/single-quote?tokenIn=<tokenIn>&tokenOutDenom=<tokenOutDenom>` Description: returns the best quote it can compute w/o performing route splits, performing single direct route estimates only. Parameters: - `tokenIn` the string representation of the sdk.Coin for the token in - `tokenOutDenom` the string representing the denom of the token out 3. GET `/router/routes?tokenIn=<tokenIn>&tokenOutDenom=<tokenOutDenom>` Description: returns all routes that can be used for routing from tokenIn to tokenOutDenom Parameters: - `tokenIn` the string representation of the denom of the token in - `tokenOutDenom` the string representing the denom of the token out 4. GET `/router/custom-quote?tokenIn=<tokenIn>&tokenOutDenom=<tokenOutDenom>&poolIDs=<poolIDs>` Description: returns the quote over route with the given poolIDs. If such route does not exist, returns error. Parameters: - `tokenIn` the string representation of the sdk.Coin for the token in - `tokenOutDenom` the string representing the denom of the token out - `poolIDs` comma-separated list of pool IDs Additionally, there is an endpoint for retrieving all pools instrumented with TVL data: 1. GET `/pools/all` Description: returns all pools in the chain state instrumented with denoms and TVL if available Parameters: none ### Disclaimer 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. ## Public APIs 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` - Stable. Manually deployed by the Osmosis team. Staging: `https://sqs-stage.osmosis.zone` - Automatically deployed from the release branch. For example, if the current Osmosis release like is v20, then the deployment branch is `v20.x` ## Running Your SQS 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: 1. Sync a mainnet node ([ref](https://docs.osmosis.zone/overview/validate/joining-mainnet)) 2. Get on the current mainnet Osmosis release branch. 3. Start Redis 4. Rebuild the binary and start it ```bash git checkout v20.x # Starts a detached redis container, to stop: 'make redis-stop' make redis-start # Rebuild the binary and start the node with sqs enabled in-process make sqs-start ``` ### Suggested Configuration Parameters The router has several configuration parameters that are set via `app.toml`. See the recommended enabled configuration below: ```toml ############################################################################### ### Osmosis Sidecar Query Server Configuration ### ############################################################################### [osmosis-sqs] # SQS service is disabled by default. is-enabled = "true" # The hostname and address of the sidecar query server storage. db-host = "localhost" db-port = "6379" # Defines the web server configuration. server-address = ":9092" timeout-duration-secs = "2" # Defines the logger configuration. logger-filename = "sqs.log" logger-is-production = "true" logger-level = "info" # Defines the gRPC gateway endpoint of the chain. grpc-gateway-endpoint = "http://localhost:26657" # The list of preferred poold IDs in the router. # These pools will be prioritized in the candidate route selection, ignoring all other # heuristics such as TVL. preferred-pool-ids = [] # The maximum number of pools to be included in a single route. max-pools-per-route = "4" # The maximum number of routes to be returned in candidate route search. max-routes = "20" # The maximum number of routes to be split across. Must be smaller than or # equal to max-routes. max-split-routes = "3" # The maximum number of iterations to split a route across. max-split-iterations = "10" # The minimum liquidity of a pool to be included in a route. min-osmo-liquidity = "10000" # The height interval at which the candidate routes are recomputed and updated in # Redis route-update-height-interval = "0" # Whether to enable candidate route caching in Redis. route-cache-enabled = "true" ``` ## Sources - [Chain Ingest](https://github.com/osmosis-labs/osmosis/tree/main/ingest) - [SQS Web Server](https://github.com/osmosis-labs/osmosis/tree/main/ingest/sqs) - [Router Component](https://github.com/osmosis-labs/osmosis/tree/main/ingest/sqs/router)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully