Build on Solana
Skim through the following sections. You can always come back to them.
C. Accounts
In Solana, an account is a persistent memory structure that a program can use for storing state. Every account in Solana is initially owned by the system program, but the system program can change the ownership if the correct private key for the account is provided. Each account includes several properties:
- Public Key (Pubkey): This is the unique identifier of the account.
- Signer Flag (is_signer): This flag indicates whether the account is a signer of the transaction. If true, the transaction must include the signature of this account.
- Writable Flag (is_writable): This flag indicates whether the data in the account can be modified. If true, the account's data can be written to in the current transaction.
- Lamports: This is the number of lamport's (the smallest unit of the native SOL token) held in the account. Lamports also serve as rent to keep the account on the network.
- Data: This is a byte array that can hold arbitrary data.
- Owner: This is another public key that identifies the program that has authority over the account's data. Only the owner program can modify the account's data.
- Executable Flag: Hold if the account is a smart contract.
- Rent Epoch: This value represents the latest epoch that rent has been paid for the account. Rent is paid in SOL and ensures that the account remains active on the network.
In Solana, accounts not only hold the state of a program but can also be used to create complex relationships between different programs.
Comments
You need to enroll in the course to be able to comment!