Questions tagged [pda]
The pda tag has no summary.
347 questions
2
votes
2
answers
139
views
How can I deserialize the account in the Rust fronted?
In my contract, it is:
use anchor_lang::prelude::*;
#[account]
#[derive(InitSpace)]
pub struct Proposal {
pub author: Pubkey,
#[max_len(32)]
pub evidence: String,
pub ...
1
vote
1
answer
33
views
IDL generation missing PDA seeds constraint for some accounts with init attribute
Desc
When an account uses both init and seeds constraints in Anchor, the generated IDL omits the pda field that should describe the seed derivation. This makes it impossible for client developers to ...
1
vote
2
answers
63
views
How to support 20,000 dynamic entries without paying full rent upfront on Solana?
I'm building a survey system that needs to store up to 20,000 encrypted responses (~5.8MB total). Each response is 288
bytes (256 encrypted data + 32 byte commitment).
What I want: Pay rent ...
2
votes
1
answer
54
views
Good practice to retrieve all PDAs of a program
My program is creating PDAs. I want to retrieve all of them. What would be the usual method if there is one:
getProgramAccounts + filter + set up my own RPC node (or use third party)
listen to the ...
1
vote
1
answer
56
views
Storing the bump vs Not storing the bump
I'm aware that storing the bump and using it for derivation saves CU.
However, we have to pay rent costs for storing the bump, correct?
Which leads me to the question, when is it worth it to store the ...
0
votes
2
answers
42
views
Error with "custom attribute panicked", becouse of 'message: Safety checks failed:'
error: custom attribute panicked
--> programs/token_launchpad/src/lib.rs:16:1
|
16 | #[program]
| ^^^^^^^^^^
|
= help: message: Safety checks failed:
/mnt/c/Users/...
0
votes
1
answer
223
views
How to extract mint, pool addresses and creator from Pump.fun migrate transaction?
I'm parsing Pump.fun migrate transactions with 24 accounts and need to extract the token mint and AMM pool addresses.
I've tried multiple methods but getting wrong addresses:
Method 1: Direct ...
3
votes
1
answer
110
views
What if I do try_borrow_mut_lamports()-=amount and do not add it anywhere , will the amount gets lost forever?
#[derive(Accounts)]
pub struct Withdraw<'info> {
// TODO: Add required accounts and constraints
#[account(mut)]
pub vault_authority: Signer<'info>,
#[account(mut,seeds=[b&...
2
votes
1
answer
110
views
My tokens went into an 'oncurve=false' account. Is this OK?
I minted 1B coin tokens with cointool app. I am not a programmer and that is why I used the app. I received them into a Phantom wallet. I sent 10 test tokens to a solflare wallet and received them, ...
2
votes
1
answer
58
views
PDA mismatch when calling update function
I create a PDA account using create_challenge function, join the challenge using join_challenge works fine, and then I call update function and get PDA mismatch error
error
error: SendTransactionError:...
4
votes
1
answer
261
views
How to find all PDAs before closing a program
Before closing a program, I want to know all its PDAs so I can transfer funds before closing it.
What's the best way to do it?
1
vote
2
answers
87
views
Why do scanners fail to detect locked liquidity in Solana CLMM pools owned by PDA-controlled NFTs?
Solana’s CLMM pools using PDAs and NFTs can lock liquidity in a way that is immutable— there’s no private key, no authority, no backdoor. It’s rock-solid.
Yet many scanners (like Jupiter, Raydium, ...
1
vote
1
answer
62
views
Use PDA owned ATA as input token source for token swap
I'm working on an app that allows users to create and join pools where they can contribute SOL (or any token), and the contributed SOL can be traded by the pool admin (pool admin can swap SOL for USDC,...
0
votes
1
answer
36
views
PDA migration issues
So I updated my program and then ran into the issue where the new program could no longer deserialize the old PDA data, since now I have a few more option fields and one I've removed as well. I do ...
0
votes
2
answers
75
views
invalid account data for instruction in custom program when I try create a PDA
When I try to create a PDA account on the program side, I get an error. I seem to be passing all the required accounts with the correct read-only/signed permissions, but this error still occurs:
Error:...
0
votes
1
answer
50
views
Cpi signer check failed. error
Error: AnchorError thrown in programs/system/src/invoke_cpi/verify_signer.rs:58. Error Code: CpiSignerCheckFailed. Error Number: 6002. Er
ror Message: Cpi signer check failed.
code - https://gist....
1
vote
2
answers
65
views
PDA account mismatch
I want to create a pda account from my program, but I am stuck with pda account generating mismatch.
this is my frontend test.ts code
const [groupPda, bump] = anchor.web3.PublicKey....
4
votes
2
answers
143
views
How to derive PDA in solana kit
How to derive a PDA address using the new solana kit library.
PublicKey.findProgramAddress(
[seed, seed],
programId
);
1
vote
0
answers
30
views
light protocol compressed PDA accounts
I have no experience in ZK can anyone explain what these function params are ?
proof: ValidityProof,
address_merkle_context: PackedAddressMerkleContext,
output_merkle_tree_index: u8,
use light_sdk::{
...
1
vote
1
answer
34
views
If all PDA seeds are available on-chain, why must it still be passed via the Ix Context?
In Solana programs, it’s common to use PDAs whose seeds come entirely from on-chain data — no user input involved. Since the program has access to all required seeds, it seems like it could simply ...
0
votes
1
answer
50
views
Invoke advanceNonce
Is it possible to invoke the advanceNonce instruction using an off-curve PDA signature? I would like a Solana program to have nonce Authority of a nonce account. Then the first instruction would ...
0
votes
1
answer
1k
views
How to Identify the Correct Fee Recipient Account for Pump.fun Buy and Sell Transactions on Solana?
I’m developing a script to perform manual buy and sell transactions on Pump.fun’s bonding curve (program ID: 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P) using the Solana blockchain. I’m struggling to ...
0
votes
2
answers
50
views
Where derive PDAs?
I'm new developing on Anchor. I have to know where is more common or best practices derived a PDA like the following.
I have a Event account with an collection_mint PDA and anyone can mint NFTs inside ...
2
votes
2
answers
69
views
How to enforce a PDA receives exactly a fixed amount of SOL on Solana?
I'm building a Solana program where I want a Program Derived Address (PDA) to receive exactly a fixed amount of SOL — no more and no less.
For example, the PDA should receive exactly 1 SOL. If someone ...
0
votes
1
answer
99
views
Token-2022 CLI Missing — Documentation Says It Exists but CLI Folder Is Gone
I’m trying to create a PDA-owned Token-2022 token account (aka a “vault”) to use in a vesting smart contract. I successfully did this two weeks ago, and I’m fairly certain I used spl-token-cli at the ...
0
votes
1
answer
45
views
Cannot Create Token-2022 PDA-Owned Token Account Using spl-token-cli — CLI Broken or Deprecated?
A couple of weeks ago, I was able to create a PDA-owned Token-2022 token account (a vault for a vesting contract). I believe I used spl-token-cli at the time. Now, I’m trying to repeat this, and every ...
0
votes
1
answer
22
views
Account Initialization error
Contract
Below is the voting contract from the BootCamp
#![allow(clippy::result_large_err)]
use std::process::Command;
use anchor_lang::prelude::*;
// declare_id!("...
2
votes
1
answer
41
views
How to tell if a token mint address is a PDA from my program?
In my program, users can create token mint derived from a seed and an argument input:
#[account(
init,
seeds = [
crate::USER_TOKEN_MINT_SEED.as_bytes(),
user_input_seed.as_bytes()...
2
votes
1
answer
216
views
Provided owner is not allowed, for MintTokens instruction, run second time
Trying token example from https://www.anchor-lang.com/docs/tokens/basics/mint-tokens, I get Error processing Instruction 0: Provided owner is not allowed, for the MintTokens instruction, when I run ...
1
vote
1
answer
114
views
Why Does My Solana Transaction Fail with "Signature Verification Failed" on a PDA?
I am working on a Solana program using Anchor that allows users to track their "hops." The program creates a Program Derived Address (PDA) for each user based on their public key. However, ...
1
vote
1
answer
39
views
Liquidity Pool PDA Fields Remain Default (11111111111111111111111111111111) Despite Successful Initialization in Anchor
I'm building a liquidity pool program with Anchor on Solana. I derive each pool's PDA using the token mint accounts as seeds, and I have two separate instructions: one (initialize_pda) that creates ...
0
votes
1
answer
42
views
Best Storage Strategy for a Solana Password Manager: Single PDA with Vec vs. Multiple PDAs?
I'm building a password manager on Solana where users can store encrypted credentials on-chain while keeping metadata (site, username, etc.) in a database.
Right now, I’m deciding between two storage ...
0
votes
0
answers
30
views
When does it makes sense to use fixed PDA per program and deploy Program every time for each new instance of state?
Context: For Solana smart contract development, we normally store state in PDA because the program is stateless. eg. For ERC20 token, you need to deploy a new contract for every token while for solana ...
0
votes
2
answers
95
views
What are System accounts? Can Program Derived Addresses be considered as System Accounts?
I am aware everything is Solana is an account but there are different designations of accounts on Solana. There are accounts that store programs which are system accounts. There are also PDAs which ...
0
votes
1
answer
47
views
Is this Solana address a PDA or a personal wallet? Can funds be withdrawn?
I am analyzing the Solana account BKuzP63i6NZ13opjVYKHAevK7PkyjPaT57bHgD4dCCMM, which holds a significant amount of liquidity. Initially, I assumed it was a Program Derived Address (PDA), but I later ...
0
votes
0
answers
37
views
Getting change updates for accounts that did not change
I was listening to Associated accounts changes owned by RaydiumV4 I noticed I am getting addresses with an accending pattern. I saved 3 snapshots as you notice below the addresses keep getting bigger, ...
0
votes
1
answer
43
views
What are the ways for accessing information stored in 'accounts'. do i always have to store the 'seeds' somewhere else like database
By looking at question you probably got that i am new to solana.
I am building a platform where, users can provide service and get compansated in tokens.
without going into much details following is ...
1
vote
1
answer
88
views
If a token account's mint authority is a PDA, then anyone can operate the token account?
(This is a follow up question to use newly created keypair as token account)
Say I've a program, which creates custom account escrow (which is PDA).
And in the program's initialize instruction:
It ...
0
votes
1
answer
58
views
use newly created keypair as token account
Say I created a mint A.
I have an account X, I derived a token address Xa using mint A and account X.
Now I want to transfer some token from Xa to another address.
Way 1: Usually I would do this:
...
0
votes
0
answers
30
views
anchor program withdraw method: invalid program argument
I'm trying to work with pda and cli, users wallet can make a deposit, and only the admin can withdraw.
deposit method works correctly, but withdraw returns the invalid program argument error.
I'm ...
2
votes
0
answers
32
views
What's the best way to ensure there's at most 1 "user" represented onchain per offchain user (ie Twitter uuid)?
I would like to guarantee that a program only creates 1 PDA representing a Twitter/X user. What's the best way to implement such uniqueness check so that there's exactly one-to-one mapping between ...
1
vote
0
answers
26
views
Mutable Data PDA breaks dependent PDA seed constraint in Anchor Bankrun tests
I've uncovered an issue in my TS tests using the Bankrun provider for Anchor. The problem occurs when a PDA’s seed is derived from a mutable account’s data field.
My program defines three instructions:...
2
votes
1
answer
118
views
Bankrun test fails to resolve PDA seeded by data from another account
I've uncovered an issue with the TypeScript tests using the Bankrun provider for Anchor when creating a PDA whose seed is derived from data inside another account. Here’s the setup:
Data PDA: An ...
0
votes
1
answer
160
views
Define PDA that belongs to other Program in Anchor
I want to define a PDA inside my anchor program, that will be expected as input from my receiving program via CPI.
The PDA should belong to another program (not the one where it is defined in):
#[...
1
vote
1
answer
58
views
Using a counter/increment as a seed input
going through a training workshop and we are building an escrow, I went off script a bit and was trying to incorporate a "counter" (0 +1, +2) as an input for generating the seed for our ...
1
vote
2
answers
53
views
Can your program's PDA sign CPI even if the owner is the system program?
Setup:
Say your program address is A
Your program has a PDA address derived from some seed at address B
B is the mint authority for one of the program tokens
Someone sends some SOL to B before your ...
1
vote
1
answer
177
views
What's the benefit of making owner of PDA "system program" vs "your program"?
This is a follow up question on this answer in a way.
Some programs seem to initialize some of their PDAs by sending SOL to it before it's manually created by the program so the owner is set to the ...
0
votes
1
answer
41
views
Can PDA be use as program id?
I would like to deploy a program to a specific address (aka Program ID).
Can any PDA be used as the Program ID? For example, if I derive some PDA off of the BPF Loader program (owner for programs) ...
0
votes
1
answer
45
views
Solana bootcamp project 9
I've finished my ninth project (Token Lottery) in the Solana bootcamp. In the first instruction, we created a PDA account (TokenLottery) using the following attributes:
We used this TokenLottery ...
1
vote
1
answer
33
views
Can a PDA account created in a program be allowed to use in another program to sign?
my program has It's PDA account to allow withdraw from the program. there is a spl-token account created from this admin PDA, and only whitelist users can withdraw spl-token by calling withdraw ...