Skip to main content

Questions tagged [getprogramaccounts]

The tag has no usage guidance.

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

getProgramAccounts return always empty

i'm trying to use GetProgramAccounts in python to recover data pool but my programm always return empty. At the begenning I had tried to use filer , but as it didn't work , I took the decision to use ...
vince_crypto's user avatar
2 votes
1 answer
39 views

Improve performance of getParsedProgramAccounts for StakeAccount

Using the code outlined https://solanacookbook.com/references/staking.html#get-stake-amount I am finding the getParsedProgramAccounts call is slow for the StakeProgram, taking approximately 4 minutes ...
Angus Scott's user avatar
1 vote
1 answer
23 views

Is there anyway to decode program account change that I don’t know the struct?

I’m trying to decode update that I got from the call of “connection.onProgramAcccountChange” but I don’t know the struct of possible outcome, is there anyway to get the struct or decode it somehow ? ...
Daniel Kotlarov's user avatar
0 votes
0 answers
55 views

I want to find Pair Address manually by code in python

Hello let's say this token: TokenA = 8cG1JC9fCwpdZ9ofsEfhKJhBgKhzYCqnbbaKdC9RYw53 Native Token SOL = So11111111111111111111111111111111111111112 pair id on raydium i don't want to use raydium sdk to ...
Shehzad khan's user avatar
1 vote
1 answer
47 views

How to read validator information using the vote address?

I'm trying to read user staked validator information using @solana/web3.js. I was able to read the stake accounts for the given wallet address but having trouble with reading staked validator ...
Kaveen Laksitha's user avatar
1 vote
1 answer
36 views

Websocket version of getProgramAccounts

Is there a WebSocket version of getProgramAccounts that allows me to fetch PDAs with supplied seeds?
kekti's user avatar
  • 55
2 votes
1 answer
60 views

Calling solana.getParsedProgramAccounts method on a Token-2022 returns an empty array

When calling the below method getParsedProgramAccounts with the correct Token Program ID and a Token Address associated with that Token Program ID, I am returned an array of the token holders. ...
Alex's user avatar
  • 21
1 vote
1 answer
81 views

Maximum getProgramAccounts returned bytes

What is usually the limit of accounts/bytes returned by getProgramAccounts? For example, if I have 100,000 accounts with 40 bytes each, would getProgramAccounts return them all? I’ve read that the ...
c4b4d4's user avatar
  • 111
2 votes
1 answer
117 views

Get Holders timeout

I want get total holders of a token, this is my code : const accounts = await connection.getProgramAccounts( programId, { dataSlice: { // for amount data slice ...
iori's user avatar
  • 68
0 votes
1 answer
286 views

How to getProgramAccounts for Token 2022 Program?

I am trying to send get request as follows but it returns nothing... Can you please guide me how to fix this issue? and how to figure out the datasize and bytes for any program address... { jsonrpc:&...
kokiez's user avatar
  • 123
1 vote
1 answer
43 views

Can I change program data ID of the program account?

When fetching the program account using getAccountInfo rpc, it will return the following response: { "jsonrpc": "2.0", "result": { "context": { ...
johnhckuo's user avatar
  • 137
0 votes
1 answer
46 views

Find custom program accounts

How can I find all accounts of my wallet which is owned by a specific program? (Not any of the metaplex programs)
Muhit Raihan's user avatar
0 votes
0 answers
53 views

Implement get_program_accounts using BanksClient

BanksClient doesn't have a get_program_accounts method. Is there a way to mimic it?
KevinH's user avatar
  • 422
1 vote
1 answer
145 views

memcmp filter similar to LIKE %

say i have a PDA struct Foo { created_at: i64 } with a created_at unix sec timestamp field (ex: 1690004000). I want to filter all PDAs that were created in 1690000000. as far as i know ints are ...
amilkov's user avatar
  • 43
2 votes
1 answer
334 views

Get AccountInfo from ProgramId, or invoke program method using ProgramID

If I've programId (Pubkey) of a program, is it possible to get AccountInfo (or Program) object somehow? Or conversely, is it possible to somehow invoke a (view) method on program if its programId is ...
Sarfaraz Nawaz's user avatar
1 vote
1 answer
203 views

How to get Address Lookup Tables owned by given Pubkey via filtering the LookupTableProgramAccounts?

I want to retrieve the LookupTables of a certain Pubkey by filtering the LookupTableProgram accounts. Which filter do I need to set to filter for a given authority? let accounts = rpc_client ....
bamboofighter's user avatar
1 vote
1 answer
147 views

How to filter through boolean with getProgramAccounts?

I know how to filter a getProgramAccounts with a publicKey but I am struggling to do it with a boolean. I tried: { memcmp: { offset: 8 + 4, bytes: false, }, }, It gives me an error, ...
rudy rhatal's user avatar
4 votes
2 answers
242 views

How to sort accounts after a getProgramAccounts?

I use getProgramAccounts to get a big number of accounts. I would like to only get the first 5 accounts with the highest field score. I know that pagination and ordering is not supported officially, ...
rudy rhatal's user avatar
5 votes
1 answer
284 views

Limits of getProgramAccounts?

The official documentation does not mention the limits of getProgramAccounts, just that we should not abuse it. Can I get 50 accounts with 500 bytes each ? Or 5000 accounts with 500 bytes each ? I ...
rudy rhatal's user avatar
4 votes
1 answer
871 views

Borsh Deserialization error: Trying to access beyond buffer length

I've seen some similar threads regarding this problem but none have provided a stable solution. I get the following error when attempting to fetch and deserialize account data: Deserialization error: ...
Joey Meere's user avatar
  • 1,445
2 votes
1 answer
203 views

What's the max return size of the getProgramAccounts call?

The docs just mention "If the results of a query are too large, the response will be truncated." What's the max data size of the query that can be returned? I understand I can do b64+zstd ...
Dev Bharel's user avatar
3 votes
1 answer
220 views

Can't find owner's tokens with Metaplex

I'm working on a front-end. I want to fetch all the NFT of a specific collection the user owns. I used to do: const tokens = await metaplex .nfts() .findAllByOwner({ owner: provider.publicKey }...
Dodecahedr0x's user avatar
1 vote
0 answers
18 views

Question about solana programs

Why is it recommended that solana programs check the validity of any account it reads, but does not modify?
Mehmet Ayd's user avatar
1 vote
1 answer
553 views

How to deserialize data from getProgramAccounts?

How can I deserialize data after a getProgramAccounts with JS ? const accounts = await provider.connection.getProgramAccounts(program.programId); console.log(accounts[0]) I see the log result: ...
rudy rhatal's user avatar
0 votes
2 answers
260 views

My sol stuck in prgram. How can I close program and recover it?

I was deploying program and by mistake I missed the keyword program and just typed solana deploy <PROGRAM_FILEPATH> which return the below program Id and there is no upgradeable authority. Now ...
Abdul Maajid's user avatar
0 votes
1 answer
131 views

How can I read tokens with an amount of 0 with getParsedProgramAccounts?

I am developing an application. I read the tokens by using getParsedProgramAccounts. In the last weeks I read the tokens with amount of 0 to see which were once connected with the program Id. However, ...
Kevin's user avatar
  • 1
3 votes
3 answers
1k views

How can I convert a number to a base58 string?

I need to convert a number (ex. 1, 2, 32, 43, etc) into a base58 string in order to use it in getProgramAccounts memcmp filters. I'm able to do this with strings, but I've been unable to find a ...
web3man's user avatar
  • 87
2 votes
2 answers
170 views

How to calculate offset for the Stake Program in getProgramAccounts

I'd like to come up with the right memcmp->offset filter to be used with getProgramAccounts. I am trying to query stake accounts associated with a voter. I spent a bunch of time looking up the ...
Arash's user avatar
  • 23
3 votes
1 answer
222 views

How can I use memcmp to get an account with a certain u32 value?

I'm trying to fetch all of a certain account that matches defined u32 values. My account struct looks something like this: #[account] pub struct Round { pub bump: u8, // 1 pub authority: ...
web3man's user avatar
  • 87
1 vote
1 answer
400 views

How can base64 encoded replies be requested for `getProgramAccounts`

I am currently using getProgramAccounts but receiving following error. { "jsonrpc":"2.0", "error":{ "code":-32600, "message":"...
gud's user avatar
  • 447
1 vote
1 answer
1k views

Rust Client - Get Serum liquidity pool info

I'd like to get account data from a Serum Liquidity Pool in my Solana Rust Client. I have chosen the path to do this in Rust, so please avoid asking why I don't do this in TypeScript. I have ...
CTKI's user avatar
  • 63
5 votes
2 answers
616 views

Can an RPC node maintain an index of accounts per a certain query?

For example, the getProgramAccounts RPC method allows one to query accounts. There are two parameters in particular which I think could be useful here: program-id memcap, which refers to a byte ...
agrippa's user avatar
  • 116
3 votes
2 answers
119 views

How the scope for memcmp works when the struct has multiple strings?

Let's imagine I have this account and I want to filter all the Program Accounts by the author: pub struct EntryBook { title: String, author: String } How would be the offset to target the ...
Silvestre Vivo's user avatar
0 votes
1 answer
58 views

Who does the search for `getProgramAccounts()` call?

Do the RPC nodes do the search or do they distribute it to the validator nodes? If it is RPC nodes, do they have to store the entire ledger to do this?
itsfarseen's user avatar
7 votes
1 answer
145 views

Do the `length` and `memcmp` filters of `getProgramAccounts()` reduce the scan space?

Do they use a linear search or do they have any search indexes in place for the length and memcmp filters? Or do they just save us from sending all the accounts over the network, and the CPU usage ...
itsfarseen's user avatar
7 votes
1 answer
129 views

What is the algorithmic complexity of the getProgramAccounts() call?

How does the getProgramAccounts() scale as the number of accounts stored on the chain grows?
itsfarseen's user avatar
1 vote
0 answers
71 views

What are the performance characteristics of the getProgramAccounts() call? Is it scalable as the chain grows? [closed]

What is the algorithmic complexity of a getProgramAccounts() call? Do the Solana nodes store all the accounts ever created? Do the nodes have to scan the entire ledger? Are there any indexes in place? ...
itsfarseen's user avatar