Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

440
Vistas
Instruction 0: incorrect program id for instruction. Works on devnet but not mainnet

I am trying to make a spl-token transfer from a user wallet. The code below works perfectly on the devnet but throws Transaction simulation failed: Error processing Instruction 0: incorrect program id for instruction . It creates an associated token account but fails on instruction. How would the program id be incorrect if solana's token program id never changes? Any help would be appreciated.

let mint = new web3.PublicKey(mintAccount)
let toWallet = new web3.PublicKey("ADDRESS")
let owner = new web3.PublicKey(fromWallet.publicKey)
const createTransaction = async (mint, minerWallet, owner) => {

  const transaction = new web3.Transaction()
 
  const destinationAccount = await splToken.Token.getAssociatedTokenAddress(
    splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
    splToken.TOKEN_PROGRAM_ID,
    mint,
    toWallet,
    false
  )

  const sourceAccount = await splToken.Token.getAssociatedTokenAddress(
    splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
    splToken.TOKEN_PROGRAM_ID,
    mint,
    owner,
    false
  )

  console.log("sending from " + sourceAccount.toBase58() + "to " + destinationAccount.toBase58())

  transaction.feePayer = fromWallet.publicKey

  let blockhashObj = await connection.getRecentBlockhash();
  transaction.recentBlockhash = blockhashObj.blockhash;
  
  let signature = '';
try {
   
    const destinationAccountInfo = await connection.getAccountInfo(destinationAccount)
    const destTokenAccountMissing = !destinationAccountInfo
    if (destTokenAccountMissing) {
      console.log("creating token account cuz it needs one")
      transaction.add(
        splToken.Token.createAssociatedTokenAccountInstruction(
          splToken.ASSOCIATED_TOKEN_PROGRAM_ID, // always associated token program id
          splToken.TOKEN_PROGRAM_ID, // always token program id
          mint, // mint (which we used to calculate ata)
          destinationAccount, // the ata we calcualted early
          toWallet, // token account owner (which we used to calculate ata)
          fromWallet.publicKey // payer, fund account, like SystemProgram.createAccount's from
        )
      );
    }

  transaction.add(
      splToken.Token.createTransferInstruction(
        splToken.TOKEN_PROGRAM_ID,
        sourceAccount,
        destinationAccount,
        fromWallet.publicKey,
        [],
        1
      )
    )
    
  signature = await sendTransaction(transaction, connection);
  console.log('info', 'Transaction sent:', signature)

  await connection.confirmTransaction(signature, 'processed');
  console.log('success', 'Transaction successful!', signature);
  return true
  
} catch (error) {
  console.log('error', `Transaction failed! ${error?.message}`, signature);
  return false
}

}

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

IncorrectProgramId from the token program means that the owner of the account wasn't the expected spl-token program.

In your case, it might be that sourceAccount hasn't been created on mainnet yet.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Make sure the program id in your lib.rs (if you're using Anchor) is correct, and that this program id matches the one provided in Anchor.toml.

Also print the program-id in your provider to cross-check that your Typescript frontend actually uses the right program.

If you use the anchor framework, you can get the program-idea (to be inserted in all the spots mentioned above!), by running solana-address -k target/deploy/program-keypair.json from within the directory where your Anchor.toml is stored.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda