Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 660
2 votes

findProgramAddress() is not returning the original address created even though I'm using the...

I would recommend not using createWithSeed at all for creating PDAs, since createWithSeed does not guarantee the resulting Pubkey is off the curve. So (in theory) it could be someone's wallet and they …
AllBlooming's user avatar
  • 2,309
7 votes
Accepted

How can I delete all PDA accounts for my program (anchor)?

Here's an example from my own code, closing my Counts PDA: #[derive(Accounts)] #[instruction(countsbump: u8)] pub struct CloseCounts<'info> { #[account(mut)] pub user: Signer<'info>, #[account … So there is "countsv1", "countsv2", ... for the seed of my Counts PDA. I put it in a constant named COUNTSSEED, so I have to increase it only in one place. …
AllBlooming's user avatar
  • 2,309
4 votes
Accepted

What stops malicious clients from using PDAs in a series of CPIs with anchor?

Every PDA is derived from one Program, whose programID is part of the seed. So let's say PDAaUW is derived from ProgramA and a user wallet's public key. … There might be another PDA, let's call it PDAbUW, which derived from ProgramB and some user wallet's seed. Then ONLY ProgramB can access PDAb for writing. …
AllBlooming's user avatar
  • 2,309
1 vote
Accepted

"error: ... An account required by the instruction is missing" when issuing create_metadata_...

I found the answer after some experimenting. I need to pass another account in the context, namely the metadata_program_id. So the new code for invoke_signed is: invoke_signed( &ix …
AllBlooming's user avatar
  • 2,309
3 votes

Transaction does not show amount

It seems you're transferring from a PDA (i.e. not from the wallet the user has selected in Phantom) to some other account roomEscrow, which also seems to be not the account the user has selected in Phantom …
AllBlooming's user avatar
  • 2,309
3 votes

Issue, transfer SOL via CPI call

Your struct PullStrings<'info> needs to list the receiver ("to" account). Then, in the code for pull_strings, you need to add the receiver account to the CPI call, calling set_data. Then in the code f …
AllBlooming's user avatar
  • 2,309
3 votes

how to fetch list of all pda accounts in frontend? like sale account instance to display in ...

You can either keep track of which PDAs you created in a separate "bookkeeping" PDA that you update within your CreateOrder instruction. … Then, in your client, you can just read the bookkeeping PDA and display the info you want to show. …
AllBlooming's user avatar
  • 2,309
2 votes
Accepted

How to sign with PDAs

I'm not sure what exactly you mean by "signing PDA". A PDA is a program-derived address that by definition is off the cure, so it doesn't have a private key and therefor cannot sign anything. … However, the cool thing about PDAs is that the program that the PDA is derived from can use invoke_signed which will then be handled by the Solana runtime as if the PDA had signed the transaction. …
AllBlooming's user avatar
  • 2,309