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 not deleted user 153
2 votes

Porting large Rust project to Solana

These are the on-chain restrictions that apply to the Rust code. For example, I noticed some instances of unsafe Rust in the code that will not work on-chain. These restrictions apply to both your cod …
sohrab's user avatar
  • 1,851
4 votes
Accepted

Is the instructions made up of programs?

The term "instruction" tends to get overloaded. In the purest form, a Solana transaction is made up of one or more instructions. An instruction just describes a program invocation. Let's use an analog …
sohrab's user avatar
  • 1,851
1 vote

How to get Solana program name

The Solana guys have an extensive lookup in their explorer here. It may not be as complete as some of the other explorers. But at least, it is open-source.
sohrab's user avatar
  • 1,851
2 votes

How to define constant Pubkeys while developing with Anchor?

Edit: Per @trent.sol comment, there is an even more natural macro that can be used: use solana_program::{pubkey, pubkey::Pubkey}; static ID: Pubkey = pubkey!("My11111111111111111111111111111111111111 …
sohrab's user avatar
  • 1,851
1 vote
Accepted

Calculate account size in anchor

That looks right to me. Nested structs just get laid out per their fields with no additional prefixes. I find this reference quite handy for this stuff: https://www.anchor-lang.com/docs/space
sohrab's user avatar
  • 1,851
1 vote

How to get the source and destination of any solana transaction?

If you are talking about the transfer of funds, you will have to look at the Transfer inner instructions. There are 6 of them in your example. Please note for accounts owned by a Program itself, it ca …
sohrab's user avatar
  • 1,851
1 vote

Why is this function failing to fetch my program account's public key?

I feel you are running out of space on base_account. You have allocated 10000 bytes. Let's look at how much space it will take to store this: 8 [discriminator] + 8 [total_posts] + 4 [vector prefix] + …
sohrab's user avatar
  • 1,851
1 vote

How do I alter the css on the solana react module? (with typescript & tailwind)

The Wallet adapter components set CSS class names that can be styled. Not enough details in the question for me to know how you are using TailwindCSS but if it is via CSS file, then here is an example …
sohrab's user avatar
  • 1,851
6 votes
Accepted

How can I create a PDA account dynamically or conditionally

The best way to see what Anchor is currently doing is to use anchor expand to see the expanded macros. Then you can pull that logic inside your own function. How can we check if a PDA account alread …
sohrab's user avatar
  • 1,851
1 vote

How to store signatures in a Solana account

Signatures can be stored as 64 bytes. Simply decode it back, say using bs58: pub struct MyAccount { signature: [u8; 64], } let my_account = MyAccount { signature: bs58::decode("<your signature b5 …
sohrab's user avatar
  • 1,851
3 votes

SOLVED - Executing a transfer transaction - does Rust need additional data (AccountInfo) com...

I am not sure you can compare those two scenarios: In Rust one, you are in the middle of an on-going transaction, making a CPI call to another program In JS one, you are composing a new transaction a …
sohrab's user avatar
  • 1,851
7 votes
Accepted

Do I have to use Borsh for serialization?

Do you perchance mean Borsh? Solana is not opinionated about which serialisation/deserialisation library you use in your program. The protocol just expects a byte array for account and instruction dat …
sohrab's user avatar
  • 1,851