Skip to main content
26 votes
Accepted

'blockstore error' when starting solana-test-validator on MacOS 13.0.1

it seems like something is not right with the tar version in Mac OS 13. I could fix the issue by replacing tar with a homebrew gnu version: brew install gnu-tar # Put this in ~/.zshrc export PATH=&...
rado0x54's user avatar
  • 286
8 votes
Accepted

How to reduce stack space usage for Anchor programs?

Box Accounts Boxing accounts in #[Accounts] struct moves the account variables from the stack to the heap. This however requires you to be able to deserialize the account with an #[account] type. Eg ...
Richard's user avatar
  • 580
7 votes

Error Code: DeclaredProgramIdMismatch

I saw you found the solution, but the issue is more related to the Anchor workflow, which is not correctly explained in the Anchor book as far as I know. When you are compiling a Solana program built ...
nf0x's user avatar
  • 336
7 votes
Accepted

Anchor build errors due to 'getrandom' and 'let...else'

Try using the following dependencies. [dependencies] anchor-lang = "0.27.0" anchor-spl = "0.27.0" getrandom = { version = "0.2.9", features = ["custom"] } ...
john's user avatar
  • 7,487
6 votes

error: package `solana-program v1.18.1` cannot be built because it requires rustc 1.72.0 or newer

I had the same issue for a new program I created. However the older program which I created a couple of days back still works fine. I referred to solana building error for v1.16.3. it says I have ...
Dwarum's user avatar
  • 61
5 votes
Accepted

How to interpret an InstructionError from solana/web3.js?

InstructionErrors are a variant of TransactionError, a core feature, nothing to do with web3.js specifically. The first item in the tuple is the index (zero-based) of the instruction which raised the ...
trent.sol's user avatar
  • 4,425
5 votes
Accepted

How to react to this RPC error as a dev: Node is behind by 166 slots

This means the RPC node you are using can't keep up with leader for some reason (network, load surge, etc). You can't do anything about it, just wait until it catches up, or use another RPC to send ...
Vladyslav Melnychenko's user avatar
5 votes
Accepted

get Solana transaction status using Rust

You are probably using outdated version of solana docs. In the latest version, Signature implements FromStr so you can do the following: let sig = Signature::from_str(sig_s).unwrap(); And that'll get ...
AKSHAY DHAYAL's user avatar
5 votes

What is the likely cause of the error `The program could not deserialize the given instruction`

The problem that you are addressing is related to passing incorrectly serialized instruction data to the program as @Henry said above, but in my case, I had this issue with the #[instruction(...)] ...
Reza Aslejeddian's user avatar
5 votes

'please minimize large stack variables' error on building hello_world

This specific problem from the InstructionError was introduced in the 1.18.0 release and is being tracked in https://github.com/solana-labs/solana/issues/35003. This was fixed in 1.18.2 - please ...
acheron's user avatar
  • 2,699
4 votes

Error on connection.confirmTransaction: ws error

Error 401 means "unauthorized", so it appears that the RPC endpoint that you're using doesn't authorize you for websockets. This means that the client doesn't see the transaction get ...
Jon C's user avatar
  • 16.1k
4 votes

ValueError: signature error: Cannot decompress Edwards point

This is a mistake in the cookbook. It's passing in a seed to from_bytes, when there's already a Keypair.from_seed implementation. Use that instead, ie: mnemo = Mnemonic("english") words = ...
Jon C's user avatar
  • 16.1k
4 votes

You cannot/should not initialize the payer account as a program account

It looks like you didn't provide the staking_pool account: #[account(init, payer = owner, space = StakingPool::LEN + 8)] pub staking_pool: Account<'info, StakingPool>, The account is ...
john's user avatar
  • 7,487
3 votes

Error: Non-base58 character

PROBLEM SOLVED My part on the client side was perfect. The thing that caused the error was an account (not used by the instruction) that will be used to do fetch later. Therefore, if you see this ...
Mateo Lafalce's user avatar
3 votes

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'publicKey') in solana

Use the variable defined for useAnchorWallet() instead const anchorWallet = useAnchorWallet(); let tx = await program.methods.initialize(a,b) .accounts({ addAccount: addAccount.publicKey, user: ...
Joey Meere's user avatar
  • 1,445
3 votes
Accepted

How do I deploy a program to Solana - Solana/Rust

A couple things to make sure of: The localhost (as opposed to devnet) is set via solana config set --url localhost You have generated a new keypair solana-keygen new
AKSHAY DHAYAL's user avatar
3 votes

What is the likely cause of the error `The program could not deserialize the given instruction`

Typically this error is because the IDL or client-gen code is out of date and the code is passing incorrectly serialized instruction data to the program.
Henry E's user avatar
  • 3,050
3 votes
Accepted

Getting issue “failed to resolve: maybe a missing crate `solana_program`?”

I also had this issue. Took me a while to figure out, but in the end, the reason was that I was missing an edition value in Cargo.toml. I had: [package] name = "program" version = "0.0....
AKSHAY DHAYAL's user avatar
3 votes
Accepted

Where do InstructionErrors go?

Ok I found what I was doing wrong. I wasn't handling caught errors correctly on client side. I had to change this from the wrong way ... } catch { console.log(Error) } to the right way ... } ...
Blair Munro's user avatar
3 votes

Issue, transfer SOL via CPI call

Your struct PullStrings<'info> needs to list the receiver ("to" account). Then, in the code for pull_strings, you need to add the receiver account to the CPI call, calling set_data. ...
AllBlooming's user avatar
  • 2,269
3 votes
Accepted

Error Code: DeclaredProgramIdMismatch

FIXED: Searched for the name of my program in the project directory and found out that it was a mismatch in the Anchor.toml file. [features] seeds = false [programs.localnet] boync_anchor_program = &...
Daniel Pavel's user avatar
3 votes

System Program undeclared crate in Anchor

you have system_program:: used but you need to import it use anchor_lang::solana_program::system_program; But this does not has create_account use anchor_lang::solana_program::system_instruction::...
Yilmaz's user avatar
  • 1,164
3 votes

solana playground: Reason: Program failed to complete

Why transaction fails The program fails to complete because Anchor accounts require at least 8 bytes of data because of Anchor's discriminator. The following line in SetInstructions struct sets the ...
acheron's user avatar
  • 2,699
2 votes
Accepted

Error: SolanaJSONRPCError code:-32602

In the JSON-RPC spec, -32602 means "invalid params". So somehow, that 10% of the time there is likely something wrong with the request parameters. https://www.jsonrpc.org/specification#...
HelmetFace's user avatar
  • 1,757
2 votes

solana-test-validator "Illegal instruction" mac M1

As suggested by @trent.sol you don't need rosetta anymore, just use the native mac arm64 binary releases now. To make it easier for others, install the releases from here. you can follow the below ...
Vijay Gupta's user avatar
2 votes

Is it possible to test an RPC?

You can test the current health of a node using the getHealth RPC method defined in the documentation. For example a request would look like: curl http://localhost:8899 -X POST -H "Content-Type: ...
Jacob Creech's user avatar
  • 3,874
2 votes

Requesting airdrop of SOL on devnet or testnet throws error, rate limit is reached, even though I never reached the rate limit in the first place

Your Public Network IP address gets changed whenever you restart your WiFi router or switch to a different network. Since, most of the faucet/airdrop APIs are conditioned and developed in such a way ...
Dwarkesh Purohit's user avatar
2 votes

How to react to this RPC error as a dev: Node is behind by 166 slots

@vladyslav-melnychenko's answer is correct with regard to cause. However if you know you're using a load-balanced RPC endpoint, it is typically okay to retry the operation at a reasonable rate until ...
trent.sol's user avatar
  • 4,425
2 votes

Issues with Using AnchorSerialize and AnchorDeserialize Traits

When you declare TokenInfo to contain a Mint and Token, it means that the data inside the mint and token are copied into your account. Typically, this is wasteful and inefficient because you'll use up ...
Jon C's user avatar
  • 16.1k
2 votes

You cannot/should not initialize the payer account as a program account

if it's not fixed yet, and you could share the repo i can maybe help you better. But from just your initialize context: You are missing your owner ATA. Should be something like this : Ex: #[account( ...
beliveN DAOist.dev's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible