Mutation
Last updated
Last updated
EVM
Solana
First time
The flag init
or init_if_needed
is required to initialize the Counter
account.
Notes on some terminologies:
seeds - It is used to derive the address (Program Derived Address). It can be static or dynamic and it can contain multiple elements
seeds::program - It is used to derive the address for other programs
bump - Bump seed is a provided value that ensures the account's address is off the Ed25519 curve. An address that's off the curve does not have a corresponding private key
space - Each account occupies some space and it tells Solana how much space is needed. There is always an extra 8 bytes for Anchor Discriminator. This explains it well.
Not the first time
The flag mut
is required to let Solana know that the account is mutable. The program will if the flag is not present!