Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 8046

Using Java Script, what ways can i improve my transaction confirmation times?

$
0
0

I've recently been trying to create a token trading script that uses Java Script, web3 and spl-token methods. I'm wanting to focus on fast trades, so i want to make my transactions confirm as quick as possible after my script sends out the transaction.

I've been having issues with my transactions not being processed at all by the network frequently, and ones that do get processed are usually processed anywhere from 6 seconds up to 90 seconds after my script sends out the transaction. I've noticed other bot traders have 1-3 second confirmation times across multiple tokens, which i can't seem to replicate.

For example (assuming my transaction actually gets confirmed this time):My script detects a token being made on block #10000Within 1 second my script processes the tokens transaction signature and pulls all the information i need to construct a transaction for the token and sends out the requestMy transaction gets processed on block #10035Meanwhile, other bot traders get processed on block #10005 or so.

My script currently:

  1. Tracks for newly minted tokens and collects relevant information
  2. Checks if the tokens market information matches my parameters to initiate a buy swap
  3. Constructs instructions to create an ATA if one doesn't exist, and instructions to swap a determined amount of Sol for said token and sends the transaction out for confirmation
  4. Waits until my sell parameters are met
  5. Constructs instructions to swap all the tokens the ATA owns for Sol and sends the transaction out for confirmation

Information about my transaction:I adjust my ComputeUnitLimit to 71999 units.I set a priority fee (I've tested with 0.003-0.00001 Sol).I fetch the latest blockhash with the 'processed' markerI currently use the free Chainstack mainnet RPC.

When my transactions process, and i compare them to the bots that get 1-3 second confirmations, i've had instances where i paid a higher fee but still was processed later (keep in mind i send out the transaction in under 1 second also)But i have also noticed my transaction versions are labelled "Legacy" in comparison to the bots that are labelled "Version 0", does this make a different to my transaction being confirmed within the 1-3 second window i desire?

and what else can i do to improve the confirm speed?


Viewing all articles
Browse latest Browse all 8046


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>