Questions tagged [pda]
The pda tag has no usage guidance.
182
questions
1
vote
1
answer
16
views
Is there a way I can use find_program_address used to derive a PDA as an anchor constraint
Suppose I have a PDA that is supposed to be initialized by calling a CPI in my program and I want to validate that the account is valid, is there a way I could add a check to make sure that the ...
0
votes
1
answer
38
views
How to store signatures in a pda and invoke an instruction with signatures
I want to create a program influenced by multisig structure.
There will be multiple types of instructions that require two parties to sign each transaction. Here's what I have in my mind:
There will ...
1
vote
2
answers
37
views
How to give authority of PDA to another program
I have two programs.
// program one
#[derive(Accounts)]
pub struct MyContext<'info> {
...
#[account(mut)]
pub pda_in_prog_1: PDA_ONE<'info, T>,
pub system_program: Program<'...
0
votes
1
answer
38
views
Error: Signature verification failed while initialising PDA
I've been working on Solana program that should hold two different tokens for me in a Vault in an ATA. The first token should be deposited during Vault initialisation, the second will be deposited by ...
0
votes
1
answer
17
views
Anchor IDL type for structs
I'm trying to fetch a PDA account and use one of it's properties as a seed for another PDA account. Here's what the implementation looks like:
const [ registryPDA, registryBump ] = PublicKey....
0
votes
0
answers
15
views
nft delegate confusion (metaplex token metadata)
I'm trying to delegate an pnft to a pda.
but I keep getting incorrect account owner.
I can't for the life of me know how the account owner is incorrect. and what the delegate field in the ...
0
votes
1
answer
23
views
Storing directed acyclic graphs effectively in PDAs
I’m trying to implement a directed acyclic graph structure where each node and it’s related path’s are stored in different pda’s. I need to add security checks so that users can’t try to make a child ...
0
votes
1
answer
41
views
Failed to reallocate account data
I want to create a PDA account to store data about participants' wallet addresses and their deposit amounts. I have used a PDA account to store this information. It works fine when I set the array ...
2
votes
3
answers
70
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 ...
0
votes
1
answer
27
views
Can we derive PDAs inside a solana program?
Is there any function to generate PDAs using seeds manually?
I dont want to create PDAs using client modules but I want to create PDAs inside the rust functions in the contract/program.
Is there a way ...
0
votes
1
answer
20
views
Error: ELF error from deploying an anchor project
I have been trying to deploy my anchor project on the local net. I started by running solana-test-validator and then anchor deploy but I keep receiving this error:
Error: ELF error: ELF error: ...
0
votes
0
answers
29
views
How can I dynamically increase storage space for a program deployed on Solana using Solang?
I have a program that utilizes arrays and mappings, potentially requiring significant storage space.
Is there a mechanism to dynamically augment the storage space of the account that deployed the ...
1
vote
2
answers
78
views
What is responsbile for finding PDAs?
In the solana developer docs for PDAs
I think this like might be a little misleading
If this occurs a different set of seeds or a seed bump (additional 8 bit seed) can be used to find a valid program ...
0
votes
1
answer
32
views
How can i enter a Vac<PubKey> in the solana play ground?
I want to enter a Vec as input But i can't do that i don't know what is wrong !
0
votes
1
answer
37
views
How to fetch PDA data on a TS client
I am trying to read the data on an pda account like so
let pdaData = awaitprogram.account.PdaAccount.fetch(pdaAccount);
But I am getting this error
TypeError: Cannot read properties of undefined (...
3
votes
1
answer
154
views
What sets the data type sizes for Solana accounts?
Looking through examples like Soldev, one sees PDAs sizes calculated using code like:
pub fn get_account_size(title: String, description: String) -> usize {
return (4 + MovieAccountState::...
2
votes
2
answers
109
views
How can I transfer SOL using programs and PDA's with native rust?
Hey I try to create a basic program which takes and manages sol for users.
Something like the weth contract on ethereum.
The program just needs to store the SOL and under some conditions users will be ...
3
votes
1
answer
76
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()...
4
votes
2
answers
130
views
Anchor Realloc PDA
I am trying to write a program that:
a) Creates an account (state) if one does not already exist
b) Reallocs as needed for changed state
Error
Error: Account allocation failed: RPC response error -...
1
vote
2
answers
114
views
Is there a way to overwrite data in an account?
I have a PDA account, and I am trying to change the data format in the account.
from this
#[account]
pub dummy_data {
x_point: f32
}
to
#[account]
pub dummy_data {
x_point: u64,
y_point: f64,
...
2
votes
1
answer
44
views
What combination of program address and seeds would cause `findProgramAddress` to fail to find an off-curve point?
The findProgramAddress method iteratively searches for an off-curve point for a given combination of program address and seeds. Whenever the user-supplied combination of program address and seeds ...
3
votes
1
answer
48
views
Cannot find cause of "seeds constraint was violated" error
Based on Solana cookbook, PDA is derived from program ID and seeds.
There's no possibility that program ID is different, so I thought maybe there's mistype in seeds.
I checked over 30 times seeing ...
4
votes
2
answers
142
views
Can I create an ATA of PDA account?
I get this error:
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [2]",
"Program log: Create",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]...
0
votes
1
answer
31
views
InstructionError: [ 0, 'ComputationalBudgetExceeded' ] Program failed to complete
//lib.rs code
use anchor_lang::prelude::*;
pub mod mint;
pub mod sell;
//pub mod swap;
use mint::*;
use sell::*;
//use swap::*;
declare_id!("H5sYvvHMEVSJb2QEwrhCmxGKsMHuntiWz3bmVfxUcBnt")...
2
votes
1
answer
41
views
index.js:72 Uncaught (in promise) Error: Account does not exist BoFCbRsR9PYZTUx7KVbJ2UfpbPyCv6qZ2sjHzf4ouoQb
The front end is below
const newVideo = async () => {
console.log("New Video Module")
//const wallet = useWallet()
let [state_pda] = await anchor.web3.PublicKey.findProgramAddress(
[utf8....
4
votes
1
answer
286
views
anchor init PDA => result = error : Instruction passed to inner instruction is too large
i'm stucked at something i've done many many times, and i don't get the problem.
I want to init a PDA, i use the following code :
#[account( init, payer = owner, seeds = [METADATA_ACCOUNT_PREFIX....
0
votes
3
answers
54
views
Reintialize Solana PDA
So I had this account as a PDA and used this account Program as Signers, and it was working fine you can see the transaction history and then suddenly I'm getting Signature verification failed error ...
2
votes
1
answer
65
views
I can't figure out why this transaction simulation is failing
I'm working on a simple proof of concept guessing game like Clue, written in Anchor Lang, and I'm having trouble getting one of my transactions to work correctly.
Here is the code in question:
// lib....
0
votes
0
answers
57
views
How do I transfer SOL from a PDA account to a user's wallet?
I'm now developing on solana blockchain. I want to users can deposit and refund their sol on my pool. create_pool works well it means users can deposit their sol to my pool.
but cancel_pool error. ...
2
votes
1
answer
90
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&...
0
votes
2
answers
251
views
Can we use pda as signer and payer to create an account in any solana program
I have asked same kind of question earlier but not got proper answer.
As I got an answer in my previous question in which I have to use system owned pda account, I have also tried this but getting ...
2
votes
1
answer
89
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 ...
1
vote
1
answer
70
views
How multiple accounts can sign transaction in PDA CPI
How can multiple accounts can sign transaction along with PDA ?
In PDA based CPI in which PDA signs transactions, how can we use multiple accounts as a signers ?
I have to create an account in callee ...
0
votes
1
answer
36
views
I'm facing custom program error: 0x0 when try to derivated a PDA with custom seeds
I'm facing an issue in my instruction trying to generate a PDA from a string and user.key(), just like in the PDA Anchor tutorial. I tried it in various ways and still, I get the same error:
Error: ...
1
vote
1
answer
45
views
Best practise on writing tests for PDAs with static seeds
I usually write my tests and run them against a local validator using
solana-test-validator in a terminal and then is use anchor test --skip-local-validator.
Like this I can look at the transactions ...
1
vote
1
answer
50
views
Nested vector in PDA account not being properly serialized
I am creating a PDA account that stores a string and a vector. Inside this vector, there is another vector. This is the structure of my account:
#[account]
pub struct Monster {
pub seed : ...
0
votes
0
answers
43
views
i got this error: Signature verification failed
here is my program: https://beta.solpg.io/642c297867edfe0f00106a00
and here is my code:
const anchor = require('@project-serum/anchor')
const { web3 } = anchor
const { SystemProgram } = web3
const ...
2
votes
1
answer
63
views
Solana approve via signature
I wonder if there's a mechanism of transferring assets with receiver fee payment. Something like permit functions in solidity language?
Is it possible to copy this approach with PDAs? Share some ...
0
votes
0
answers
263
views
Transaction simulation failed: This account may not be used to pay transaction fees using Solana CLI
I am getting this error using "solana transfer" at the command line. "solana address," and "solana balance" both work fine, so it seems like the wallet is properly ...
0
votes
0
answers
79
views
Cross-program invocation: Signer privilege escalated
Thanks ATON for viewing the problem, I need URGENT help on this if possible.
I have created a PDA and used the PDA to freeze an NFT.
#[account(init,
payer=bidder,
seeds = [
bidder.key()....
0
votes
2
answers
74
views
Is it secure to store tokens in smart contract PDA account so that contract will send these tokens based on some rules?
I would like to send spl-token to smart contract pda account, so that It will be helpful for me to transfer tokens to destination address based on conditions provided in smart contract, with out the ...
1
vote
1
answer
45
views
Is there way to differentiate accounts from pdas?
Out of curiosity, I was wondering if there was a way to tell just by looking at the address, if one can tell if the address is a data account or a pda instead.
I'm personally having a hard time ...
3
votes
2
answers
50
views
solana pda clarification
Youtube solana pda
I've been watching this tutorial for a while trying to build that muscle memory and replicate the code as I understand the concepts, the rust side is not that difficult, maybe when ...
1
vote
1
answer
33
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 ...
0
votes
1
answer
42
views
native invoke_signed create_account pda: writable privilege escalated [closed]
i'm thinking the client can't create my pda state_account since only the program can sign for it, but i must be missing something. my native excerpt:
let state_account = next_account_info(...
4
votes
1
answer
231
views
Do Empty System Accounts require initialization before receiving SOL?
When I transfer SOL from my wallet to a PDA (~1000 Lamports). I get
Transaction simulation failed: Transaction results in an account (2) without insufficient funds for rent
Do I need to initialize my ...
4
votes
1
answer
50
views
I'm trying to initialize my accounts and the tx goes through but it says the account doesn't exist when i retrieve info from it
Essentially all the lists are the same, but when I call the bluelist account I get
"Error: Account does not exist HkBnFqgNQfWisvKkDwSbUzE2EJ3jriQHY64H4t3EjjeM"
this error happens on every ...
2
votes
1
answer
59
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.
#[...
3
votes
2
answers
324
views
Determine if a key is an associated token account
If I am given an arbitrary Solana public key without any transactions associated to it, is there a way I can determine if this is a normal account or an ATA?
My initial approach would be to see if it ...
2
votes
1
answer
251
views
How to initialize a PDA mint in anchor
I'm looking to create a mint as PDA in anchor. In this case, the mint will be able to mint tokens.