Understanding Authorities, Owners, and Accounts on the Solana Blockchain

In my recent studies on the Solana blockchain, I delved into the intricacies of account types, ownership, and the roles of authorities within this decentralized ecosystem. Below, I’ll share key insights and learnings from my latest lecture, which provi…


This content originally appeared on DEV Community and was authored by Nikhil Tiwari

In my recent studies on the Solana blockchain, I delved into the intricacies of account types, ownership, and the roles of authorities within this decentralized ecosystem. Below, I’ll share key insights and learnings from my latest lecture, which provided a comprehensive overview of how accounts function on Solana.

Types of Accounts on Solana

Solana supports various types of accounts, each serving a specific purpose:

  1. Normal Accounts: These are the most straightforward accounts, primarily used to store SOL (the native cryptocurrency of Solana).

  2. Program Accounts: This type of account contains executable code and a rent exemption amount. It has its executable attribute set to true, enabling it to execute the associated program’s logic.

  3. Data Accounts: Unlike program accounts, data accounts store data associated with a specific program. These accounts also include a rent exemption amount.

By default, every account is owned by the System Program, a native program that is an integral part of Solana's runtime environment.

Account Structure

Each account on the Solana blockchain is represented by a 32-byte address. This address points to an account info object that holds crucial information:

  • Lamports: The amount of SOL stored in the account.
  • Allocated Data: The size of the allocated data in bytes.
  • Owner: The program that owns the account (initially the System Program).
  • Executable: A boolean indicating whether the account is executable.

It's essential to note that even if an account has no data, it must contain a small amount of SOL to exist on the blockchain.

Ownership and Custom Programs

The Token Program owns token mints, allowing for the creation and management of tokens on Solana. Additionally, developers can deploy their programs to the Solana blockchain. Accounts derived from these programs will have the program as their owner, facilitating the storage of user-specific data.

All programs are owned by the BPF Loader Program, except native programs.

The System Program

The System Program is a native program that has existed since the first block of the Solana blockchain. It is responsible for creating new accounts. Interestingly, ownership of an account can change from the System Program to a custom program, allowing the latter to manage newly created accounts.

I also learned how to send a transaction using the System Program and create an account with specific data and the minimum required rent exemption.

The BPF Loader Program

The BPF Loader Program is responsible for deploying, upgrading, and executing custom programs, making it a vital component of the Solana ecosystem.

Authorities vs. Owners

A critical distinction in the Solana architecture is between authorities and owners. Authorities are accounts with special permissions, including minting, freezing, and upgrading tokens.

  • Mint Authority: This account can create more supply. If there’s no mint authority, the token has a fixed supply.
  • Freeze Authority: This authority can freeze the token supply in cases of suspected fraud.
  • Upgrade Authority: This authority can modify the program, which is a unique aspect of Solana—programs are mutable, unlike smart contracts on Ethereum.

Recap of Key Concepts

This lecture served as a recap and continuation of previous discussions on accounts in Solana. Here are some additional highlights regarding Program Derived Addresses (PDAs) and mint accounts:

  • Both mint accounts and PDAs are owned by the Token Program.
  • PDAs are unique as they do not have a private key and can be deterministically created using seeds.
  • The spl-token create-token command generates a mint account, while the spl-token create-account command creates an associated token account (PDA) for minting more tokens.

Important Terminology

  • Seeds: These are words used to derive an address.
  • Bump: A number between 1-255 that ensures the PDA is off the curve (i.e., does not have a private key).
  • Associated Token Program: An essential program that owns the associated token accounts.

When creating an associated token account, the seeds include the token program address, the token mint address, and the user's address. The order of these seeds is crucial.

To ensure that a derived PDA remains off the curve, we use a bump seed that starts at 255. If the generated PDA lies on the curve, we decrease the bump seed until we find a suitable address.

Conclusion

Understanding the roles of different account types, ownership, and authorities in Solana is fundamental for anyone looking to develop on this blockchain. With its unique architecture and capabilities, Solana provides developers with powerful tools to create and manage decentralized applications (dApps) effectively.

As I continue my journey in learning about Solana, I look forward to exploring more advanced concepts and building innovative projects in this exciting ecosystem!


This content originally appeared on DEV Community and was authored by Nikhil Tiwari


Print Share Comment Cite Upload Translate Updates
APA

Nikhil Tiwari | Sciencx (2024-09-26T22:15:55+00:00) Understanding Authorities, Owners, and Accounts on the Solana Blockchain. Retrieved from https://www.scien.cx/2024/09/26/understanding-authorities-owners-and-accounts-on-the-solana-blockchain/

MLA
" » Understanding Authorities, Owners, and Accounts on the Solana Blockchain." Nikhil Tiwari | Sciencx - Thursday September 26, 2024, https://www.scien.cx/2024/09/26/understanding-authorities-owners-and-accounts-on-the-solana-blockchain/
HARVARD
Nikhil Tiwari | Sciencx Thursday September 26, 2024 » Understanding Authorities, Owners, and Accounts on the Solana Blockchain., viewed ,<https://www.scien.cx/2024/09/26/understanding-authorities-owners-and-accounts-on-the-solana-blockchain/>
VANCOUVER
Nikhil Tiwari | Sciencx - » Understanding Authorities, Owners, and Accounts on the Solana Blockchain. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/26/understanding-authorities-owners-and-accounts-on-the-solana-blockchain/
CHICAGO
" » Understanding Authorities, Owners, and Accounts on the Solana Blockchain." Nikhil Tiwari | Sciencx - Accessed . https://www.scien.cx/2024/09/26/understanding-authorities-owners-and-accounts-on-the-solana-blockchain/
IEEE
" » Understanding Authorities, Owners, and Accounts on the Solana Blockchain." Nikhil Tiwari | Sciencx [Online]. Available: https://www.scien.cx/2024/09/26/understanding-authorities-owners-and-accounts-on-the-solana-blockchain/. [Accessed: ]
rf:citation
» Understanding Authorities, Owners, and Accounts on the Solana Blockchain | Nikhil Tiwari | Sciencx | https://www.scien.cx/2024/09/26/understanding-authorities-owners-and-accounts-on-the-solana-blockchain/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.