Skip to main content

Questions tagged [account]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
63 views

Geyser closed account notifications

When an account is closed, the notification that comes from the geyser plugins account_update method includes the account with owner set to System Program - regardless of who the owner was before it ...
liamvovk's user avatar
  • 168
1 vote
1 answer
47 views

should I split a large data account into smaller ones

I have an account that contains a lot of fields, 30+. Besides composability, is there any benefit to splitting this account into different accounts? Will it improve performance/transaction costs?
Jimii's user avatar
  • 7,672
0 votes
1 answer
223 views

About SystemProgram.assign

While I have a main account A and has its keypair. Then I use createWithSeed create one account derived account x, and asign it to one program C. Now the problem is : I want to change the account x's ...
xingyue's user avatar
  • 13
0 votes
1 answer
90 views

How reliable is the accounts: &[AccountInfo] array is?

I am trying to learn solana development[native solana] and when reading some example programs I saw they all use the "accounts: &[AccountInfo]" in order to figure out the accounts ...
Yali Haviv's user avatar
3 votes
1 answer
353 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()...
mega_creamery's user avatar
1 vote
1 answer
489 views

"Access violation in stack frame 3 at address 0x200003ff0 of size 8 by instruction #35516" , even though I use zero copy on my account struct

This is my account struct pub struct ClaimRewards<'info> { #[account(init_if_needed, payer = payer, seeds = [OKUSEED.as_ref()], bump, mint::decimals = 6, mint::authority = mint)] pub ...
Abhishek Faliya's user avatar
1 vote
1 answer
108 views

Error: Invalid option while trying to fetch account data with anchor

I'm getting this error Error: Invalid option endTime at OptionLayout.decode (node_modules/@project-serum/borsh/src/index.ts:148:11) at Structure.decode (node_modules/buffer-layout/lib/...
Abhishek Faliya's user avatar
1 vote
0 answers
48 views

'Program failed to complete: Instruction passed to inner instruction is too large (12884933932 > 1280)', Getting this error [duplicate]

I'm getting this error Program logged: "Instruction: CreateVester" > Program consumed: 5565 of 200000 compute units > Program returned error: "Instruction passed to inner ...
Abhishek Faliya's user avatar
7 votes
2 answers
790 views

How to correctly read data from a Zero Copy account

I'm having trouble reading data in the client from a program with a zero copy account. I've defined the account as follows: #[account(zero_copy)] #[repr(packed)] pub struct EventQueue { header: ...
rumika howdie's user avatar
4 votes
1 answer
262 views

Why does `solana program show <address>` and `solana accounts <address>` return different values for the `data length` and `balance` fields

Originally asked in the SolanaU discord. Is there a reason why the Solana CLI will return different values for solana program show and solana account? solana program show ...
Jimii's user avatar
  • 7,672
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 ...
McBain's user avatar
  • 5,384
7 votes
1 answer
422 views

what is ledger space in solana?

from here On Solana, State Compression is the method of creating a "fingerprint" (or hash) of off-chain data and storing this fingerprint on-chain for secure verification. Effectively using ...
Yilmaz's user avatar
  • 1,264
0 votes
1 answer
74 views

How to ensure unique u16 IDs for accounts?

I'm storing a vector of u16 user IDs. I decided not to store public keys in vector, which I can use as ids or get rid of ids completely instead, however public keys are 32 bytes and will have limited ...
Gmer's user avatar
  • 85
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 ...
mahnunchik's user avatar
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&...
SolDev's user avatar
  • 33
0 votes
2 answers
1k 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 ...
Panchal Vedant's user avatar
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 ...
Panchal Vedant's user avatar
0 votes
1 answer
193 views

Why we need to pass all that accounts into functions in native solana?

I am go through the solana course and I am not understand that basics of writing solana native programs. Why do we need to pass to the functions some AccountInfo slice? Where this adressess should ...
Gilsson's user avatar
1 vote
1 answer
142 views

How to calculate space for an account dynamically using remaining_accounts

Is it possible to allocate space to an account based on account provided in remaining_accounts? I want to allocate enough space to store public key of the accounts provided in remaining_accounts in a ...
onurhb's user avatar
  • 113
0 votes
0 answers
353 views

Solana rent account questoin

I have a question. If I hold solana token on my wallet - do I need to pay a rent for my account on chain ? I've red official documentation and I see that there is a garbage collector in solana chain ...
Andriy Vasyltsiv's user avatar
1 vote
1 answer
371 views

Can a closed account in anchor be initialised again?

I am following the soldev tutorials. At the Crossing Account and Revival attacks.The program has two methods a lottery initialisation account and a redeem tokens based on the time of entering. After ...
Mr.H's user avatar
  • 117
0 votes
1 answer
633 views

Should `getRecentPrioritizationFees` always return 0 as fees when an empty array is passed as parameter to it? If so, why?

I wanted to use the getRecentPrioritizationFees Solana JSON-RPC method to compute a prioritization fee estimation. According to the Solana documentation, this method has an accounts array parameter ...
Gabriel Crispino's user avatar
3 votes
1 answer
406 views

Why do we convert accounts to AccountInfo?

I have this rust function pub fn purchase_ticket(ctx: Context<PurchaseTicket>, lottery_id: u32) -> Result<()> { let lottery = &mut ctx.accounts.lottery; let ticket = &...
Yilmaz's user avatar
  • 1,264
0 votes
1 answer
634 views

How to use init_if_needed?

I want to create an instruction where it is only possible to initialize a new PDA account if some parameter on another PDA account (same type) is fulfilled. So I was thinking that init_if_needed would ...
Burger Bob's user avatar
  • 1,506
0 votes
1 answer
65 views

Can a stake account be re-delegated?

On blockchain explorer you’ll see that a stake account may have an “activated” epoch, and a “deactivated” epoch. Does that mean that a single stake account can only be “used” once? I.E. there can only ...
0xTaylor's user avatar
0 votes
2 answers
2k views

How to define a variable to a public key in anchor? [duplicate]

I want to hardcode a public key in my anchor Solana program and then compare it with the public keys passed to the functions of the program. Can someone please tell me how can I declare a variable ...
Rounak Naik's user avatar
1 vote
1 answer
1k views

Can we change the owner of a Solana account?

I have a solana account created by a solana program deployed on the devnet. Is it possible to change the owner of the account? If yes then can you please tell how to do it?
Rounak Naik's user avatar
0 votes
1 answer
198 views

Can solana accounts be made immutable?

I have recently started learning about solana development and realised that solana accounts created by solana programs are mutable. Is there any way we can make them immutable? Also can you please ...
Rounak Naik's user avatar
1 vote
1 answer
1k views

Error: AnchorError: AnchorError caused by account: base_account. Error Code: AccountNotInitialized

I wrote a Solana Program with two functions, one for the initialization of an account and a second to upload data to the account. While testing on localhost it was working fine, but when I uploaded it ...
Rounak Naik's user avatar
1 vote
1 answer
230 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 ...
alan's user avatar
  • 13
3 votes
1 answer
801 views

what is anchor #[instruction()] macro?

I have this code: #[derive(Accounts)] #[instruction(campaign_id: u32)] pub struct CreateCompaign<'info> { #[account( mut, seeds = [SEED.as_bytes(), &campaign_id....
Yilmaz's user avatar
  • 1,264
1 vote
1 answer
54 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 ...
Yilmaz's user avatar
  • 1,264
3 votes
1 answer
641 views

Can Solana Accounts be accessed by any Solana Program using its address?

If I have a deployed Solana Program which creates some Solana accounts for storing data in it. Can these Solana accounts be accessed by any other Solana program using the account addresses? I am ...
Rounak Naik's user avatar
1 vote
0 answers
45 views

How to call another instruction from the same Anchor program (No CPI) [duplicate]

Is there a way to invoke an instruction within the same program? just for the sake of code reusability, I know we can achieve this easily with CPI when invoking different programs instructions, but I ...
Ander's user avatar
  • 1,005
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 ...
Whiteseal's user avatar
  • 3,597
1 vote
2 answers
515 views

How do you deal with a changing account state?

Let us suppose that you want to update an account state to include a new field. pub struct MyState { pub a: u8, pub new_field: u8 } This means that fetching and decoding the old accounts prior to ...
Burger Bob's user avatar
  • 1,506
3 votes
2 answers
432 views

Why did I get access to the wallet?

I generated a 12-word BIP39 word sequence using a third-party library (not from the solana tools). Next, I went to the phantom mobile application and added a wallet by restoring it using a 12-word ...
Leo Loki's user avatar
  • 464
1 vote
2 answers
526 views

Is it possible to create an account (new keypair) using PHP?

I don't have experience with solana yet and I have question in my work. I see that it is possible to generate a key pair with web3.js But is it possible to generate a new pshair with php ?
Leo Loki's user avatar
  • 464
4 votes
2 answers
2k views

Is there a way to estimate the transaction size?

Currently to get the size of a transaction I have to do the following const tx = new Transaction().add(...) const { blockhash } = await connection.getLatestBlockhash(); tx.recentBlockhash = blockhash; ...
lameren's user avatar
  • 173
4 votes
3 answers
2k views

Confusion between Token Account and Associated Token Account?

I am new to Solana dev. I am confused by the answers on StackExchange. The token mint holds information about a specific mint. An associated token account is an account linked to a user so the user ...
LAUR_NASA's user avatar
  • 193
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. #[...
Burger Bob's user avatar
  • 1,506
3 votes
1 answer
624 views

Getting transaction info on account changes using JS

Using JS, how would I go about getting transaction information on transactions that affect the balance of a specific account? I've been able to listen for account changes with the following code, but ...
gxc's user avatar
  • 165
1 vote
1 answer
229 views

How to handle multiple tokens + SOL in a payments program?

Context Depending on the item price in USD, users should be able to pay for items with different tokens/currencies (this is made possible with Switchboard Oracles). The payments then go towards a ...
Burger Bob's user avatar
  • 1,506
1 vote
2 answers
187 views

What happens to old program-owned-accounts when adding a new field to the account structure?

Let us suppose users are able to create a program-owned-account: PurchaseItemAccount, which is deployed as: { id: u64 price: u64 } After some time, I then decide to add a field, ...
Burger Bob's user avatar
  • 1,506
1 vote
1 answer
344 views

Is it common to have close account instruction inside my solana program

In my Solana program, users can create program-owned accounts. Although maybe they want to close it because it is no longer necessary and want to recoup the account rent/fees. I assume that closing ...
Burger Bob's user avatar
  • 1,506
1 vote
1 answer
91 views

What does range full operator do in borsh serialize?

I follow hackernoon-solana to see the syntax in non anchor project. this is the function signature pub fn process_instruction(program_id:&Pubkey,accounts:&[AccountInfo],input:&[u8])->...
Yilmaz's user avatar
  • 1,264
1 vote
3 answers
146 views

How much of a PDA can a program control

How much of a PDA is under the control of its owner program? For example, could the program block the account from signing certain instructions on transactions? Or could the program add a fee to every ...
Pixeled's user avatar
  • 486
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 ...
LAUR_NASA's user avatar
  • 193
1 vote
1 answer
528 views

Gasless Transactions for Solana

Has there been any research or development done around gasless txns? I'm looking to record particular txns for user provenance that have little intrinsic value now, but likely will in the future. I'm ...
Karl Mozurkewich's user avatar
4 votes
1 answer
142 views

Why do we use lifetime parameter when we create an account struct?

This is an example of account struct in an anchor project. #[derive(Accounts)] pub struct Create<'info>{ #[account(init,payer=user,space=264)] pub calculator:Account<'info,Calculator&...
Yilmaz's user avatar
  • 1,264