Questions tagged [account]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
37 views

Are enums with associated values permitted?

Not sure if this is really an anchor or solana related question, since I am able to compile, just not to run tests. I can run code and test against code that has an account that has following enum: #[...
mega_creamery's user avatar
1 vote
1 answer
19 views

Get all accounts from ledger

To obtain all account information from the ledger, I used the following command: solana-ledger-tool --ledger /mnt/ledger/ accounts However, only the following information is printed, and the account ...
Solextra's user avatar
0 votes
1 answer
16 views

How to parse changes of the balances in json of a TX?

I sent 0.13 SOL from one ordinary wallet to other. There's been no interraction with a smart contract, nor was it a token but SOL sent. Here's a part of a TX in its raw form which I've obtained via ...
Nondi's user avatar
  • 15
0 votes
0 answers
12 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
  • 149
1 vote
1 answer
25 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
  • 731
0 votes
1 answer
18 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
0 votes
1 answer
28 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
53 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
51 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
30 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
35 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
139 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
229 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
  • 731
2 votes
3 answers
260 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 ...
Guiomar Raissa's user avatar
4 votes
1 answer
59 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,069
0 votes
1 answer
28 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
  • 65
1 vote
1 answer
32 views

What size to use for getMinimumBalanceForRentExemption calculation for SOL account

According to the documentation minimum balance/amount to be send to new SOL account can be calculated by getMinimumBalanceForRentExemption method: https://solana-labs.github.io/solana-web3.js/classes/...
mahnunchik's user avatar
2 votes
1 answer
75 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
  • 23
0 votes
2 answers
163 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
81 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
48 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
37 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
77 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
0 votes
1 answer
82 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
  • 1
0 votes
1 answer
55 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
2 votes
1 answer
51 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,069
0 votes
1 answer
85 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,104
0 votes
1 answer
32 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
241 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
0 votes
1 answer
102 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
53 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
102 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
37 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 ...
byung's user avatar
  • 13
1 vote
1 answer
112 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(), &compaign_id....
Yilmaz's user avatar
  • 1,069
1 vote
1 answer
25 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,069
3 votes
1 answer
182 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
32 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
  • 843
2 votes
2 answers
84 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
  • 2,192
1 vote
2 answers
152 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,104
0 votes
0 answers
16 views

What would be rust equivalent for `LaunchStagesInfo` account from CMZYPASGWeTz7RNGHaRJfCq2XQ5pYK6nDvVQxzkH51zb

I want to fetch LaunchStagesInfo account from from this program, but don't know how to write rust equivalent to it.
ConecrateFish-1108's user avatar
3 votes
1 answer
172 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
  • 202
1 vote
2 answers
129 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
  • 202
3 votes
2 answers
492 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
  • 101
3 votes
3 answers
309 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 ...
Mr.H's user avatar
  • 153
2 votes
1 answer
57 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,104
3 votes
1 answer
56 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
0 votes
1 answer
72 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,104
1 vote
2 answers
40 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,104
1 vote
1 answer
176 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,104
1 vote
1 answer
55 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,069