Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 84
1 vote

What is the interface and accountinterface in anchorlang

Interface and InterfaceAccount are useful when your program can handle any account or program that adheres to a particular interface. By default, if you require an account type or program, Anchor enfo …
Jon C's user avatar
  • 19.6k
1 vote
Accepted

how to get transaction hash status & signer details using rust anchor framework

You mention the Rust Anchor Framework, but that's only used for on-chain programs. If you're trying to fetch a past transaction, you don't need Anchor, just the JSON RPC API. Specifically, you can u …
Jon C's user avatar
  • 19.6k
6 votes

Stack offset error for anchor build

If we look at the error closely it says Error: Function _ZN14solana_program4vote5state9VoteState11deserialize17h4e0d3b92a7040b50E Stack offset of 6344 exceeded max offset of 4096 by 2248 bytes, please …
Jon C's user avatar
  • 19.6k
1 vote

cannot transmute between types of different sizes, or dependently-sized types

This is a guess, since the error message is confusing, but you should try to make sure that your type aligns on an address of 1 using arrays, ie: #[zero_copy] #[repr(C)] #[derive(Debug, Default)] pub …
Jon C's user avatar
  • 19.6k
1 vote

Validate secp256k1 ethereum signature?

The instruction expects it'll receive raw bytes, and not a hex string, so you'll also need to decode the hex strings as bytes: let recovered_pubkey = secp256k1_recover( &hex::decod …
Jon C's user avatar
  • 19.6k
3 votes

Does Solana log changes to data on a program account?

Only transaction data is persisted longterm and accessible through the public RPC nodes at api.mainnet-beta.com, and the actual account contents are not snapshotted at each transaction. You can fetch …
Jon C's user avatar
  • 19.6k
2 votes

Is it possible to figure out which instruction is causing the stack access violation

The function is given in the error message: _ZN112_$LT$solana_program..instruction..InstructionError$u20$as$u20$solana_frozen_abi..abi_example..AbiEnumVisitor$GT$13visit_for_abi17h14ef924a4ab59970E A …
Jon C's user avatar
  • 19.6k
2 votes
Accepted

anchor-spl library 0.25.0 breaks on build

The build error tells you that solana-program-test = "=1.10.38" requires spl-associated-token-account 1.1.1, but anchor requires 1.0.5, so you'll have to drop solana-program-test to a lower version th …
Jon C's user avatar
  • 19.6k
1 vote

Is it safe to assume that the program_id passed via the solana runtime Entrypoint cannot be ...

If you look at the definition of the program entrypoint at https://docs.solana.com/developing/on-chain-programs/developing-rust#program-entrypoint, you'll see: This entrypoint takes a generic byte ar …
Jon C's user avatar
  • 19.6k
1 vote
Accepted

How to know if the an account already exists when using Anchor's init_if_needed feature

Unfortunately, the only way is to add fields to the account. By the time your program sees it, it'll just see an initialized account. Depending on what you need, you could ask the anchor team to add a …
Jon C's user avatar
  • 19.6k
1 vote

struct takes 0 lifetime arguments but 1 lifetime argument was supplied expected 0 lifetime a...

You've imported the Account from the SPL Token account, and not the Anchor account. Try to remove use anchor_spl::token::spl_token::state::Account; since the Anchor Account is part of the Anchor prelu …
Jon C's user avatar
  • 19.6k
3 votes
Accepted

What exactly are `Interface<'info, T>` and `InterfaceAccount<'info, T>`

The Anchor account types documentation says: Interface: Type validating that the account is one of a set of given Programs This just means that the given account is one of a set. For example, if you …
Jon C's user avatar
  • 19.6k
1 vote

Why do I get Invalid account data when trying to reopen a token account?

Before initializing any account, you need to "create" it, meaning you system_instruction::allocate 165 bytes and system_instruction::assign it to the token program.
Jon C's user avatar
  • 19.6k
4 votes

what is the name of the second parameter for `CpiContext`

Once in awhile, you have to pull out the oldie-but-goodie: use the source, Luke! If we look at the definition of CpiContext::new at https://github.com/coral-xyz/anchor/blob/3c6fc2ba2d06a799b53b27a282e …
Jon C's user avatar
  • 19.6k
2 votes
Accepted

Anchor build error with apecs crate

Unfortunately, Solana programs cannot bring in every possible dependency, mainly because the runtime only provides access to certain syscalls. The apecs crate appears to bring in many other dependenci …
Jon C's user avatar
  • 19.6k

15 30 50 per page