Code Monkey home page Code Monkey logo

solana-trading-bot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solana-trading-bot's Issues

Wallet

Where to add or enter or provide our wallet address?It only asks for private keys.Help me out

To improve the speed of purchase, what can be done?

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)?

Error: No SOL token account found in wallet:

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)

I got error while running the code

  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
}

empty Token Accounts?

Hi,

Trying to understands this project by running it.

Am i the only one who gets empty Token Accounts?

image

image

More Filters

Since I got rugged several times, I propose more filters to prevent this:

  1. Detect High Ownership (if a lot of token supply is only in a few wallets)
  2. Detect Dexscreener Enhanced Info (if a dev/creator paid $300 for enhanced info, there is a little bit higher probability the project is not a scam)
  3. Detect Low Liquidity (don't buy if the current liquidity is below a set liqudity)

Thanks, great work so far!

Timer pools

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

Buy transactions error

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)
    }

ERROR: RPC_ENDPOINT is not set

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?

User interface

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

  • 'info', logging info eg about pools
  • 'tx', buy/sell info
  • 'balances', info about wallet

client can be written in react and display in realtime information from the websocket endpoint.

Open questions

  • what features to integrate? bot logs and info about tokens?
  • how to make this modular and not bloat the codebase. plugins?
  • make client a separate repo?

private key not found

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

Detect Total Tokens and SOL added to the Pool

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

Sniper bot

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,

Auto Sell Delay

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?

Swap transaction delayed / dropped

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)

Sell method

@fdundjer Is it possible to have a method for selling sol tokens? possibly with a timed strategy?

Some feedback, some questions

#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:

  • The code's performing well, swap is almost instant (depends on node/load)
  • Instant pool detection (for instant pool detection tx commitment = confirmed -> processed
  • makeSwapFixedInInstruction sometimes misses when passing new poolKeys

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:

  1. Liquidity amount: QuoteVault is probably where its stored. getBalance method can be used to obtain LP in Sol.
  2. Supply/Top holders%/Raydiyum%: raw data can be obtained using getTokenSupply / getTokenLargestAccounts / getParsedAccountInfo
  3. Mint/Freeze authority authority, deployer info can be decoded from account data: https://www.helius.dev/blog/solana-dev-101-deserializing-account-data-on-solana

BR

Great work thanks! Question regarding new pool

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.

Non base58 character exception

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>

Check Ownership Renounced and Creator Balance

Notice of ownership renunciation and the balance of the creator has some correlation with whether the token will be subject to a rug pull. It's uncertain if there's a way to programmatically check these two factors.

image

Rugpull safety

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?

HELIUS RPC not worked

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?

swapping out after swapping in

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?

Buys but does not sell

Displays an error, but buys and does not sell.
Zrzut ekranu 2024-02-26 192348
AUTO_SELL true
SELL_DELAY 3000

what am i doing wrong? ;)

Script runs but it's not making any buys o showing errors.

I have USD & SOL in my Wallet.
I've configured correctly the RPC because I can see requests on my dashboard.
But when I run the scripts I get the following screenshot but no error thrown or message.
image

What I'm doing wrong or is missconfigured?
Thanks.

ERROR: Failed to process pool

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"
]
}

Filter - Revoke Mint Authority / LP Burn / Sell Timer

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.

How to convert SOL to WSOL?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.