Skip to content

What is the first 8 bytes of the instruction's data ? #2662

Closed Answered by buffalojoec
pooriagg asked this question in Q&A
Discussion options

You must be logged in to vote
let ix_name = "update";
let preimage = format!("global:{ix_name}");
let hash = solana_program::hash::hash(preimage.as_bytes()); // SHA256
let discriminator = &hash.to_bytes()[..8];
println!("discriminator: {:?}", discriminator);

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@pooriagg
Comment options

@buffalojoec
Comment options

Answer selected by pooriagg
@pooriagg
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants