โ›“๏ธOnchain program

The onchain program takes in mints and pools, and will calculate the most optimal arbitrage trade between them and execute the trades.

If you want maximum flexibility, you can write your own bot and just call the onchain program from there. This allow you to do whatever customization you want but still utilize the onchain program to get maximum arb opportunity.

Demo bot: https://github.com/Cetipoo/solana-onchain-arbitrage-bot

Current supported DEX:

  • Raydium

  • Raydium CPMM

  • Raydium CLMM

  • Pumpfun Swap

  • Meteora DLMM

  • Meteora Dynamic Pool

  • Meteora Dynamic Pool V2

  • Orca whirlpool

  • Solfi

  • Vertigo

  • Heaven Dex

NOTE: It's recommended to include this address lookup table as it has all the fixed keys needed: 4sKLJ1Qoudh8PJyqBeuKocYdsZvxTcRShUt9aKqwhgvC

NOTE: It's recommended to use at least 250_000 compute unit limit when only amm pools/dlmm, and at least 450_000 compute unit limit with other pools. Ideally you may want 600_000 - 700_000 to be able to hit the big arbs and not being limited by compute unit. Using merge mint will need a bit more CU than just one mint.

Here's a simplified Rust example for how to interact with the program. You can include multiple X mints with their according pools here.

You can also check https://github.com/Cetipoo/solana-onchain-arbitrage-bot to see how to extract all the keys for each pool type.

Additional fee account

The onchain program supports charging additional fees on top of the bot fee itself. This allows you to build customized bot and charge your users yourself.

To do so you need to change two things when constructing the instruction.

  1. Add your addtional fee account. Note this need to be the same token mint as base mint. aka if base mint is WSOL your additional fee acount also need to be WSOL account.

  2. Change the additional_fee_bp arg. The number is in base point. For example if you set 500, it means you will charge 5% of the profit yourself, onchain program will take 15%, and user will get 80% of the whole profit.

Last updated