How Swap works?
Jupiter Swap is simple to use but a complex system. In this article, we will breakdown the intricacies of how it works and how it has evolved over time.
Overview
Jupiter Swap is built around various crucial on-chain data and using those data in algorithms or display them as information to aid users make informed swap decisions.
Refering to the simple flowchart below, the sequence of events are as follows:
You come to jup.ag or Jupiter Mobile.
You enter the tokens you want to swap.
- Search Algorithm provides you with the results based on verification, volume, etc.
You enter the amount to swap.
- The Routing Engine will find the best possible swap based on on-chain liquidity data.
- The RFQ infrastructure will find market makers to fulfil the quote.
- Based on the results, we compare and provide you with the best amongst the two.
You click swap, we build the transaction and send it on-chain to execute.
- All through the simple interface.
Best Token Selection
Since late 2023 and onwards, we see a gigantic surge in the number of tokens being minted and actively traded on Solana. Through this period, Jupiter has rebuilt and strengthen its infrastructure to scale with the big growing demand of trading new tokens.
Ecosystem List
The Jupiter Ecosystem List started off as a simple Github CSV (deprecated) file where token creators can create Pull Requests to get themselves "strict listed" or verified. The list grew popular and became widely used in the ecosystem. However, as more tokens appeared, more pull requests were created, which significantly increased our manual load to hand verify each token.
Today, the Ecosystem List is run by a group of contributors from various parts of our community. Additionally, more parameters are automatically reflected in the portal to aid them in verification of the tokens legitimacy/credibility.
Read about the full backstory and thought process.
Read about the community verification process.
To verify your token, check out this guide or head over to the site now.
Do note that this process will continue to improve/evolve and might have changes in the future.
Search Algorithm
With the Ecosystem List, there are still tens of thousands of tokens out in the wild. In order to prevent malicious or scam tokens from being bought, we apply a smart algorithm to the token search function.
Simple match algorithm to search token name or symbol.
Direct token address search.
Flag potential malicious tokens.
- Tokens with name or symbol including a potential token address of another token.
- Tokens with freeze authority, transfer tax, permanent delegate, etc.
Best Price
By default, Jupiter ensures you are getting the best price by comparing the Routing Engine results to the RFQ results. The following explains further of how each mechanism works to provide you with the best price.
Metis Routing Engine
Pre 2023, there were only a handful of DEXes/AMMs built on the Solana blockchain. At that time, it was simpler to aggregate and provide the best possible route (less permutations of markets and tokens). However, as Solana gain traction, more market volume as well as more DEXes being built.
Over time, Jupiter went through a few iterations of its routing engine and have been using the Metis version since. It is a heavily modified variant of the Bellman-Ford algorithm catered for the key requirements of offering best price routing at scale in a very dynamic operational space.
- Operate seamlessly with Solana's hyper-fast blocktimes.
- Route can be provided quickly (without compromising on best price).
- Handle load and demand efficiently.
You can also watch the workshop on YouTube!
RFQ
RFQ, also known as Request For Quote, is a pricing mechanism where users request a quote for a specific trade from a permissioned set of off-chain market makers, who then fulfil your swap request on-chain if you choose to accept.
On-chain AMMs and DEXes continue to be complicated and volatile, Jupiter aggregates them to achieve the best price derived on-chain, however, with off-chain market makers, we can greatly improve user experience.
Market makers offer firm quotes (guaranteed prices) instead of relying on fluctuating on-chain liquidity pools.
- 0% slippage
- MEV protected
Market makers execute the swap for you.
- 0 transaction fees
Best Experience
Financial tools on blockchains can become complicated, actions such as handling slippage, preventing MEV, adjusting priority fees can become cumbersome to seasoned veterans and remain daunting for beginners.
Simple Yet Powerful Interface
Solana trading environment is like nothing we have seen before, demanding a different level of execution. The Swap interface is simple yet powerful, allowing you to swap with confidence, using token, price information and settings to ensure your swap works.
Ultra Mode
(revisit)
Ultra Mode takes care of the entire execution flow and settings pay the fees when txn fails, we align incentives fully with users.
- 0 transaction fees (we pay all on your behalf even failed transactions).
- 0.1% swap fee applies (to help us help you land transactions effectively).
Manual Mode
If you're a seasoned user and prefers to customize your settings with precision, switch to Manual Mode.
- You control your own exact slippage threshold, broadcast method, priority fees, etc.
- You pay your own transaction fees but no additional swap fee applies.
Other Information
The Swap interface also displays other crucial information such as chart, token details and price warnings, to help you make an informed swap decision.
Building Your Feedback
We build upon your feedback and experiences to continue to improve our products. Share them on Discord and we look forward to work along side you!