Questions tagged [account]
The account tag has no usage guidance.
250 questions
3
votes
1
answer
76
views
Where does a Account of a TokenMint store the maximum capacity it has at the moment?
I just started learning Solana, and I have a question that is confusing me.
A tokenMint are account that holds specific information about a token. But createMint only requires the mint freeze ...
3
votes
1
answer
1k
views
Extract specific information from a transaction
I need to extract this info from a transaction:
from, to wallet addresses
asset: SOL or a token (what token?)
amount transfered
block_timestamp
I know how to get info of a transaction - https://docs....
3
votes
2
answers
515
views
Store text as string vs. bytes
Is there any advantage to using Vec<u8> over String to store text in storage account fields? And if so, why? From a storage perspective, they are nearly handled identically as far as I can tell ...
3
votes
1
answer
154
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 ...
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&...
3
votes
2
answers
502
views
Efficient way to get Account age?
So right now I'm calling getSignatures and getting blocktime of the earliest one I get returned. Is there a more efficient way of doing this?
3
votes
1
answer
282
views
Fetching transaction ID that created account
Background:
In my application I am creating an account to store some arbitrary information.
I then want to display the transaction id/address of the transaction that created such an account.
Question:
...
3
votes
1
answer
222
views
Creating Stake Account using CLI
I am using the following command using the reference link as https://docs.solana.com/cli/delegate-stake. However, I am getting an error - "Error: Dynamic program error: missing signature for ...
3
votes
1
answer
34
views
What if the rent exemption price goes up?
Given that
new Solana accounts must be credited - at creation time - with enough SOL to be "rent-exempt",
the balance of an account isn't allowed to go below its corresponding minimum "...
3
votes
0
answers
77
views
How to do account white listing using merkle tree on solana native rust program? Is it really possible to do whitelist account using merkle on solana?
I did this code But have doubt that it will not work as desired:-
use borsh::{BorshDeserialize, BorshSerialize};
use merkletreers::tree::MerkleTree;
use merkletreers::utils::hash_it;
use ...
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 ...
2
votes
3
answers
1k
views
Is there a limit to how many accounts one is able to pass into an Anchor Context?
I heard there is a limit of 30. Not sure if true or not.
2
votes
3
answers
194
views
How to close account?
I am trying to close an account with a balance of 890880 lamport (getMinimumBalanceForRentExemption api result) for rent, and I send a transaction to transfer the 885880 amount via system transfer. ...
2
votes
1
answer
593
views
How to get symbol and amount of a transaction in solana network?
I'm new to solana network and technology. I'm developing an application to confirm transaction receive to a specific wallet address on solana network. Right now I'm using this API "api.mainnet-...
2
votes
2
answers
279
views
Zero_copy not working , Getting `Zeroable` is not implemented for `[Event; 25000]`, while trying example
I'm trying This example by anchor to initialize large accounts and using zero_copy on them.
https://github.com/coral-xyz/anchor/blob/master/tests/zero-copy/programs/zero-copy/src/lib.rs#L156-L165
I'm ...
2
votes
3
answers
5k
views
How do I close a Solana Account?
We can easily close PDAs to redeem their rent to their owner, however what I'm wondering is can the same be done for a normal, on-curve Solana account? From what I can see once you've sent the minimum ...
2
votes
1
answer
370
views
What dataLength to use for getMinimumBalanceForRentExemption() for a SOL account?
According to the Solana documentation the minimum balance/amount to be send to new SOL account can be calculated using getMinimumBalanceForRentExemption()
getMinimumBalanceForRentExemption() takes a ...
2
votes
2
answers
481
views
AccountLoader for a struct from another Program
Say I have an account in Program A, and I know it looks like this:
#[account(zero_copy)]
pub struct SomeAcc {
pub some_num: u32,
}
Now in my Program B, I copy and paste this struct exactly into ...
2
votes
2
answers
744
views
TryingToInitPayerAsProgramAccount. Error Number: 4101. You cannot/should not initialize the payer account as a program account
I have a simple program:
#[program]
pub mod my_cool_project {
use super::*;
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
let counter = &mut ctx....
2
votes
2
answers
129
views
Multiple account creation in one transaction
When we create a Solana PDA we construct the instruction, sign it and then send the transaction to Solana cluster. So I would like to know the transaction fees is charged based on nr. of instructions/...
2
votes
1
answer
964
views
How can I know if a account exists or not on solana blockchain in frontend?
I am creating PDA accounts which have seeds consisting of user-wallet-publicKey and a static-text
In frontend I want to show either user-data if user already created his account or a button to deploy ...
2
votes
1
answer
165
views
change stake account withdraw auth where the auth is the account address it self
for development purposes i did the following:
created stake account
change its withdraw auth to the account address
now i am trying to figure how i can change the withdraw auth back to wallet owner ...
2
votes
1
answer
106
views
What exactly are `Interface<'info, T>` and `InterfaceAccount<'info, T>`
InterfaceAccount<'info, T> and Interface<'info, T> and Anchor accounts types
Would love to know more about them, where I should use them and what differentiates the two.
2
votes
1
answer
696
views
What does it mean Lamport?
What does it mean Lamport?. How many Lamports is one Solana?. Is it important?. What is Lamport balance?. How to calculate it?. How many Lamports should I have in my account to be estimated rent ...
2
votes
1
answer
1k
views
How to generate address out of a seed phrase and a derivation path for Solana and some tokens?
I know how to generate addresses out of a seed phrase and a derivation path in Ethereum. And I need to do the same thing for Solana too. However, I've done a research and barely found anything.
Also, ...
2
votes
3
answers
40
views
Create an Address that can only receive tx from certain wallet?
Anyway to do something like this? like an account that can only accept txs from certain accounts?
2
votes
1
answer
1k
views
Handling multiple accounts
I'm having a hard time trying to understand the best way (even better, trying to fully understand a way) to handle multiple accounts (both client(js / ts) and program(anchor/rust) side).
If I want to ...
2
votes
1
answer
135
views
Question about if accounts with NFTs and no Sol - will they be purged and NFT lost?
In this article in the beginning it explains that accounts with Sol will be purged. If there is an account that has 0 Sol but has an NFT in the account, will it be purged and if so what happens to the ...
2
votes
2
answers
205
views
How is Token Account Owner Different from Account Owner and Account Holder?
I am learning about Solana's account model. So far so good, these are the things I have found:
Solana account is represented by the AccountInfo struct and whose structure is basically this:
pub ...
2
votes
1
answer
327
views
I want to create multiple PDA accounts made with different seeds belonging to a single user/wallet. to be exact I want to initialize multiple PDA Aco [closed]
I want to create multiple PDA accounts made with different seeds belonging to a single user/wallet. to be exact I want to initialize multiple PDA Accounts with different seeds or bumps belonging to a ...
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, ...
2
votes
1
answer
72
views
how to get an token account's Mint address on chain?
In my anchor program, I declare a uncheck account that will check by code inside instruction function
/// CHECK: do check inside function.
#[account(mut)]
pub user_ata: UncheckedAccount&...
2
votes
1
answer
261
views
Freeze Authority ? It says my account is frozen
Instruction #3 Failed - Account is frozen
2
votes
1
answer
124
views
Is there a way to get size_of an account from the client?
I'd like to use getMinimumBalanceForRentExemption. With that said, it expects a parameter of the size of the data account. I'd like to know if there's a way to get the estimate size of an account or ...
2
votes
1
answer
220
views
Why does the active stake plus the rent reserve not equal to the total balance? How to correctly calculate the total balance?
So I am trying to report the difference balances on an staking account. My assumption was:
total balance = active stake + rent reserve
However, this equation is not true when looking at the numbers in ...
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.
#[...
2
votes
1
answer
918
views
Are addresses in Solana unique accross all the tokens?
I'm working on a system wherein there're multiple blockchains involved, and withing each one, native assets and tokens too are used together, as well as wallet addresses of them.
In Ethereum and TRON, ...
2
votes
2
answers
1k
views
Write on remaining_accounts
I'm trying to push a value into a remaining_account Vec.
Here it is my code: I have an Struct with a Vec<Pubkey> and I need to push a value.
I am using try_from to get the account info but I ...
2
votes
2
answers
425
views
Can a mint's supply or decimals ever change?
I am building a data ingestion pipeline for solana blockchain data, and trying to determine whether it is safe for my processing pipeline to classify a given mint as an NFT based on whether the supply ...
2
votes
1
answer
151
views
Solana account rent/fee determination
If I create a Solana wallet account via Rust by using instruction solana_program::system_instruction::create_account(...)
The 3rd parameter is the nr. of exempted amount of lamport, in the end it's ...
2
votes
1
answer
168
views
Walllet is "locked". Can't pay transaction fees to close/update program
I am currently facing this issue that doesnt let me close my program (I don't really want to loose all the rent right now)
https://forums.solana.com/t/help-me-my-wallet-was-locked-unable-to-pay-a-...
2
votes
1
answer
85
views
Is there a way to store a reference to a zero copy account in a regular account?
Is there a way to store reference to a zero copy account in a regular account? Something like
#[account]
pub struct HoldingAccount {
[account(zero)]
pub myReferenceToAZeroCopyAccount: Box<...
2
votes
2
answers
2k
views
Transaction Error: Signature Verification Failed: Missing Signature For PublicKey
I'm building a transaction on devnet that previously worked when I tested my program. I don't think it's the program itself, but how I am passing down the signatures which is slightly different from ...
2
votes
2
answers
212
views
How many PDA accounts can I create? Is it unlimited?
I am going to store huge number of record for my on-chain program. Each record's size is small (likely 100Bytes), but need to store many(maybe millions) records on-chain.
From what I have known ...
2
votes
1
answer
51
views
PDA have a higher balance then the transferred amount
Why does a PDA account have a higher balance than the transferred funds, despite having an initial balance of 0, after I used an anchor program to transfer Solana Lamports from a wallet account to it?
2
votes
1
answer
131
views
Who has the right to modify an account and who signs transactions?
I understand that in Solana, an account has an holder, which is the private key to the public key representing the account. An account also has anowner which is the program that is allowed to modify ...
2
votes
2
answers
41
views
Make reading from PDAs private
If I remember correctly, PDA can be found out by anyone who knows the seed, Public Keys and the Program ID related to a Solana program. Is there a mechanism through which no one except the public key ...
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 ...
1
vote
1
answer
613
views
Can I use Vec<> to pass multiple accounts into an anchor program?
I'm writing an escrow program for multiple assets in one swap. I was trying an effective way to input token mint & token accounts. So I tried using Vec<> as following but it poped up the ...
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 ...