Questions tagged [account-data]

The tag has no usage guidance.

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

Solana Rent Calculation [duplicate]

Could someone please provide guidance or a code example on how to calculate rent for Solana accounts? Specifically, I'm interested in understanding how to determine the rent due for each account based ...
Naomi Yoko's user avatar
1 vote
1 answer
15 views

Checking the generated PDA against the user's PDA input

First of all, I'm new to Solana development (came from an Ethereum background), so sorry if my question is too basic. I'm following the SolDev course, I'm on course state management. I have a ...
0xbrivan's user avatar
1 vote
0 answers
25 views

Reading all kinds of information from the blockchain

(For a project of mine which is a full Solana blockchain "status" tracker. For public!) Problem: Reading Pair/Pool info How do I even get the info which pairs exist without looping through ...
axlynom's user avatar
  • 31
0 votes
1 answer
38 views

Are Tx process parallel? How are the account data guaranteed not overrided each other by simultaneous Tx?

As stated in title. Does runtime sort all input account an add mutex-locker to those accounts that are mutable?
breeze wang's user avatar
2 votes
2 answers
103 views

createInitializeMintInstruction() ----> error: invalid account data for instruction using

I am trying to use the "createInitializeMintInstruction()" using JS to create a token. The problem is when executing, it throws an error. Concretely this one: Transaction simulation failed: ...
lauteriust3's user avatar
1 vote
1 answer
31 views

rent handling in storage

How does this "collecting rent" work exactly(or used to work)? Does it iterate over all the accounts that are not rent exempt per every epoch? in this link, i saw this line: requires the ...
Sepehr Mirnasrollahi's user avatar
1 vote
2 answers
141 views

Decode account data

I am trying to decode data from accounts. This is the IDL for the data I want to decode: { "name": "deployment", "type": { "kind": "...
CryptoTioSam's user avatar
1 vote
2 answers
509 views

Token balances on liquidity pools

How can I get to the price in a liquidity pool? I assumed it would be as simple as getting the balances of both tokens and doing quoteBalance / baseBalance, but that doesn't seem to be the case. Below ...
lsrth's user avatar
  • 21
1 vote
1 answer
56 views

Correct way to define and initialize a variable-length account in Anchor

I have been following the Tic-Tac-Toe tutorial and i am experimenting with creating a PDA account in my program that holds a variable-length list of values (in particular, public keys representing ...
munifao's user avatar
  • 43
2 votes
0 answers
289 views

Decode data from GetAccountInfo in python for a Raydium pair

Maybe my approach is wrong. I'm new to Solana dev. I'm using the Solana mainnet API and I'm trying to get the liquidity pool amounts for a given token pair on raydium. My code: res=solana_client....
Ricouello's user avatar
  • 121
0 votes
1 answer
37 views

Deploying program with sol_remaining_compute_units() gives "invalid account data"

Including something like msg!("remaining compute: {}", solana_program::compute_units::sol_remaining_compute_units()); will lead to error when deploying RPC URL: https://api.devnet.solana....
Pun's user avatar
  • 1
0 votes
1 answer
35 views

The data that anchor' account stored surprise me, for a non-PDA account, it store all history input data. Why?

I play this https://beta.solpg.io/62d67703f6273245aca4f5fe example days ago. Just added more logs inside initialize() instruction. After invoke initialize() multiple times with different 'new_account' ...
breeze wang's user avatar
1 vote
2 answers
81 views

does account declared among different`#[derive(Accounts)]` struct share one storage?

When learning PDAs, I got an example that use PDAs to implement voting: https://github.com/bfriel/crunchy-vs-smooth/blob/master/programs/crunchy-vs-smooth/src/lib.rs#L34 We can see that there are code:...
breeze wang's user avatar
1 vote
0 answers
33 views

Increase PDA size after deployment

I read somewhere some time ago that Solana now provides feature to increase the PDA size post deployment. For example, let's assume that I deploy a PDA with a capacity to hold 10 Publickeys and later ...
Vineet Kinger's user avatar
2 votes
2 answers
488 views

Check if an account is a Token Account

We are given some public key that may be a token account (could be ATA or not) and want to find out if it is. Currently I am doing this by calling getAccount from @solana/spl-token and seeing if it ...
Ahri's user avatar
  • 3,289
2 votes
3 answers
124 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 ...
mega_creamery's user avatar
1 vote
2 answers
67 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
64 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
1 vote
1 answer
75 views

The data structure of an associated token account's data field

I used 'solana account --output json 'address'' to obtain the data field of a Token account, which is encoded in base64. I would like to know how it is structured.
Solextra's user avatar
3 votes
2 answers
268 views

What determines 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::...
mikemaccana's user avatar
  • 1,815
3 votes
1 answer
170 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
4 votes
1 answer
59 views

Storing and reading data on user account

Is it possible to store user notes in his account or maybe some way around? Wanna make some kind of on-chain KeePass. Ideally just with web API in React or smth. Thank you.
Mukhtar's user avatar
  • 43
7 votes
2 answers
349 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
1 vote
1 answer
190 views

How can any program in Solana read an account of another program? Give an example

The Solana docs states that Any program can read or credit another account. Ref: https://docs.solana.com/developing/intro/programs. Please explain this line. Does that mean I can extract all past ...
Suvadra Barua's user avatar
0 votes
1 answer
92 views

Invalid account data on multisig token transfer from nodejs

I have a multisig address with 3 other signers. Not sure if this was created with cli or serum project (the developer that created it is working anymore). When trying to transfer a token, I get this ...
recoverySol's user avatar
2 votes
2 answers
309 views

How to deserialize raw account data from tx in rust?

I get a b64 encoded data for an account from the transaction. I need to decode it into my account data struct called "Entity". I deserialize the b64 data into bytes then :- I tried to ...
Dev Bharel's user avatar
0 votes
0 answers
202 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
2 votes
1 answer
33 views

Am I allowed to use a BinaryHeap in an account?

I'm pretty sure std::collections::BinaryHeap supports Borsh, so I thought I could use it with an account. Here is the account: #[account] pub struct Voter { pub claim_queue: BinaryHeap<...
Varun Siva's user avatar
1 vote
1 answer
440 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
3 votes
1 answer
421 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
3 votes
1 answer
256 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
43 views

Is it a good idea to add a "passphrase" as part of a PDA seed to store data encrypted on-chain?

Thinking about approaches to simplify e2e encryption, this is one of the ideas that came to mind. The seed then could further be used to encrypt the PDAs data. Sharing the passphrase between the ...
tenxsoydev's user avatar
3 votes
1 answer
94 views

How to clone all the account of a given slot?

How could I download all the accounts at a given slot. Like Snapshot of all the Solana accounts at a recent given slot
d4rkshad0w's user avatar
1 vote
1 answer
128 views

How to call cross program function when I have information of program-id and instruction only not the account-info?

I am calling Program B from Program A and all I know is program-id of Program-B and instruction message (not the account info's that will be going to read/update in Program-B execution). In this ...
crypto sahdev's user avatar
2 votes
0 answers
43 views

Stake account info is not updated after epoch

I delegate 30◎ the validator in 353 epoch. Stake account is 2o5G3H5dCb2akeT1eU4Q9WUz7Ky8hco2QmoAQg2ki42Z. In 354 epoch I got rewards and my stake right now is 30.013167766◎. But when I'm trying go ...
Denys Hryshko's user avatar
0 votes
1 answer
116 views

checking if a program is upgradeable

I am trying to work out how to get some meta data for Solana programs. I can see on sol explorer etc that it knows whether a program is upgradeable, and if it is, who the upgrade authority is, but I ...
daoplays's user avatar
  • 567
0 votes
1 answer
26 views

Query computed data from account

I have an account with definition like this. How do i get result from implemented method "can_buy"? #[account] #[derive(Default)] pub struct Data { pub time_start: i64, pub time_end: ...
Hiep Chelsea's user avatar
4 votes
1 answer
121 views

How does borsh serialize updated data back into account?

In the code from the project here, the processing logic is as follows: pub struct Processor {} impl Processor { pub fn process_instruction( _program_id: &Pubkey, accounts: &...
Finlay Weber's user avatar
2 votes
2 answers
281 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 ...
Sebastian Dine's user avatar
2 votes
1 answer
1k views

how to decode data of specific account

how can i deocode the buffer data of account. let pb = new PublicKey("GnAwACYKCx5LEv8QJUKvGigcix8AjnsrjLEn2Cu6UJrH") let a= await connection.getAccountInfo(pb) Output
Hamza Bhatti's user avatar
4 votes
2 answers
192 views

is that all data on Solana store on memory?

I am just very confused at this point. If all data on Solana are stored in Memory what if the whole network shutdown or restarts whether all data is removed? I thought it must stored data in Hardware ...
Dũng Đàm's user avatar
1 vote
1 answer
25 views

Do I have to pay when deploy a project with one code account and one store data account

I'm new to the Solana network. I wonder do I need to pay rent for each account I deploy on Solana network. for example, if I have a project with one account store execute code and one project to store ...
Dũng Đàm's user avatar
4 votes
1 answer
720 views

How to fetch data from Solana smart contract

Is there a tutorial or detailed explanation on how to fetch all the transactions from a deployed contract on Solana? My concrete question is: I deployed a contract (https://explorer.solana.com/address/...
wisk's user avatar
  • 61
3 votes
1 answer
733 views

Decoding data buffer of an account - @solana/buffer-layout - Rust u64 to Typescript Number conversion

I figured out how to decode the data buffer manually for a solana account data. I used the USDC account address to get the account data and then I used the @solana/buffer-layout for u64 buffer ...
andromeda's user avatar