warp-id / solana-trading-bot Goto Github PK
View Code? Open in Web Editor NEWSolana Trading Bot - Beta
License: Microsoft Public License
Solana Trading Bot - Beta
License: Microsoft Public License
Hi, from my understanding, you set a listener for each time a new pool is created.
Is there a way to get the opening time of the pool?
Could not find the information clearly on Raydium SDK.
I could help adding this feature to your code.
Regards.
Hey Filip great work!
Ive tried using it, but what wallet do you prefer to use?
And also, do you have any other platform to write you a message? Like gmail or instagram, telegr.
Thank you,
Can you introduce more about the warp to speed up the transaction confirmation?
It would be nice if we could add a feature that would live print to the user the market capitalization for a specific token
Encountering this error sometime, not always.
[08:30:02.429] ERROR: Failed to process pool
status: "8481abfe57889b06"
nonce: "35c01846637f68fb"
maxOrder: "553beb1adc39c4da"
depth: "0100000000f0a098"
baseDecimal: "b244fbdde3fb7667"
quoteDecimal: "ed2ffaab54205e65"
state: "3846d74dd270550f"
resetFlag: "1f51148ef48039aa"
minSize: "06b73f891e"
volMaxCutRatio: "00"
amountWaveRatio: "00"
baseLotSize: "00"
quoteLotSize: "00"
minPriceMultiplier: "010100000000"
maxPriceMultiplier: "1f1df000"
systemDecimalValue: "00"
minSeparateNumerator: "00"
minSeparateDenominator: "00"
tradeFeeNumerator: "00"
tradeFeeDenominator: "00"
pnlNumerator: "00"
pnlDenominator: "00"
swapFeeNumerator: "00"
swapFeeDenominator: "00"
baseNeedTakePnl: "00"
quoteNeedTakePnl: "00"
quoteTotalPnl: "00"
baseTotalPnl: "00"
poolOpenTime: "00"
punishPcAmount: "00"
punishCoinAmount: "00"
orderbookToInitTime: "00"
swapBaseInAmount: "00"
swapQuoteOutAmount: "00"
swapBase2QuoteFee: "00"
swapQuoteInAmount: "00"
swapBaseOutAmount: "00"
swapQuote2BaseFee: "00"
baseVault: "11111111111111111111111111111111"
quoteVault: "11111111111111111111111111111111"
baseMint: "11111111111111111111111111111111"
quoteMint: "11111111111111111111111111111111"
lpMint: "11111111111111111111111111111111"
openOrders: "11111111111111111111111111111111"
marketId: "11111111111111111111111111111111"
marketProgramId: "11111111111111111111111111111111"
targetOrders: "11111111111111111111111111111111"
withdrawQueue: "11111111111111111111111111111111"
lpVault: "11111111111111111111111111111111"
owner: "11111111111111111111111111111111"
lpReserve: "00"
padding: [
"00",
"00",
"00"
]
error: {
"type": "Error",
"message": "Number can only safely store up to 53 bits",
"stack":
Error: Number can only safely store up to 53 bits
at assert (/root/solana-sniper-bot/node_modules/bn.js/lib/bn.js:6:21)
at BN.toNumber (/root/solana-sniper-bot/node_modules/bn.js/lib/bn.js:547:7)
at createPoolKeys (/root/solana-sniper-bot/liquidity/liquidity.ts:98:43)
at /root/solana-sniper-bot/buy.ts:430:41
at Generator.next (<anonymous>)
at fulfilled (/root/solana-sniper-bot/buy.ts:28:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
}
This is what happens if i start the script:
PS D:\dev\solana-sniper-bot> npm run buy
buy
ts-node buy.ts
bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
D:\dev\solana-sniper-bot\node_modules\base-x\src\index.js:113
throw new Error('Non-base' + BASE + ' character')
^
Error: Non-base58 character
at Object.decode (D:\dev\solana-sniper-bot\node_modules\base-x\src\index.js:113:11)
at D:\dev\solana-sniper-bot\buy.ts:103:39
at Generator.next ()
at D:\dev\solana-sniper-bot\buy.ts:31:71
at new Promise ()
at __awaiter (D:\dev\solana-sniper-bot\buy.ts:27:12)
at init (D:\dev\solana-sniper-bot\buy.ts:96:12)
at D:\dev\solana-sniper-bot\buy.ts:376:9
at Generator.next ()
at D:\dev\solana-sniper-bot\buy.ts:31:71
PS D:\dev\solana-sniper-bot>
Proposal how to build a UI. the bot and other components have to communicate with the frontend (client).
If the bot has a websocket endpoint can implement a protocol like this eg. Each messages has a topic and a content
client can be written in react and display in realtime information from the websocket endpoint.
Open questions
@fdundjer Is it possible to have a method for selling sol tokens? possibly with a timed strategy?
Hello
#not a dev question
I am wondering whether there is a standard (efficient) method in the Raydium SDK to exclude 'timer' pools?
offset: LIQUIDITY_STATE_LAYOUT_V4.offsetOf('status'),
bytes: bs58.encode([6, 0, 0, 0, 0, 0, 0, 0]),
We can store the list of timer pools (by changing to "7") and then check the list before processing (how to set 2 separate listeners?). Perhaps we can check when the liquidity has been added vs currect time. I'm not sure if those are ok, but these are potential options.
Thanks for the help in advance
D:\video\sol\solana\buy.ts:28
import { retrieveEnvVariable } from './utils';
^
Error: No SOL token account found in wallet: 9ShLJ6KyegT4X6YXGnqc3bBpGpDwNuYXBqkoKXBMzZm6
at D:\video\sol\solana\buy.ts:146:11
at Generator.next ()
at fulfilled (D:\video\sol\solana\buy.ts:28:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Reminder: My Sol balance is insufficient, but I have already recharged 0.3 of them
throw new SolanaJSONRPCError(
^
SolanaJSONRPCError: failed to get accounts owned by program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8: the method getProgramAccounts does not exist/is not available
at Connection.getProgramAccounts (/Users/solana-sniper-bot-master 2/node_modules/@solana/web3.js/src/connection.ts:3677:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: -32601,
data: undefined
}
https://gmgn.ai/defi/quotation/v1/tokens/sol/
Add the ability to filter all 3 parameters using this api
Dear Author,
Thanks for sharing your program. I have tried it but get the below error
[18:13:01.017] INFO: Listening for raydium changes: 0
[18:13:01.017] INFO: Listening for open book changes: 1
[18:16:14.863] ERROR: Failed to process pool
status: "06"
nonce: "fe"
maxOrder: "07"
depth: "03"
baseDecimal: "06"
quoteDecimal: "09"
state: "01"
resetFlag: "00"
minSize: "3b9aca00"
volMaxCutRatio: "01f4"
amountWaveRatio: "4c4b40"
baseLotSize: "0f4240"
quoteLotSize: "2710"
minPriceMultiplier: "01"
maxPriceMultiplier: "3b9aca00"
systemDecimalValue: "3b9aca00"
minSeparateNumerator: "05"
minSeparateDenominator: "2710"
tradeFeeNumerator: "19"
tradeFeeDenominator: "2710"
pnlNumerator: "0c"
pnlDenominator: "64"
swapFeeNumerator: "19"
swapFeeDenominator: "2710"
baseNeedTakePnl: "00"
quoteNeedTakePnl: "00"
quoteTotalPnl: "00"
baseTotalPnl: "00"
poolOpenTime: "65c3bad0"
punishPcAmount: "00"
punishCoinAmount: "00"
orderbookToInitTime: "00"
swapBaseInAmount: "00"
swapQuoteOutAmount: "00"
swapBase2QuoteFee: "4e354a"
swapQuoteInAmount: "7a3343a0"
swapBaseOutAmount: "d0126e44656f"
swapQuote2BaseFee: "00"
baseVault: "DsTV4d2hRksBkaVCixZXoy1oDddquU5EqNvXpX6v21ny"
quoteVault: "DUzCVWAanSSAJ2a7b5cfePrhfAptDJkZJ4gLPEpykn1W"
baseMint: "9vZBamqVH4RyQFqcAE5mMAf1VZAriZteVxYpXugWK49d"
quoteMint: "So11111111111111111111111111111111111111112"
lpMint: "EfSzMbfsCHYyT1ADaWdaeSPTd6TUZkNf2hboJ6YJNzAU"
openOrders: "61v931f9xu8j8sNMCnbgaJWccvq5L95XuHAXGDWJenKq"
marketId: "DYF4VN7u63wzj4UFNKTyu342ExTszR4QS3guL1utyhJJ"
marketProgramId: "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"
targetOrders: "7ArUTyFeRr56L2cpmZoAuRYspiMGEpNb5G15bHG3Z3h7"
withdrawQueue: "11111111111111111111111111111111"
lpVault: "11111111111111111111111111111111"
owner: "GThUX1Atko4tqhN2NaiTazWSeFWMuiUvfFnyJyUghFMJ"
lpReserve: "021d0cad8dac"
padding: [
"00",
"00",
"00"
]
error: {
"type": "SendTransactionError",
"message": "failed to send transaction: Transaction simulation failed: Error processing Instruction 2: custom program error: 0x1",
"stack":
Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 2: custom program error: 0x1
at Connection.sendEncodedTransaction (C:\Users\Stefan\Desktop\Bots\Sol Snip bot\node_modules@solana\web3.js\src\connection.ts:5920:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Connection.sendRawTransaction (C:\Users\Stefan\Desktop\Bots\Sol Snip bot\node_modules@solana\web3.js\src\connection.ts:5879:20)
"logs": [
"Program ComputeBudget111111111111111111111111111111 invoke [1]",
"Program ComputeBudget111111111111111111111111111111 success",
"Program ComputeBudget111111111111111111111111111111 invoke [1]",
"Program ComputeBudget111111111111111111111111111111 success",
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",
"Program log: CreateIdempotent",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
"Program log: Instruction: GetAccountDataSize",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1569 of 392795 compute units",
"Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program 11111111111111111111111111111111 invoke [2]",
"Transfer: insufficient lamports 904720, need 2039280",
"Program 11111111111111111111111111111111 failed: custom program error: 0x1",
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 11473 of 399700 compute units",
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL failed: custom program error: 0x1"
]
}
Hi everyone, I would like to ask if it is possible to add conditions to filter out invidual pools where the Revoke Mint Authority and LP Burn had occured. Plus to set a timer for the subsequent sale of a given coin after a bot purchase? Thank you.
Hi mate have a quick question where do we specify the token we want to snipe?
Thanks ahead
Please tell me the installation instructions
Hello!
I use "snipe list" and can buy after only 15-17 seconds
my place after purchase is always 90+
tried different settings:
setComputeUnitLimit { units: 1_400_000 } // min 200k max 1.4kk
setComputeUnitPrice { microLamports: 10_000_000 } // 0,01 Sol = Lamport 10000000
Tell me what parameters can be changed or how can the script be improved to get into that 1-5-10 range when purchasing?
Maybe someone has a simple script for the BUY function for a token that has not yet appeared in the pool, so that he tries to buy it and maybe it will be faster (with the error ignored)?
When running script i keep getting private key not found.
I edited the .env file and included private key from secondary phantom wallet.
also converted private key to base 58 format and still get same error msg [22:59:01.574] error: private_key is not set
Thanks again!
Sully
Guys, please send your telegram, or any other messenger to contact you
@fdundjer @JiginJayaprakash
I added Helius RPC URLs to the .env file, now the bot writes INFO: Buy -- mint, url and dexurl adresses without any errors, but really the Buy does not occur and there are no transactions in Solscan.
RPC_ENDPOINT=https://mainnet.helius-rpc.com/?api-key=[mykey]
RPC_WEBSOCKET_ENDPOINT=wss://mainnet.helius-rpc.com/?api-key=[mykey]
Is it true? What I doing wrong?
Hey, I can't seem to figure out how to convert SOL to WSOL. My Phantom wallet doesn't have this option nor I can exchange sol to wsol. How do you guys do it?
Maybe add a check if the marketcap is higher than liquidity since those are commonly scams
Getting an error when I set my RPC endpoint. I'm using quick node and the file is saved but for some reason the code cannot detect the rpc?
Script doesn't buy at my end because poolOpentime is always less than runtimestamp
console.log(poolOpenTime > runTimestamp);
@fdundjer why many times does he say he has purchased but in reality he doesn't?
Don't use this code he is stealing your privatekeys
I got error with private key
throw new Error('Non-base' + BASE + ' character')
I think Im using different private key format, please advice
Sometimes due to debugging programs or active interruptions, some currencies in the wallet remain unsold. Is it possible to monitor these currencies and sell them after the program is started?
i got this to work after a few small changes.
question, i am trying to figure out the swap transaction to sell at a higher price from the initial buy swap.
A) have you figured out where the price data is of the token is stored? is the value calculated from helper methods in the raydium sdk Liquidity.computePrice()
methods? or is it on-chain with an oracle feed elsewhere?
B) in constructing the swap instruction to sell the tokens at market rate, should i use the same fixed in swap? or is it fixed out?
After doing all the steps listed.
Where to add or enter or provide our wallet address?It only asks for private keys.Help me out
I saw there are some burn rate like 90%, 98%, etc,
can we add some logic here to calculate that? reckon not necessary to be 100% burnt?
Hello
I am building a solana sniper bot aswell
I tried running yours and got an error.
I just wanted to know if you are able to swap new pools almost instantly or not, because my buy attempts are always dropped when I try to buy in the first ~10 sec after juicy new pool launch, but if I wait ~10 sec then it works fine. The same tx with same settings ofc
the error if it inrerests you :
/home/quarch/fdundjer/buy.ts:5
MARKET_STATE_LAYOUT_V2,
^
TypeError: Cannot read properties of undefined (reading 'pubkey')
at /home/quarch/fdundjer/buy.ts:113:25
at Generator.next ()
at fulfilled (/home/quarch/fdundjer/buy.ts:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
I would like to use the function auto sell delay for some tokens. Is it possible to add the function again?
Why did you decide to take it out of the script? Was it not working correctly?
Script supports buying usdc token pairs.
Add ability to trade sol pairs
Last night I was playing with the script, it bought like 15 tokens and all of them were rugpulls in less thank a minute, I didn't have a chance to sell before liquidity was taken to zero. Is there any way the buy method can be enhanced to decrease the risk of scam tokens?
If liquidity is burned or locked, then proceed with buying else don't buy
Can you add this filter to the bot as this will make it more robust when it comes to detecting rugs
Hey guys I've been trying to get the amount added to the pool but the bot usually sends late info.
From the pool, I was able to get the tokens in the LP but that's after trading as started it was not able to get the exact amount but the balance
For example if owner adds 5 SOL to pool on bot sending messages the 5 SOL owner adds might have pumped to 12 Sol before it being sent by the bot to the console
Here is my code line
https://github.com/CHToken/solana-sniper-bot/blob/master/buy.ts
#Not pro coder feedback
Just wanted to drop some feedback. This code I've been testing from open sources is rock solid, delivering the best results I've seen yet (pool detection speed). The author is pure gold. I've put it through its paces with various public nodes and geos (like Helius, which spans multiple regions/countries, though exact city details are scarce).
Observations:
confirmed
-> processed
Would be awesome if @fdundjer or other contributors would prompt how to build 'sell-after' function
p.s. If someone is looking to integrate basic pool/token info to filter out scam pools (liquidity, authority, Raydium supply, top holders, and socials), below are my findings as far:
QuoteVault
is probably where its stored. getBalance
method can be used to obtain LP in Sol.getTokenSupply
/ getTokenLargestAccounts
/ getParsedAccountInfo
https://www.helius.dev/blog/solana-dev-101-deserializing-account-data-on-solana
BR
title. I need add wrapped solana tokens suppurt, but i dont know how do it
Since I got rugged several times, I propose more filters to prevent this:
Thanks, great work so far!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.