1

i'm making some experiments with jito, i'm searching on jito discord i see that people are having trouble landing bundles. The rpc response is OK, but the bundle shows as invalid. Tried with 0.1 sol but not sure if i'm missing anything?

const jito_tip_1 = new PublicKey("HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe");

const tipAmount = 1020000;

async function sendBundle(transaction:Transaction[]): Promise<string> {
let serializedTransactions = [];

for (const tx of transaction) {
  serializedTransactions.push(bs58.encode(tx.serialize()))
}
const requestBody = {
  jsonrpc: "2.0",
  id: 1,
  method: "sendBundle",
  params: [serializedTransactions],
};

console.log('Sending bundle with request body:', JSON.stringify(requestBody, null, 
2));

const response = await fetch('https://mainnet.block-engine.jito.wtf/api/v1/bundles', 
{
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify(requestBody),
});

if (!response.ok) {
  const errorText = await response.text();
  throw new Error(`Failed to send bundle: ${response.statusText} - ${errorText}`);
}

const data = await response.json();
if (!data || !data.result) {
  throw new Error('Failed to send bundle');
}
console.log('data.resultado sendbundle :', data)
return data.result;
}



 async function checkBundleStatus(bundleId: string): Promise<any> {
 const requestBody = {
 jsonrpc: "2.0",
 id: 1,
 method: "getBundleStatuses",
 params: [[bundleId]],
 };

console.log('Checking bundle status with request body:', JSON.stringify(requestBody, 
null, 2));


const response = await fetch('https://mainnet.block-engine.jito.wtf/api/v1/bundles', 
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(requestBody),
});

 //console.log('Checking bundle status with response body:', JSON.stringify(response, 
 null, 2));
 //console.log('resposta check bundle', response )

if (!response.ok) {
  const errorText = await response.text();
  throw new Error(`Failed to check bundle status: ${response.statusText} - 
${errorText}`);
 }

const data = await response.json();
if (!data || !data.result) {
  throw new Error('Failed to check bundle status');
}
console.log('data.resultado checkbundle :', data)
return data.result;
}

async function getInflightBundleStatuses(bundleId: string): Promise<any> {
const requestBody = {
  jsonrpc: "2.0",
  id: 1,
  method: "getInflightBundleStatuses",
  params: [[bundleId]],
};

console.log('Checking bundle status with request body:', JSON.stringify(requestBody, 
null, 2));


 const response = await fetch('https://mainnet.block-engine.jito.wtf/api/v1/bundles', 
{
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify(requestBody),
});


if (!response.ok) {
  const errorText = await response.text();
  throw new Error(`Failed to check bundle status: ${response.statusText} - 
${errorText}`);
}

const data = await response.json();
if (!data || !data.result) {
  throw new Error('Failed to check bundle status');
}
console.log('data.resultado getInflightBundleStatuses :', data.result.value)
return data.result;
}

(async () => {
try {
    const transaction = new Transaction().add(
        SystemProgram.transfer({
            fromPubkey: from.publicKey,
            toPubkey:  to,
            lamports: LAMPORTS_PER_SOL/100000,
        })
    );
    transaction.recentBlockhash = (await 
  connection.getLatestBlockhash('confirmed')).blockhash;
    transaction.feePayer = from.publicKey;
    
    transaction.sign(from);

    const transaction_jito = new Transaction().add(
        SystemProgram.transfer({
            fromPubkey: from.publicKey,
            toPubkey:  to,
            lamports: LAMPORTS_PER_SOL/100000,
        }),
        SystemProgram.transfer({
            fromPubkey: from.publicKey,
            toPubkey:  jito_tip_1,
            lamports: tipAmount,
        })
    );
    transaction_jito.recentBlockhash = (await 
   connection.getLatestBlockhash('confirmed')).blockhash;
    transaction_jito.feePayer = from.publicKey;
    
    transaction_jito.sign(from);            

    const bundleId = await sendBundle([transaction, transaction_jito]); 
    const InflightBundleStatuses = await getInflightBundleStatuses(bundleId);
    const bundleStatus = await checkBundleStatus(bundleId); 
} catch(e) {
    console.error(`Oops, something went wrong: ${e}`)
}
})();

3 Answers 3

2

When you get the bundle status immediately after sending it, it will be Invalid until it reached the Jito system. You might want to keep calling getInflightBundleStatuses until you get a status Failed or Landed. Also check if previous bundles actually landed on-chain?

P.S. I think you're using LAMPORTS_PER_SOL the wrong way. It should be lamports = ui_amount * LAMPORTS_PER_SOL

0

Fixed by changing the endpoint to any valid endpoint from:
https://jito-labs.gitbook.io/mev/searcher-resources/block-engine/mainnet-addresses

Example: https://amsterdam.mainnet.block-engine.jito.wtf/api/v1/bundles

instead of : https://mainnet.block-engine.jito.wtf/api/v1/bundles

0

cab you share please the code you are using to send the bundle i wrote one in py but having issues submitting i get this error

Detailed error response: {"jsonrpc":"2.0","error":{"code":-32602,"message":"Bundles must write lock at least one tip account to be eligible for the auction.","data":null},"id":1}

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.