fdundjer / solana-sniper-bot
- среда, 27 марта 2024 г. в 00:00:09
Solana Sniper Bot - Proof of Concept
This code is written as proof of concept to demonstrate how we can buy new tokens immediately after the liquidity pool is open for trading.
Script listens to new Raydium USDC or SOL pools and buys tokens for a fixed amount in USDC/SOL.
Depending on the speed of the RPC node, the purchase usually happens before the token is available on Raydium UI for swapping.
This is provided as is, for learning purposes.
To run the script you need to:
.env.copy
file (remove the .copy from the file name when done).
npm install
npm run buy
in terminalYou should see the following output:
By default, script buys each token which has a new liquidity pool created and open for trading. There are scenarios when you want to buy one specific token as soon as possible during the launch event. To achieve this, you'll have to use snipe list.
USE_SNIPE_LIST
to true
snipe-list.txt
file
This will prevent script from buying everything, and instead it will buy just listed tokens.
You can update the list while script is running. Script will check for new values in specified interval (SNIPE_LIST_REFRESH_INTERVAL
).
Pool must not exist before the script starts. It will buy only when new pool is open for trading. If you want to buy token that will be launched in the future, make sure that script is running before the launch.
By default, auto sell is enabled. If you want to disable it, you need to:
AUTO_SELL
to false
MAX_SELL_RETRIES
to set the maximum number of retries for selling tokenAUTO_SELL_DELAY
to the number of milliseconds you want to wait before selling the token
If you set AUTO_SELL_DELAY to 0, token will be sold immediately after it is bought.
There is no guarantee that the token will be sold at a profit or even sold at all. The developer is not responsible for any losses incurred by using this feature.
If you have an error which is not listed here, please create a new issue in this repository.
To collect more information on an issue, please change LOG_LEVEL
to debug
.
finalized
.Error: 410 Gone: {"jsonrpc":"2.0","error":{"code": 410, "message":"The RPC call or parameters have been disabled."}, "id": "986f3599-b2b7-47c4-b951-074c19842bad" }
Error: No SOL token account found in wallet:
Use this script at your own risk.