0

I'm trying to use Jupiter API to swap tokens via python, and i used basically same code it's been around in this forum, which is:

swap_instruction = swap_tx_response.json()["swapTransaction"]

raw_tx = solders.transaction.VersionedTransaction.from_bytes(base64.b64decode(swap_instruction))

signature = keypair.sign_message(solders.message.to_bytes_versioned(raw_tx.message))

signed_tx = solders.transaction.VersionedTransaction.populate(raw_tx.message, [signature]) encoded_tx = base64.b64encode(bytes(signed_tx)).decode('utf-8')

headers = { "Content-Type": "application/json" } data = { "jsonrpc": "2.0", "id": 1, "method": "sendTransaction", "params": [ encoded_tx, { "skipPreflight": True, "preflightCommitment": "finalized", "encoding": "base64", "maxRetries": None, "minContextSlot": None } ] } tx_response = httpx.post("rpc_url", headers=headers, json=data)

I'm also running custom "helius RPC" as rpc to send my txs, and i'm finding the problem that some transactions confirm correctly, but others directly doesn't go through the blockchain, showing "no data" in explorer, like this one:

https://solscan.io/tx/2QLTN9mAP9qWR3zQkprPM8k24WpLfi9DoF3qU1E78NBhWpBLrxe7qyVSoL1rB4kYadvpv9Q83NxVEcHHQ7UjSDJV

I don't know what could be causing this as im a bit o a noob on solana, so help would be appreciated.

2 Answers 2

0

Set Compute Unit Price might solve the problem https://solana.com/developers/guides/advanced/how-to-use-priority-fees

0

It most likely is a result of your transaction being dropped by a validator, meaning it doesn't even reach the blockchain, it just "disappears". This is unfortunately a very common issue recently due to the network congestion on Solana. Adding priority fees to your transactions can help get your transaction prioritised over others but unfortunately due to how the priority fee system is structured on Solana this doesn't always work as intended.

If you want to get started you can check out my answer to this post here where I show how I add these priority fees to my instructions. If you have any questions feel free to ask.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.