Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
1 answer
23 views

Can Other Programs Write to PDA Accounts even if the `Account` type is used and the ownership is checked?

Question: Ownership and Write Permissions for PDA Accounts in Solana Programs I’ve been exploring how the #[account] macro in the Anchor framework interacts with the ownership model of PDA accounts, ...
castle_chain's user avatar
0 votes
1 answer
27 views

How do I allow two different signers to modify data in a PDA?

I'm trying to understand PDAs and ultimately want to be able to have a game where two different players (each with their own wallet) can modify the game state individually (i.e. one signer). For this ...
0xwtf's user avatar
  • 3
3 votes
3 answers
321 views

Extending struct fields in a PDA and ensuring compatibility

I need to extend the fields I have within a PDA. Some accounts are already live, so I want those to still be compatible with the new layout. As a simple illustrative example, consider this account ...
mega_creamery's user avatar
3 votes
1 answer
353 views

How do you repopen a closed account?

If an account has been closed with the following anchor context: #[account( mut, close = user, seeds = [ SEED_SCHEMA.as_bytes(), &user.key().as_ref()...
mega_creamery's user avatar
3 votes
1 answer
346 views

"Error processing Instruction 0: invalid program argument" while invoking method of other program using cpi

The callee program #[program] pub mod puppet { use super::*; pub fn initialize(_ctx: Context<Initialize>) -> Result<()> { Ok(()) } pub fn set_data(ctx: Context&...
SolDev's user avatar
  • 33
2 votes
1 answer
317 views

How to create an account in any other program using CPI in which PDA is used as signer and payer

I just want to invoke initialize method of callee program from caller program in which pda account should be signer. Callee Program #[program] mod callee { use super::*; // I want to call ...
Panchal Vedant's user avatar
1 vote
1 answer
54 views

derive correct account inside a different anchor context

Let's say I have this CampaignCount account: #[account] pub struct CampaignCount { // I keep track of how many campaigns I have so far pub id: u32, } Imagine I need to refer to this in the ...
Yilmaz's user avatar
  • 1,264
2 votes
1 answer
133 views

Is it bad practice to have instruction parameters as a part of the PDA seed?

Let us suppose I have made a design, where I would be able to derive the PDA just by knowing the ID. So I have made a PDA that uses the inputted instruction ID parameter as a part of the seed. #[...
Burger Bob's user avatar
  • 1,506
1 vote
3 answers
146 views

How much of a PDA can a program control

How much of a PDA is under the control of its owner program? For example, could the program block the account from signing certain instructions on transactions? Or could the program add a fee to every ...
Pixeled's user avatar
  • 486
5 votes
2 answers
2k views

How do I fix 'please minimize large stack variables' error while testing my anchor program?

I'm getting the following error using Anchor 0.25.0 Stack offset of 11792 exceeded max offset of 4096 by 7696 bytes, please minimize large stack variables initializing my accounts on local testing. I'...
AceGravity's user avatar
1 vote
2 answers
61 views

How likely is it that no bump will be found when searching for a PDA given some seeds and program_id?

The rust docs outline that The processes of finding a valid program address is by trial and error, and even though it is deterministic given a set of inputs it can take a variable amount of time to ...
Chris Rock's user avatar
3 votes
1 answer
2k views

How to close a PDA account?

#[account( init, seeds = [ b"config".as_ref(), mint.key().as_ref(), ], bump, payer = sender, space = 90 ...
Abhishek Faliya's user avatar
5 votes
3 answers
658 views

how to fetch list of all pda accounts in frontend? like sale account instance to display in the market? or should i be fetching from token account?

i have a sale order account defined like this.. #[account] pub struct Order { pub creator: Pubkey, pub mint_key: Pubkey, pub memo: String, pub price: u64, pub bump: u8, } And this ...
Lobo1897's user avatar
  • 153
1 vote
1 answer
97 views

Can I read information stored by a PDA without having to deserialize its byte array?

here is my on-chain code to create the PDA account #[derive(Accounts)] pub struct Initialize<'info> { #[account(init, payer = user, space = 20 , seeds = [user.key().as_ref()], bump)] ...
coco's user avatar
  • 83
3 votes
0 answers
139 views

Is it possible to use conditional seed for PDA creation?

So, the two endpoints I am using are almost identical, the only difference being the seed used in the creation of PDA for each of the accounts. I will start with the abstract of my program: First of ...
0xShuk's user avatar
  • 1,991