Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught (in promise) Error: Transaction fee payer required

I get this error when I try to execute this using phantom wallet and react app


  const transferTransaction = new Transaction()
  .add(SystemProgram.transfer({
    fromPubkey: alice.publicKey,
    toPubkey: feePayer.publicKey,
    lamports: lamportsToSend
  }))
  
  const network = "https://api.devnet.solana.com";
const connection = new Connection(network);
const transaction = new Transaction();
transferTransaction.recentBlockhash = (await connection.getRecentBlockhash()).blockhash;

const { signature } = await window.solana.signAndSendTransaction(transferTransaction);
await connection.confirmTransaction(signature);

enter image description here

like image 812
Amir Alam Avatar asked Sep 11 '25 08:09

Amir Alam


1 Answers

transferTransaction.feePayer = alice.publicKey

like image 87
Sorin Hadjiu Avatar answered Sep 13 '25 00:09

Sorin Hadjiu