I am trying to create a functionality where the admin can fund SPL tokens in the pool and any other user can claim from that pool.

I am using global authority as the authority for the pool address

pub struct CreateTweet<'info> {
    pub user: Signer<'info>,
    #[account(init, payer = user, seeds = [b"tweets", user.key().as_ref(), &[my_id as u8], &[my_id2 as u8]], bump, space = 64,)]
    pub tweetData: Account<'info, MyTweet>,
        seeds = [GLOBAL_AUTHORITY_SEED.as_ref()],
        bump = global_bump,
    pub global_authority: Account<'info, GlobalPool>,
        payer = user,
        seeds = [b"pool", user.key().as_ref(), tweetData.key().as_ref()],
        token::mint = pool_mint,
        token::authority = global_authority,
    pub pool: Account<'info, TokenAccount>,
    pub user_ata: Account<'info, TokenAccount>,
    pub pool_mint: Account<'info, Mint>,
    pub system_program: Program<'info, System>,
    pub token_program: Program<'info, Token>,
    pub rent: Sysvar<'info, Rent>,

this is my function where I am transferring SPL tokens from pool to user token account

    let seeds = &[GLOBAL_AUTHORITY_SEED.as_bytes(), &[global_bump]];
        let signer = &[&seeds[..]];

                token::Transfer {
                    from: ctx.accounts.pool.to_account_info(),
                    to: ctx.accounts.user_ata.to_account_info(),
                    authority: ctx.accounts.global_authority.to_account_info(),

But it is giving me an Error with code 0xbbf:

Error: #[msg("The given account is owned by a different program than expected")] AccountOwnedByWrongProgram

Also, the pool address is owned by the same address created with global authority seeds

Global authority address: https://explorer.solana.com/address/3Z3vN7UUoDcCWpYksnM5nj7BHgERQKhbKTEEXnnratk6?cluster=devnet

Pool (account) address: https://explorer.solana.com/address/FyJWLhuZase1mVpVraRHU6HBav9heHmS1Bu28NckRfSj?cluster=devnet

  • can you provide the context where you have initialized global_authority?
    – vicyyn
    Commented Aug 2, 2022 at 15:01

1 Answer 1


Your seeds for global_authority in the validator are [GLOBAL_AUTHORITY_SEED.as_ref()]. Your signer seeds are [GLOBAL_AUTHORITY_SEED.as_bytes()]. These don't match and that's why you're getting that error.

If you absolutely have to, here's to declare a constant you intend to use as one of the seeds of a PDA:

const GLOBAL_AUTHORITY_SEED: &[u8] = "global-authority".as_bytes();

and in your validator:

  • Switching as_bytes to as_ref it is giving error on compilation time: expected reference &[&[&[u8]]] found reference &[&[&[u8; 1]]; 1] also, have tried using as_byte on both sides. same results for me.
    – PenandWeb
    Commented Aug 1, 2022 at 9:49
  • What is your 'GLOBAL_AUTHORITY_SEED'?
    – Ademola
    Commented Aug 1, 2022 at 9:54
  • its string: pub const GLOBAL_AUTHORITY_SEED: &str = "global-authority";
    – PenandWeb
    Commented Aug 1, 2022 at 9:55
  • In that case your seeds should be [GLOBAL_AUTHORITY_SEED].as_bytes().as_ref()
    – Ademola
    Commented Aug 1, 2022 at 10:02
  • Just tried it ... but same error..!!
    – PenandWeb
    Commented Aug 1, 2022 at 10:34

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.