I’m trying to verify a Solana transaction using the QuickNode RPC endpoint, but I’m getting the following error:
Starting verification process...
Amount: 0.001
Error during transaction verification: SolanaJSONRPCError: failed to get transaction: Transaction version (0) is not supported by the requesting client. Please try the request again with the following configuration parameter: "maxSupportedTransactionVersion": 0
at Connection.getParsedTransaction (D:[email protected]:7456:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async verifyDepositTransaction (file:///D:/Project1-proto/backend/utils/transaction.utils.js:19:25)
at async depositWithPhantom (file:///D:/Project1-proto/backend/controllers/transactions.controller.js:16:21)
Here is the code I’m using for verification:
export async function verifyDepositTransaction(pubkey, amount, signature) {
console.log('Starting verification process...');
console.log('Public Key:', pubkey);
console.log('Amount:', amount);
console.log('Signature:', signature);
const connection = new Connection(process.env.SOLANA_RPC_ENDPOINT, {
maxSupportedTransactionVersion: 0,
commitment: 'confirmed'
});
try {
const transaction = await connection.getParsedTransaction(signature, 'confirmed');
console.log('Fetched Transaction:', JSON.stringify(transaction, null, 2));
if (!transaction || !transaction.transaction || !transaction.transaction.message) {
console.error('Transaction not found or invalid format.');
return false;
}
const fromPubkey = new PublicKey(pubkey);
const toPubkey = new PublicKey(process.env.COMPANY_SOL_ADDRESS); // Replace with your company wallet address
const lamports = parseFloat(amount) * 1e9; // Convert SOL to lamports
console.log('From Public Key:', fromPubkey.toString());
console.log('To Public Key:', toPubkey.toString());
console.log('Lamports:', lamports);
const instructions = transaction.transaction.message.instructions;
// Ensure instructions array exists and is not empty
if (!instructions || instructions.length === 0) {
console.error('No instructions found in the transaction.');
return false;
}
console.log('Instructions found:', instructions.length);
// Iterate through the instructions to find a match
const isValid = instructions.some((instruction, index) => {
console.log(`Checking instruction ${index + 1} of ${instructions.length}`);
console.log('Instruction:', JSON.stringify(instruction, null, 2));
if (!instruction || !instruction.programId || !instruction.parsed) {
console.error('Instruction is missing required fields.');
return false;
}
const parsedInfo = instruction.parsed.info;
// Check that the program ID is SystemProgram, and the sender and receiver addresses match
const matches = instruction.programId.equals(SystemProgram.programId) &&
parsedInfo.source === fromPubkey.toString() &&
parsedInfo.destination === toPubkey.toString() &&
parsedInfo.lamports === lamports;
console.log('Instruction match result:', matches);
return matches;
});
console.log('Transaction validation result:', isValid);
return isValid;
} catch (error) {
console.error('Error during transaction verification:', error);
return false;
}
}
I am getting this error which is really irritating , asked every AI about it and got no solution . The RPC endpoint I am using is of Quiknode . My solana library is up to date so that’s not the root of the error . Fingers crossed :).