i'm getting a weird signer error when running my tests;

Error: Signature verification failed.
Missing signature for public key [`6jAudYFBbfQS59oPNjYcMkqr9MqBf312T7oP6WSYRjsg`].

In this case, 6jAudYFBbfQS59oPNjYcMkqr9MqBf312T7oP6WSYRjsg is the state object's pubkey.

Here's the test code:

const state = anchor.web3.Keypair.generate()
await program.rpc.stake(
      new anchor.BN(5_000),
        accounts: {
          tokenProgram: TOKEN_PROGRAM_ID,
          stakeMint: stakeMintAddress,
          state: state.publicKey, // here
          stakeMintAuthority: stakePDA,
          programBeefTokenAccount: beefAccountPDA,
          userStakeTokenAccount: user.stakeTokenAccount,
          userBeefTokenAccount: user.beefTokenAccount,
          beefMint: beefMintAddress,
          userBeefTokenAccountAuthority: user.wallet,

Here's the instruction:

pub struct CreateBeefTokenAccount<'info> {
        payer = payer,
        seeds = [ BEEF_MINT_ADDRESS.parse::<Pubkey>().unwrap().as_ref() ],
        token::mint = beef_mint,
        token::authority = program_beef_token_account,
    pub program_beef_token_account: Account<'info, TokenAccount>,
        address = BEEF_MINT_ADDRESS.parse::<Pubkey>().unwrap(),
    pub beef_mint: Account<'info, Mint>,
    pub payer: Signer<'info>,
    pub system_program: Program<'info, System>,
    pub token_program: Program<'info, Token>,
    pub rent: Sysvar<'info, Rent>,
    #[account(init, payer = payer, space = 8+State::MAXIMUM_SIZE)]
    pub state: Account<'info, State>,

1 Answer 1


Looks like your state should be a PDA so that your program can sign for it.

This would like smth like this:

        seeds = [b"state".as_ref()],
        space = 8,
        payer = signer,

and in js you can then get the PDA like this:

const state = await PublicKey.findProgramAddress(

If you want to create the key yourself you need to sign for it Which would look something like this:

const transaction = await program.methods

  console.log("transaction", transaction);

  const txSig = await sendTransaction(transaction, connection,{
    signers: [state],
    skipPreflight: true
  } );

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.