Skip to main content

Questions tagged [pda]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
10 views

Can PDA sign TXs from the client, not via invoke_signed?

I'm a beginner in Rust & Solana. Currently trying to create OpenBook -> migrate a token to a Raydium. Problem: migration_vault which stores all liquidity for migration is PDA. I need to create ...
a16gems's user avatar
0 votes
0 answers
9 views

Economic viability of social dApps with Solana

I've been diving into the web3 scene lately, starting with the Ethereum ecosystem. But since I'm a Rust developer first and foremost, Solana was an obvious choice to look into. I like it so far, ...
noob's user avatar
  • 1
0 votes
1 answer
18 views

Problem with testing pda contract

ive tried everything and the code that im trying to deploy for the test is not working... This is the lib.rs: #![allow(clippy::result_large_err)] use anchor_lang::prelude::*; declare_id!("...
user29899's user avatar
0 votes
1 answer
24 views

Why is my PDA derivation mismatching between client-side and runtime on Solana?

I'm developing a Solana dApp and encountering an issue where the Program Derived Address (PDA) computed in my JavaScript client does not match the PDA derived during program execution in Rust, ...
Dawit Tilahun Davatron's user avatar
0 votes
1 answer
35 views

Token CPI without signature from PDA works unexpectedly?

In my app I have 2 programs: Program A which owns "Beastie" PDAs and calls program B, with the Beastie PDA as a signer. Program B which creates a token approval from the Beastie to another ...
Scott's user avatar
  • 101
0 votes
0 answers
20 views

Created Todo: Error Message: A seeds constraint was violated

Anchor code #[derive(Accounts)] #[instruction(todo_index: u8)] // Added this to pass the index as an instruction argument pub struct CreateTodo<'info> { #[account(mut)] pub authority: ...
pranay raj's user avatar
1 vote
1 answer
23 views

How to call up an anchor program that has a pda using cpi

There was another question here that was similar but it didn't give a code answer. Let's say anchor program A is the one being called and has an initialise function that initialises a pda that it uses ...
Anon's user avatar
  • 13
1 vote
1 answer
19 views

Are there any risks with the PDA account generate with the hash function?

I currently have a PDA account with the following structure: #[derive(AnchorSerialize, AnchorDeserialize)] pub struct NewFoo { pub foo_id: String, } #[derive(Accounts)] #[instruction(new_foo: ...
zzm's user avatar
  • 111
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
1 vote
2 answers
35 views

How to Calculate Space for PDA Accounts with Dynamic Vectors in Solana?

I am working on a NFT staking program. I need to create a PDA account with a structure that includes a dynamic Vec. Here's the structure: #[account] pub struct UserNftStakeAccount { pub user: ...
0xfiraterdem's user avatar
1 vote
1 answer
21 views

Passing PDA seeds and bump to sol_invoke_signed_c syscall in solana_nostd_entrypoint environment: missing required signature for instruction

Before: There seemed to be a lack of solana nostd entrypoint documentation, I couldn't find any good resources. I made solana program using solana_nostd_entrypoint. I want to create PDA account using ...
toygr's user avatar
  • 190
1 vote
0 answers
11 views

Formatting seed for PDA

#[derive(Accounts)] #[instruction(message: String)] pub struct CreateImmortaliseMeAccount<'info> { // Account for creating an ImmortaliseMe account #[account( init, space=...
William Shirley's user avatar
0 votes
0 answers
17 views

Signature verification failed. Missing signature for public key(s) [key1, key2] in jest test using anchor

test : import * as anchor from "@coral-xyz/anchor"; import { Program } from "@coral-xyz/anchor"; import { RoyaltyNft } from "../target/types/royalty_nft"; import { ...
Anurag Verma's user avatar
1 vote
0 answers
20 views

Best way to go about vanity PDAs?

The most obvious idea to me is taking a seed as a parameter and grinding it off-chain to find whatever prefix/suffix you want, then submitting whatever seed + bump combination you found through the ...
billyjean's user avatar
2 votes
1 answer
20 views

PDA takes ~10s to upate even after tx is confirmed

I have been using anchor programs before , In those programs i could send multiple transactions back to back and the pda are reflected correct in every transactions. But since then i started creating ...
Abhishek Faliya's user avatar
0 votes
1 answer
16 views

How to specify PDA owned by different program in anchor?

Specifying a PDA can easily be done by the following: #[account( seeds = [MY_FST_SEED, MY_SND_SEED], bump )] pub my_account: Account<'info, MyCoolAccount>, This makes the PDA be derived ...
McBain's user avatar
  • 5,384
0 votes
2 answers
48 views

Best to have PDA own a System Account or be the System Account to move SOL tokens?

What would be the considerations for choosing between the following? A) Using a PDA (that is a System Account type) to receive and send SOL tokens on behalf of User A B) Using a PDA that owns a System ...
juic3n's user avatar
  • 115
0 votes
2 answers
29 views

How do I verify if a PDA is belonging to the payer? (without Anchor)

I'm passing two accounts to my program: a payer account and a PDA. The PDA should be derived from the payer address. How do I verify it inside the program? Without Anchor.
krokodyl's user avatar
0 votes
2 answers
67 views

Facing "Transaction simulation failed: Error processing Instruction with unauthorized signer or writable account" error in Solana Anchor program

I'm working on a Solana program using the Anchor framework. The program implements a simple counter that can be incremented or decremented by a user. The program compiles and deploys successfully, but ...
0xfiraterdem's user avatar
2 votes
1 answer
35 views

Can I reclaim SOL from PDA after I accidently close the program?

I deployed solana program and used it. After that, I wanted to close that program and redeploy to another address. So I closed program. But I forgot to reclaim SOL from the PDA associated with the ...
toygr's user avatar
  • 190
0 votes
0 answers
22 views

`createWithSeed` vs using a PDA with f`indProgramAddress`

In what situations would I want to use createWithSeed function vs deriving a PDA address. Why do the two generate different addresses const programId = new PublicKey("...
Jimii's user avatar
  • 7,672
1 vote
1 answer
41 views

A seeds constraint was violated. Can't find matched PDAs

Currently find issue when find PDAs for this code, basically i am using the the 1. static string "version" 2. publickey of PDA of case 3. the latest_version_id of case as elements of seeds ...
Chester H's user avatar
1 vote
1 answer
16 views

Make mint authority the program itself

Is there any possibility to make the program be the mint authority for a mint. I thought about making: mint authority -> PDA derived from programid That would mean that to mint, only the program ...
Mr.H's user avatar
  • 117
1 vote
1 answer
25 views

Cross-program invocation with unauthorized signer orr writable account

use anchor_lang::{ prelude::*, system_program::{create_account, CreateAccount}, }; use anchor_spl::{ associated_token::AssociatedToken, token_interface::{Mint, TokenAccount, ...
demirtasarkinbaris's user avatar
0 votes
0 answers
15 views

Strange error from adding account address validation

I am working on a program that invokes drift. It all works fine, just adding assertions now. I have changed this account: #[account(mut)] pub user_stats: AccountInfo<'info>, To this: #[account( ...
mega_creamery's user avatar
1 vote
2 answers
57 views

Anchor: Do I need to validate PDAs when passing them into my program?

Since only the program(owner) of a PDA can modify it's data. Do I have to validate a PDA passed to the program via seed and canonical bump? Example: If I initialize a Group PDA... #[derive(Accounts)] #...
Russo's user avatar
  • 349
0 votes
0 answers
35 views

How to Properly Interact with Pool Token Account in a Liquidity Pool Program using Anchor?

I'm working on a Solana program using Anchor that implements a liquidity pool with a loan feature. The pool is initialized and funded by users (liquidity providers) who deposit assets into the pool. ...
Suhas A's user avatar
1 vote
1 answer
47 views

PDA signed CPI access control

Imagine this usecase. We have a central treasury/vault, which holds all of the funds in the protocol. There are multiple separate games, which execute game logic, but do not hold the funds. Once game ...
the big bear's user avatar
0 votes
1 answer
25 views

How to make NFT with Solana?

I am the designer of a molten salt type solar power plant. I decided to convert my design to NFD and build a metaverse in space in an area analyzed in reality.I don't know how toconvertmy3DMAXfiles(....
Mahdi's user avatar
  • 3
1 vote
0 answers
17 views

Use PDA as the authorized account for the token account Failed

I want to create a public wallet (public_account) when I create SPL tokens, and then this wallet holds the original mint tokens, and then others can transfer tokens from through the contract interface....
Dunty Z's user avatar
  • 11
0 votes
3 answers
426 views

cargo build works but `cargo build-sbf` and `anchor build` fail with unsupported target error

I am working on a Solana program and facing issues building my project. When I run cargo build, the build completes successfully but doesn't generate the required .so file for deployment. Additionally,...
David's user avatar
  • 339
0 votes
1 answer
38 views

"Anchor Solana: InvalidProgramId Error When Passing AccountInfo for SOL Pool PDA

I'm trying to write a ICO contract with Anchor, which supposed to transfer SOL from user to program PDA account, and receives corresponding ico token. Now I'm facing strange behaviour that ...
cablespecific's user avatar
0 votes
0 answers
46 views

Simple program fails Error: memory allocation failed, out of memory, consumed 2474 of 200000 compute units

I'm trying to write a program to be able to init and mint different tokens. So I pass dynamic seed during program invocation as a parameter, but somehow running out of memory in the mint_tokens ...
Scott's user avatar
  • 33
0 votes
1 answer
23 views

Transfering sol from pda to a hardcoded account pubkey

Can i transfer money from a program owned PDA to a hardcoded pubkey without AccountInfo of the receiver ? Or do I NEED to pass it from the client? let hardcoded_pubkey = Pubkey::from_str("----...
DumSolProgramer's user avatar
0 votes
2 answers
91 views

Transfer SOL out of PDA owned wallet account

Basically I'm trying to figure out to transfer SOL out of a wallet account which is owned by a PDA. the PDA is in turn owned by my program. I've tried invoke_signed, my seeds are all correct, and I ...
xxxdropoutxxx's user avatar
2 votes
1 answer
34 views

Transfering money from a pda to a user wallet with native rust

Sorry for a noob question but im writing a solana program without anchor. And I'm having a problem with transfering sol from pda to a wallet in a program. pub fn process_instruction( program_id: &...
user21930's user avatar
3 votes
1 answer
152 views

How to create shard accounts to manage "unlimited" account size

Since there is a limitation inside Solana transactions (1kb), and Solana account (1Mb), I'm not able to create a huge account ^^ Someone suggests me to open a new question: Handle big vector ...
GoT's user avatar
  • 97
0 votes
1 answer
37 views

Is there an atomicity problem when using PDA to store user data collection?

As stated, if I use PDA (Program Derived Address) to store user data, do I face transactional issues similar to traditional databases, where my version might get updated by another user before I save, ...
user8583445's user avatar
1 vote
1 answer
115 views

how i transfer my spl token by js

Hello i need to write a program that transfer token from my wallet to another wallet i wrote here is code const {clusterApiUrl, Connection, Keypair, LAMPORTS_PER_SOL, PublicKey} = require('@solana/...
Hich's user avatar
  • 51
1 vote
2 answers
170 views

Struct field "token_account_owner_pda" is unsafe, but is not documented

I was following the Token Vault tutorial on Solana Playground. It compiled fine on SolPG but when I compile this program on my system, I get the following error about unsafe account. I want to make ...
Anas's user avatar
  • 71
1 vote
1 answer
88 views

Error Number: 2006. Error Message: A seeds constraint was violated

My rs part: #[derive(Accounts)] pub struct CreateLottery<'info> { #[account( init, payer = authority, space = 4 + 32 + 8 + 4 + 1 + 4 + 1 + 8, // 8 for account ...
André Garcia's user avatar
0 votes
2 answers
46 views

Pay for PDA by a centralized wallet

I'm trying to build an app that will hold a user's wallet private key to sign for transactions and pay for the account from a centralized wallet that I own. I'm trying to avoid them having to approve ...
Christopher Nolan Buckley's user avatar
2 votes
1 answer
111 views

Anchor pass parameters to PDA creation from initialization

I'm getting crazy on passing a parameter to the seed of a PDA. That's the simplified program: use anchor_lang::prelude::*; declare_id!("JAe3BFznJPTWu4JF1x1JQwzJ29b9jZJ9gPANJTdY2qUf"); #[...
Francesco's user avatar
1 vote
1 answer
215 views

Wrapping Sol results into Error: IncorrectProgramId

I have a PD vault account, I transfer some amount of SOL to WSOL token account for this vault and then I try to call the SyncNative instruction that results into err: 'Program ...
Nika Pestvenidze's user avatar
2 votes
2 answers
285 views

Anchor Test has Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0

So if I anchor build and then anchor deploy on the devnet and then use anchor test --skip-build --skip-deploy since I already built and deployed everything before, I find the first time around the all ...
Mark's user avatar
  • 45
1 vote
1 answer
66 views

Not able to read the updated value in a Solana Data Account

I have a simple solana greeting-counter program, I have it deployed locally. When I am calling from my typescript code I am able to do pretty much all the transactions and verify them. Except the last ...
Md Tauhidul Islam's user avatar
1 vote
1 answer
55 views

Account creation on Solana

Suppose I have a PDA address that hasn't been initialized yet and I send SOL to it, Am I correct in assuming that this account will exist? Who will have control over this account? Will it still be by ...
Jimii's user avatar
  • 7,672
2 votes
1 answer
33 views

passing anchor `#[instruction]` argument with another argument results in different address generated

I have my accounts struct like this #[derive(Accounts)] #[instruction(force_seed: [u8; 32])] pub struct Dummy<'info> { #[account(mut)] pub payer: Signer<'info>, /// CHECK: ...
Jimii's user avatar
  • 7,672
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
0 votes
1 answer
76 views

Best practice design PDA in solana

When developing contract in solana, I had seen some example (include example in solana cook book - https://solanacookbook.com/gaming/store-sol-in-pda.html#tiny-adventure-anchor-program-part-two) had ...
Nhat Minh Nguyen Quang's user avatar

1
2 3 4 5 6