Getting Started With Solana A Developer S Handbook
Getting Started With Solana A Developer S Handbook
A Developer’s Handbook
Punar Dutt Rajput, Rinki
All rights reserved. No part of this publication may be reproduced, distributed or transmitted in
any form or by any means, including photocopying, recording, or other electronic or mechanical
methods, without the prior written permission of the publisher, except in the case of brief
quotations embodied in critical reviews and certain other noncommercial uses permitted by
copyright law. Although the author/co-author and publisher have made every effort to ensure
that the information in this book was correct at press time, the author/co-author and publisher do
not assume and hereby disclaim any liability to any party for any loss, damage, or disruption
caused by errors or omissions, whether such errors or omissions result from negligence,
accident, or any other cause. The resources in this book are provided for informational purposes
only and should not be used to replace the specialized training and professional judgment of a
health care or mental health care professional. Neither the author/co-author nor the publisher
can be held responsible for the use of the information provided within this book. Please always
consult a trained professional before making any decision regarding the treatment of yourself or
others.
https://www.c-sharpcorner.com/ebooks/ 2
Background and Expertise
Punar Dutt Rajput is a seasoned software engineer with extensive experience in blockchain
technologies and Microsoft platforms. Having worked with various blockchains such as Solana
and NEAR Protocol, he brings a wealth of knowledge and hands-on expertise to the field of
decentralized technologies. In addition to blockchain, he is proficient in Microsoft technologies,
particularly ASP.NET Core.
He holds both a Bachelor's and a Master's degree in Computer Applications from Chhatrapati
Shahu Ji Maharaj University. His academic background, combined with his practical experience,
fuels his passion for advancing and exploring new horizons in blockchain technology. Dedicated
to sharing his insights and innovations, continues to contribute to the evolving landscape of
decentralized applications and digital solutions.
https://www.c-sharpcorner.com/ebooks/ 3
Table of Contents:
Introduction to Solana .................................................................................................................. 5
Setting Up Your Development Environment.................................................................................... 8
Understanding Solana’s Architecture ............................................................................................12
Accounts & Programs ..................................................................................................................17
Solana Explorer ...........................................................................................................................21
Transactions and Instructions .......................................................................................................28
Clusters in Solana ........................................................................................................................32
Tokens in Solana .........................................................................................................................36
Creating Tokens Using CLI ............................................................................................................43
Languages Supported by Solana ...................................................................................................48
Developing and Deploying with Solana Playground ........................................................................53
https://www.c-sharpcorner.com/ebooks/ 4
1
Introduction to Solana
Overview
https://www.c-sharpcorner.com/ebooks/ 5
Introduction
In the ever-evolving world of blockchain technology, Solana emerges as a game-changer. By
leveraging innovative consensus mechanisms like proof-of-history (PoH) and parallel
processing, Solana achieves thousands of transactions per second (TPS) at minimal cost. In
this chapter, we will explore Solana's core features, its advantages over traditional platforms like
Ethereum, and the potential it holds for revolutionizing decentralized ecosystems.
What is Solana?
Solana is a high-performance blockchain platform designed for decentralized applications
(dApps) and crypto-native projects. Launched in March 2020 by Solana Labs, it aims to provide
scalability without sacrificing decentralization or security. At its core, Solana utilizes a unique
blend of innovative technologies to achieve its goals, including a proof-of-history (PoH)
consensus mechanism, proof-of-stake (PoS) validation, and a horizontally scalable architecture.
Solana distinguishes itself through its emphasis on scalability and speed. Traditional blockchain
networks often face scalability issues, leading to congestion and high transaction fees. Solana
addresses this challenge by leveraging its novel consensus mechanism, PoH, which timestamps
transactions before they are processed. This approach enables Solana to achieve high
throughput, with the network capable of processing thousands of transactions per second (TPS)
at a low cost.
Scalability:
Solana's architecture is designed for horizontal scalability, allowing the network to handle
increasing transaction volumes without compromising performance. This scalability is achieved
through its unique consensus mechanism and parallel processing capabilities.
Speed:
Solana boasts one of the fastest transaction processing times among blockchain platforms, with
transactions confirmed in seconds rather than minutes or hours. This speed is critical for
applications requiring real-time interaction and responsiveness.
Low Cost:
By optimizing its protocol for efficiency, Solana offers low transaction fees compared to other
blockchain networks. This affordability makes it an attractive option for developers and users
alike..
Security:
Despite its focus on speed and scalability, Solana maintains a high level of security through its
PoS validation and robust network architecture. By decentralizing control and incentivizing
validators, Solana ensures the integrity and resilience of its blockchain.
https://www.c-sharpcorner.com/ebooks/ 6
Programming Skills: While not strictly necessary, having programming skills, especially in
languages like Rust or JavaScript, can facilitate a deeper understanding of Solana's technical
aspects, such as smart contract development and interacting with the Solana blockchain.
Solana Vs Ethereum
While Ethereum remains the leading platform for smart contracts and decentralized applications,
it faces challenges related to scalability and congestion. Solana seeks to address these issues
with its scalable architecture and high-performance capabilities.
Here's a comparative analysis of Solana and Ethereum across key parameters:
Cost Low transaction fees, making it cost-effective High gas fees during network
for users and developers. congestion, impact usability and
affordability.
Learning Innovative concepts and technologies may be Slightly more approachable for
Curve challenging to grasp initially, especially for newcomers.
beginners in blockchain development.
https://www.c-sharpcorner.com/ebooks/ 7
2
Setting Up Your
Development Environment
Overview
https://www.c-sharpcorner.com/ebooks/ 8
Introduction
A strong development setup is super important for building stuff on Solana. When you set it up
right, it makes everything smoother. Plus, it makes sure your tools work well with Solana's
system, so you can easily use them to create and launch your smart contracts and apps. Having
the right setup also gives you all the tools you need to test and try out your ideas quickly. By
getting to know Solana's system and how to work with it, you can make cool stuff for lots of
different things, like finance or unique digital items.
We can install Solana on three operating systems Windows(WSL), Linux, and MacOS. For now,
we will use Windows(WSL).
Install WSL
WSL, or Windows Subsystem for Linux, is a compatibility layer for Windows that enables you to
run Linux distributions directly on your Windows machine. It allows developers to use Linux
tools, utilities, and command-line interfaces on a Windows environment without the need for
virtual machines or dual-booting. In the context of Solana development, WSL is often used to
create a Linux-like environment on Windows systems, providing seamless compatibility with
Solana's tooling and libraries.
For running the Solana in Windows, we need to install WSL in your machine. Follow this article
to install WSL
Install Rust
Rust is a programming language known for its speed, reliability, and safety features. It's popular
in the development of blockchain projects like Solana because it allows developers to write
efficient and secure code. In the context of setting up a Solana development environment, Rust
is used to write smart contracts that run on the Solana blockchain. It's a key tool in building
decentralized applications on Solana.
We need to install Rust as we write our programs in the Rust language. To install Rust in your
system first open the WSL terminal then paste the following command.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
So we have installed the Rust successfully. Now restart your terminal or run the following
command to refresh your new path setting.
source ~/.bashrc
Run the following command to check whether Rust is installed or not.
rustc --version
https://www.c-sharpcorner.com/ebooks/ 9
You have the option to substitute "stable" with the release tag that corresponds to the software
version you want (such as v1.18.1), or you can opt for one of the three symbolic channel names:
stable, beta, or edge.
Now run the following command to check the version of Solana.
solana --version
Output
solana-cli 1.17.25 (src:d0ed878d; feat:3580551090, client:SolanaLabs)
We have successfully installed the Solana CLI, Let's move to the next step by installing the
'Anchor' framework.
Install Anchor
To set up and maintain different versions of the Anchor framework, we'll use AVM, the Anchor
Version Manager. Because AVM is installed through cargo (Rust's package manager), the
installation process remains consistent across all operating systems. Once installed, AVM
enables us to easily install the specific version of the Anchor framework we need.
Install AVM
Run the following command in your terminal to install avm.
cargo install --git https://github.com/coral-xyz/anchor avm --locked --
force
https://www.c-sharpcorner.com/ebooks/ 10
Let's create a file system wallet to use during the development. Run the following command in
the terminal.
solana-keygen new
The solana-keygen command automatically generates a new file system wallet, which is initially
saved at ~/.config/solana/id.json. You have the option to specify a different location for the
output file by using the --outfile /path option.
https://www.c-sharpcorner.com/ebooks/ 11
3
Understanding Solana’s
Architecture
Overview
https://www.c-sharpcorner.com/ebooks/ 12
Introduction
This chapter explores Solana, a blockchain platform known for processing thousands of
transactions per second. This capability supports various applications, from dApps to digital
asset exchanges. We will examine the consensus mechanism and architecture that enable
Solana's impressive performance.
We will explore how high throughput and low latency transactions are approved and added to
the blockchain by exploring the inner workings of Solana's consensus process, which combines
Proof of Stake (PoS) and Proof of History (PoH).
Consensus Mechanism
Solana's consensus mechanism is a fundamental aspect of its architecture, combining Proof of
History (PoH) and Proof of Stake (PoS) to achieve fast and secure transaction validation.
Proof of History
Solana's PoH is a unique feature that provides a verifiable and trustless record of time in the
blockchain. It establishes a chronological order of events without relying on a centralized clock.
PoH allows validators to timestamp transactions, ensuring the integrity of the blockchain
accurately. PoH encodes the trustless passage of time into a ledger, which is essentially an
append-only data structure. Unlike traditional blockchains that rely on local clocks, PoH provides
verifiable timestamps for events.
https://www.c-sharpcorner.com/ebooks/ 13
propose and validate blocks. This decentralized approach ensures that no single entity
can control the network.
• Synergy Between PoH and PoS: By combining PoH's timestamping capabilities with
PoS's decentralized consensus mechanism, Solana achieves fast and secure
transaction validation. PoH ensures the accurate ordering of transactions, while PoS
prevents double-spending and other malicious activities.
BFT
BFT stands for Byzantine Fault Tolerance, and it's a critical aspect of Solana's consensus
mechanism. In Solana's consensus model, BFT ensures that the network can maintain
agreement and consistency even in the presence of faulty or malicious nodes.
Architecture of Solana
Solana's architecture is designed to support its high-performance blockchain platform, consisting
of several layers that work together to facilitate fast and efficient transaction processing.
Solana's architecture can be divided into three main layers.
https://www.c-sharpcorner.com/ebooks/ 14
• Responsible for validating incoming transactions.
• Utilizes parallel processing to handle multiple transactions simultaneously.
• Includes features like parallel smart contract execution and parallel signature verification.
Consensus Layer
The consensus layer ensures agreement among network participants on the state of the
blockchain. Solana uses a hybrid consensus mechanism, combining Proof of History (PoH) and
Proof of Stake (PoS), to achieve consensus efficiently.
• Combines PoH and PoS.
• Validators use PoH timestamps to order transactions.
• Continuous block production, even if some slots have slow or unresponsive leaders.
1. Nodes
Nodes are individual computers or servers that participate in the Solana network by running
Solana software. There are different types of nodes in Solana.
• Validator Nodes: Validator nodes are responsible for validating transactions, proposing
new blocks, and participating in the consensus process. They play a critical role in
maintaining the integrity and security of the network.
• Replicator Nodes: Replicator nodes replicate and store copies of the blockchain ledger.
They help distribute the load of storing blockchain data across the network, improving
data redundancy and availability.
• Archiver Nodes: Archiver nodes store historical data of the blockchain, including past
transactions and state changes. They provide access to historical data for auditing,
analysis, and other purposes.
2. Validators
Validators are network participants responsible for validating transactions and maintaining the
integrity of the blockchain. Validators play a key role in the consensus process by proposing and
validating new blocks. They are selected based on the number of tokens they hold and stake in
the network.
Validators ensure that transactions adhere to the network's rules and prevent double-spending
and other malicious activities. They participate in a leader election process to propose blocks
and reach a consensus on the state of the blockchain.
https://www.c-sharpcorner.com/ebooks/ 15
3. Cluster Architecture
Solana's cluster architecture consists of multiple nodes distributed across the network. The
cluster architecture ensures decentralization and resilience by distributing the processing and
storage of blockchain data across multiple nodes.
The cluster architecture includes different types of nodes, such as validator nodes, replicator
nodes, and archiver nodes, working together to maintain the integrity and security of the
network. By distributing tasks and responsibilities across the network, the cluster architecture
improves scalability, fault tolerance, and performance.
https://www.c-sharpcorner.com/ebooks/ 16
4
Accounts & Programs
Overview
https://www.c-sharpcorner.com/ebooks/ 17
Introduction
Programs in Solana are the magic that brings decentralized applications to life. They provide the
instructions for how the blockchain should operate, while accounts serve as the containers for
storing data. Together, they form the backbone of the Solana ecosystem, enabling developers to
build powerful, decentralized solutions for a wide range of applications. In comparison, PDA can
be used for deterministic addresses.
Solana's innovative approach to building decentralized applications revolves around the
concepts of Programs, Accounts, and PDAs. These foundational elements form the backbone of
the Solana ecosystem, enabling developers to create high-performance DApps with ease.
Programs in Solana
In Solana, programs are like the building blocks of decentralized applications. Think of them as
the contracts powering various functions and operations on the Solana blockchain. These
programs are typically written in languages like Rust or C/C++, known for their reliability and
efficiency.
In other words, Programs are nothing but "Smart Contracts". If you are from some other
blockchain like Ethereum, you must be familiar with Smart contracts even if you are not, there is
no need to worry as we will be covering all the aspects of programs.
Each program is an on-chain account that stores some executable code that is organized into
specific functions known as instructions. It can be updated only by the upgrade authority, i.e. the
account that deployed the program on the chain. If the upgrade authority is set to null then the
program becomes immutable.
So, what do these programs do? They enable a wide range of functionalities, from token swaps
to decentralized finance (DeFi) protocols and even non-fungible token (NFT) marketplaces.
Essentially, anything you can imagine doing on a blockchain can be achieved through these
programs.
Example: Let's say you want to create a decentralized voting application on Solana. You would
write a program that includes instructions for:
• Creating a new voting session.
• Allowing users to cast their votes.
• Tallying the votes securely.
Each of these tasks would be defined in the program's code. For instance, the program would
specify how to record a user's vote, ensure that each user can only vote once, and count the
votes accurately.
Accounts in Solana
In Solana, accounts serve as the data containers that hold information about various entities on
the blockchain. These entities could be tokens, programs, or even user balances. In the
account, all data is stored in a key-value pair, where the key will be the address and the value
will be the account information. An account can store up to 10MB of data. Some rent is
deposited based on the amount of data stored in the account and can be refunded once the
account is closed.
Accounts come in different types, such as program accounts, user accounts, and system
accounts. Each type of account plays a specific role in the Solana ecosystem. For example,
program accounts store the code and state of programs, while user accounts hold the balances
and transaction history of individual users.
https://www.c-sharpcorner.com/ebooks/ 18
Now, let's talk about how programs interact with accounts on Solana. Think of accounts as the
storage units where data is kept on the blockchain. In our voting example, each voter's
information, including their choices, would be stored in individual accounts.
The program would interact with these accounts by reading data from them (to check if a user
has already voted, for example) and writing data to them (to record a user's vote). This
interaction ensures that the voting process is transparent, secure, and tamper-proof.
When a program is deployed, three types of accounts are created. They are-
• Buffer Account: A buffer account is a temporary account that stores byte code while the
program is being deployed on-chain or upgraded. Once this process is complete, all data
is transferred to the Program Executable Data Account, and the buffer account is closed.
• Program Executable Data Account: It is an account that contains the executable byte
code of the program.
• Program Account: It is the main account representing the on-chain program. It stores
the address of the executable data account, and the address authorized to make
changes to the program.
https://www.c-sharpcorner.com/ebooks/ 19
console.log(`PDA: ${PDA}`);
console.log(`Bump: ${bump}`);
In the above code, the first line imports the PublicKey class from the @solana/web3.js library.
The PublicKey class is used to represent public keys on the Solana blockchain. In the next line,
we create a new PublicKey object representing the program ID
"11111111111111111111111111111111". In Solana, programs are identified by their program
ID, and this line sets the program ID for the program being interacted with. In the next line, we
define a string "hello" that will be used in the next steps. In the next line, we use, the
findProgramAddressSync method called on the PublicKey class to synchronously find the
Program Derived Address (PDA) and the bump seed. The first argument is an array containing
the buffer representation of the string "hello". The Buffer.from() method converts the string to a
buffer. The second argument is the program id. The method returns an array containing the PDA
and the bump seeds. At last, we log the PDA and the bump seed to the console.
And our PDA is derived.
https://www.c-sharpcorner.com/ebooks/ 20
5
Solana Explorer
Overview
https://www.c-sharpcorner.com/ebooks/ 21
Introduction
Explorers are essential tools in the blockchain ecosystem, offering real-time visibility into
transactions, addresses, and blocks. They empower users, developers, and investors by
providing insights into network activity, debugging smart contracts, and tracking token
movements. This chapter aims to spotlight top explorers in the Solana ecosystem, aiding users
in selecting reliable tools and providing insights into Solana's dynamics and future trends.
Top Explorers
Explorer Strengths Weaknesses Unique Offerings and Value Propositions
SolanaFM Real-time Limited community Advanced analytics and insights. Developer tools
transaction engagement. for smart contract debugging. Customizable
tracking dashboard for personalized user experience.
Solscan Reliable Limited features API access for developers.
performance compared to others.
Solana Feature-rich Some users report Support for token analysis and portfolio tracking.
Beach explorer occasional downtime. Modern and intuitive interface.
Solana User-friendly Limited community Developer tools for smart contract debugging.
Explorer interface engagement.
OKLink Versatility It may lack specialized Support for multi-chain integration. Real-time
across multiple features for the Solana updates. Advanced analytics and visualizations.
blockchains ecosystem.
https://www.c-sharpcorner.com/ebooks/ 22
SolanaFM
SolanaFM is a comprehensive explorer of the Solana blockchain, offering a wide range of
features and tools for users, developers, and investors. It provides real-time visibility into
transactions, blocks, and accounts on the Solana network.
(source: https://solana.fm/)
Key Features
• Real-time transaction tracking
• Block explorer with detailed information
• Account monitoring and balance tracking
• Advanced analytics and insights
• Developer tools for smart contract debugging
• Customizable dashboard for personalized user experience
User Experience
SolanaFM offers a user-friendly interface with intuitive navigation and clear visualization of data.
Users can easily search for transactions, explore block details, and monitor their accounts. The
platform's responsive design ensures a seamless experience across devices.
Community Engagement
SolanaFM actively engages with its community through social media channels, forums, and
developer documentation. The platform regularly updates its features based on user feedback
and provides responsive customer support. Community-driven initiatives and educational
resources contribute to a vibrant explorer ecosystem.
Solscan
Solscan is a popular explorer for the Solana blockchain, known for its reliability and
performance. It offers a range of features for tracking transactions, exploring blocks, and
monitoring accounts on the Solana network.
https://www.c-sharpcorner.com/ebooks/ 23
(source: https://solscan.io/)
Key Features
• Transaction explorer with real-time updates
• Block details and confirmation times
• Account monitoring and balance tracking
• Rich analytics and visualizations
• API access for developers
User Experience
Solscan provides a clean and user-friendly interface, making it easy for users to navigate and
find the information they need. The platform offers fast response times and reliable
performance, ensuring a smooth user experience.
Community Engagement
Solscan maintains an active presence in the Solana community, regularly interacting with users
through social media and forums. The platform solicits feedback from its users and incorporates
community suggestions into its development roadmap. Developer resources and documentation
contribute to a supportive explorer ecosystem.
Solana Beach
Solana Beach is a feature-rich explorer for the Solana blockchain, offering a comprehensive
suite of tools for users, developers, and investors. It provides detailed insights into transactions,
blocks, and accounts on the Solana network.
(source: https://solanabeach.io/)
https://www.c-sharpcorner.com/ebooks/ 24
Key Features
• Transaction explorer with detailed transaction history
• Block explorer with real-time updates
• Account monitoring and balance tracking
• Advanced analytics and visualizations
• Support for token analysis and portfolio tracking
User Experience
Solana Beach offers a modern and intuitive interface, making it easy for users to navigate and
explore the blockchain. The platform's responsive design ensures a seamless experience
across devices, while its rich visualizations provide valuable insights into network activity.
Community Engagement
Solana Beach actively engages with its community through social media channels, forums, and
developer documentation. The platform welcomes user feedback and suggestions for
improvement, demonstrating a commitment to serving its users. Community-driven initiatives
and educational resources contribute to a thriving explorer ecosystem
Solana Explorer
Solana Explorer is a reliable and user-friendly explorer designed for the Solana blockchain. It
offers a range of features for tracking transactions, exploring blocks, and monitoring accounts,
catering to the needs of users, developers, and investors.
(source: https://explorer.solana.com/)
Key Features
• Real-time transaction tracking with detailed information
• Block explorer with comprehensive block details
• Account monitoring and balance tracking
• Advanced analytics and visualizations
https://www.c-sharpcorner.com/ebooks/ 25
• Developer tools for smart contract debugging
User Experience
Solana Explorer provides a straightforward and intuitive interface, making it easy for users to
access and analyze blockchain data. The platform offers fast response times and reliable
performance, ensuring a seamless user experience.
Community Engagement
Solana Explorer actively engages with its community through social media, forums, and
developer documentation. The platform welcomes user feedback and suggestions for
improvement, demonstrating a commitment to serving its users. Community-driven initiatives
and educational resources contribute to a vibrant explorer ecosystem.
OKLink
OKLink is a versatile explorer offering support for multiple blockchains, including Solana. It
provides a range of features and tools for tracking transactions, exploring blocks, and monitoring
accounts on the Solana network.
(source: https://www.oklink.com/)
Key Features
• Transaction explorer with real-time updates
• Block explorer with detailed block information
• Account monitoring and balance tracking
• Advanced analytics and visualizations
• Support for multi-chain integration
User Experience
OKLink offers a user-friendly interface with intuitive navigation and clear visualization of data.
The platform provides fast response times and reliable performance, ensuring a seamless user
experience.
https://www.c-sharpcorner.com/ebooks/ 26
Community Engagement
OKLink maintains an active presence in the blockchain community, regularly interacting with
users through social media and forums. The platform welcomes user feedback and suggestions
for improvement, demonstrating a commitment to serving its users. Community-driven initiatives
and educational resources contribute to a thriving explorer ecosystem.
https://www.c-sharpcorner.com/ebooks/ 27
6
Transactions and
Instructions
Overview
https://www.c-sharpcorner.com/ebooks/ 28
Introduction
In this chapter, we will read about transactions, instructions, and transaction fees that are the
bedrock of Solana's vibrant digital economy. By understanding these concepts, you'll be well-
equipped to navigate the bustling seas of Solana and seize the endless opportunities it offers.
Transaction
A transaction comprises one or more instructions, each representing a specific operation to be
processed. It is atomic in nature, either fully completes or fully fails. The maximum size of a
transaction is 1232 bytes.
A transaction contains two components: signature and message.
• Signature: Array of signatures of private key.
• Message: Payload of information that we send to the program. In other words, it is a list
of instructions to be processed.
Message
This message comprises four main parts-
• Header: It specifies the number of signer and read-only accounts with or without
signatures.
• Account Addresses: It is an array of addresses of the account that we are going to
interact with.
• Recent Blockhash: It is the hash of the last observed blockchain ledger.
• Instruction: It is the array of instructions to be executed.
Example. Let's say A wants to send 1 SOL to B. Here's what the transaction would look like:
• Signature: A sign the transaction with her private key.
• Message: The header indicates A as the signer. The account addresses are A's and B's
wallet addresses. Recent Blockhash is the hash from the latest block, and the instruction
is the command to transfer 1 SOL from A's account to B's.
https://www.c-sharpcorner.com/ebooks/ 29
Instruction is a request to process a specific action on-chain and is the smallest contiguous unit
of execution logic in a program. An instruction contains the following information-
• Program ID: It specifies the program being invoked by the instruction.
• Accounts: It is the array of accounts the instructions read from or write to.
• Instruction Data: It is a byte array of data that the program will use to handle each
transaction.
Example. Imagine you want to mint a new NFT. Here's what the instruction might include:
Program ID: The ID of the NFT minting program.
Accounts: Your wallet address, the destination account for the NFT, and the mint authority
account.
Instruction Data: Data specifying the metadata of the NFT (e.g., name, description, image
URL).
https://www.c-sharpcorner.com/ebooks/ 30
Furthermore, many Solana wallets and dApps come equipped with built-in fee estimators that
can help you gauge the appropriate fee to include with your transactions. These estimators
factor in current network conditions and transaction demand, providing you with optimal fee
recommendations to ensure your transactions sail smoothly through the digital seas.
https://www.c-sharpcorner.com/ebooks/ 31
7
Clusters in Solana
Overview
https://www.c-sharpcorner.com/ebooks/ 32
Introduction
Blockchain technology has revolutionized various industries by providing decentralized, secure,
and transparent systems for transactions and data management. Among the many blockchain
platforms, Solana stands out for its high-performance capabilities, promising unparalleled speed
and efficiency. A critical component that underpins Solana’s functionality is its clustering system.
Solana clusters form the backbone of the network, ensuring scalability, reliability, and
performance. This article delves into the intricacies of Solana clusters, exploring their structure,
operation, and significance.
Validators
Validators are nodes responsible for processing transactions and adding new blocks to the
blockchain. They verify the correctness of transactions and ensure that the ledger remains
consistent. Validators play a crucial role in maintaining the network's security and performance.
RPC Nodes
Remote Procedure Call (RPC) nodes provide an interface for clients to interact with the
blockchain. They handle requests such as querying account balances, submitting transactions,
and fetching blockchain data. RPC nodes are essential for the seamless operation of
decentralized applications (dApps) and end-user interactions.
Clients
Clients are the end-users and applications that interact with the Solana network. They submit
transactions and query the blockchain via RPC nodes. Clients depend on the network’s
performance and reliability to execute their operations effectively.
Consensus Mechanism
Solana employs a unique consensus mechanism called Proof of History (PoH) combined with
Tower Byzantine Fault Tolerance (BFT). PoH provides a cryptographic clock that allows nodes
to agree on the time order of events, significantly improving throughput and efficiency. Tower
BFT ensures the finality and security of transactions.
https://www.c-sharpcorner.com/ebooks/ 33
Initialization and Bootstrapping
When a new Solana cluster is initialized, the process begins with nodes coming online and
connecting. This bootstrapping process involves nodes synchronizing their local copies of the
blockchain ledger, ensuring that they have the latest state of the network. Nodes also establish
connections with other nodes in the cluster to form a cohesive network. During this phase,
nodes may exchange cryptographic keys and other necessary information to authenticate and
communicate securely.
https://www.c-sharpcorner.com/ebooks/ 34
Efficient resource utilization: Solana's clusters enable efficient resource utilization by
dynamically allocating computational resources based on demand. As transaction volume
fluctuates, clusters can scale up or down accordingly, optimizing performance and cost-
effectiveness. This elasticity ensures that Solana remains responsive and reliable even under
varying workloads, making it well-suited for both small-scale applications and large-scale
enterprise solutions.
Web3 Applications
Solana's distributed architecture enables platforms like Audius to maintain a resilient
infrastructure that empowers content creators and users alike. By leveraging Solana's clusters,
Audius can provide a censorship-resistant platform for sharing and discovering music content,
demonstrating the platform's suitability for Web3 applications that prioritize decentralization and
user empowerment.
Enterprise Solutions
Platforms like Mango Markets rely on Solana's clusters to process transactions quickly and
securely, ensuring efficient price discovery and liquidity provision in the cryptocurrency markets.
Solana's distributed architecture enables platforms like Mango Markets to offer institutional-
grade trading infrastructure to users, highlighting the platform's reliability and scalability in
enterprise settings.
https://www.c-sharpcorner.com/ebooks/ 35
8
Tokens in Solana
Overview
https://www.c-sharpcorner.com/ebooks/ 36
Introduction
Tokens are fundamental building blocks in the Solana ecosystem, serving as the primary
medium of value exchange and a vital component of decentralized applications (dApps). Tokens
on Solana can represent a variety of assets, from digital currencies to real-world assets and
complex financial instruments.
In blockchain technology, tokens are digital assets representing value, ownership, or access
rights within a particular blockchain ecosystem. These tokens can be fungible, meaning they are
identical and interchangeable with one another, like cryptocurrencies, or non-fungible, meaning
they are unique and distinct, like digital collectibles or NFTs (non-fungible tokens).
2. Value Transfer
• One of the primary functions of tokens in Solana is to facilitate the transfer of value
between users and applications. This includes transferring tokens representing
cryptocurrencies, such as SOL (Solana’s native token) or any other SPL Token.
• The efficiency of Solana’s network allows for fast and low-cost transactions, making it
feasible for a wide range of financial applications.
3. Utility in dApps
• Tokens serve various utility purposes within decentralized applications. For instance,
they can be used to pay for services, access premium features, or participate in
governance decisions within a dApp.
• Many DeFi (Decentralized Finance) applications on Solana utilize tokens for lending,
borrowing, staking, and yield farming, where users can earn rewards by providing
liquidity or participating in specific protocols.
4. Incentivization
• Tokens are often used to incentivize user behavior and participation within the Solana
ecosystem. For example, users might earn tokens as rewards for staking SOL to secure
the network or for providing liquidity to a decentralized exchange.
• These incentives help to drive engagement and growth within the network, encouraging
users to contribute to its security and functionality.
https://www.c-sharpcorner.com/ebooks/ 37
5. Asset Representation
• Tokens on Solana can represent ownership of various digital and real-world assets. This
includes digital collectibles (NFTs), real estate, commodities, and other tangible or
intangible assets.
• By tokenizing these assets, Solana enables fractional ownership, increased liquidity, and
broader access to investment opportunities.
1. Token Creation
SPL Tokens are created using the 'spl-token' program, which provides a straightforward way to
mint new tokens. Developers can specify the total supply, decimals (for fractional tokens), and
initial distribution of tokens.
The creation process ensures that the tokens adhere to a standardized format, enabling
compatibility across various dApps and wallets within the Solana network.
2. Token Management
The SPL token standard includes functions for minting new tokens, burning existing tokens, and
freezing or thawing accounts. This gives developers control over the token lifecycle and helps
manage the token economy.
Token accounts in SPL are represented by the 'spl-token' program, which maintains a ledger of
all token balances and transactions.
3. Security Features
SPL Tokens include robust security features such as multi-signature (multisig) support, which
requires multiple private keys to authorize transactions. This enhances security for high-value
tokens and important operations.
The standard also supports various access control mechanisms, allowing token issuers to
implement custom rules for token transfers and usage.
4. Interoperability
The SPL token standard ensures that tokens can be seamlessly integrated with other Solana-
based services and applications. This includes decentralized exchanges (DEXs), wallets, and
other financial protocols.
By adhering to a common standard, SPL tokens can easily be listed and traded on multiple
platforms without requiring custom integration work.
https://www.c-sharpcorner.com/ebooks/ 38
Comparison with Other Blockchain Token Standards (e.g., ERC-
20 on Ethereum)
Comparison SPL Tokens ERC-20 Tokens
Criteria
Flexibility and Core functionalities include token creation, Core functionalities include token
Functionality transfer, and balance management. creation, transfer, and balance
management.
Benefit from Solana's high throughput and low
transaction costs. Widely used in the Ethereum
ecosystem with a broad range of
Rapidly gaining adoption within the Solana
existing dApps and tools.
ecosystem.
Transaction Leverage Solana's high transaction speed and Ethereum often faces congestion and
Speed and Costs low fees for fast and cost-effective transactions. high gas fees, especially during peak
network usage.
Particularly suitable for applications requiring
high scalability.
Development and Integrated development environment with tools Supported by a vast array of
Ecosystem like Solana CLI and Anchor framework for development tools and resources in
building and deploying SPL tokens. the Ethereum ecosystem.
Simplifies the process of development within The abundance of documentation,
the Solana ecosystem. tutorials, and community support.
Interoperability Designed for interoperability within the Solana Extensive adoption and
and Adoption ecosystem. interoperability within the Ethereum
ecosystem.
Quickly integrated into a growing number of
Solana-based projects and services. Compatible with numerous wallets,
exchanges, and DeFi protocols.
https://www.c-sharpcorner.com/ebooks/ 39
Examples and Use Cases
• Digital Art: Artists create and sell unique digital artworks as NFTs, ensuring authenticity
and ownership.
• Collectibles: Digital collectibles like trading cards, in-game items, and virtual real estate
are popular NFT use cases.
• Certification: NFTs can be used to certify ownership or authenticity of physical assets
like real estate, rare items, and more.
Utility Tokens
Utility tokens are designed to provide access to a specific product or service within a blockchain-
based platform. They are not primarily used as a medium of exchange but rather as a functional
tool within an ecosystem.
Governance Tokens
Governance tokens enable holders to participate in the decision-making processes of a
decentralized organization or platform. They often grant voting rights on proposals, upgrades,
and changes to the protocol or ecosystem.
Security Tokens
Security tokens represent ownership in an asset, such as equity in a company, real estate, or
other financial instruments. They are subject to securities regulations and provide investors with
rights such as profit sharing, dividends, or voting power.
https://www.c-sharpcorner.com/ebooks/ 40
Use Cases and Applications of Tokens in Solana
Applications of Fungible Tokens
DeFi (Decentralized Finance)
• Stablecoins: Fungible tokens on Solana are often used as stablecoins, which are
pegged to fiat currencies like USD. For example, USDC and USDT are popular
stablecoins used in various DeFi applications on Solana.
• Lending and Borrowing: Platforms like Solend and Larix allow users to lend and
borrow assets. Fungible tokens serve as collateral for loans and as the assets being lent
or borrowed.
• Decentralized Exchanges (DEXs): DEXs like Serum and Raydium utilize fungible
tokens for trading. Users can swap between different tokens, providing liquidity and
earning fees in the process.
• Yield Farming: Yield farming protocols incentivize users to provide liquidity by rewarding
them with fungible tokens. These tokens often represent a share of the profits generated
by the protocol.
Gaming
• In-Game Currency: Fungible tokens can be used as in-game currencies, enabling
players to purchase items, upgrades, and other digital assets. Games like Star Atlas
leverage fungible tokens for their in-game economy.
• Reward Systems: Players can earn fungible tokens as rewards for achieving milestones
or completing tasks, which can then be traded or used within the game's ecosystem.
Applications of NFTs
Digital Art
• Art Marketplaces: Platforms like Solanart and DigitalEyes allow artists to mint,
showcase, and sell their digital artworks as NFTs. Collectors can purchase unique
pieces, ensuring ownership and authenticity through the blockchain.
• Royalties: Smart contracts on Solana enable artists to receive royalties from secondary
sales, ensuring they benefit from the increasing value of their work.
Collectibles
• Virtual Collectibles: NFTs represent unique virtual items, such as trading cards, virtual
pets, and memorabilia. Projects like SolPunks and Thugbirdz offer unique digital
collectibles that users can trade or showcase.
• Limited Editions: Brands and celebrities release limited edition NFTs, creating a digital
scarcity that drives value and demand among fans and collectors.
https://www.c-sharpcorner.com/ebooks/ 41
• Interoperable Assets: In the metaverse, assets like avatars, accessories, and virtual
goods can be tokenized and transferred across different platforms, providing a seamless
user experience.
Social Tokens
• Creator Economy: Social tokens empower creators and influencers to tokenize their
brands. Fans can purchase these tokens to access exclusive content, participate in
decision-making, and receive rewards. Platforms like Rally are exploring this model on
Solana.
Decentralized Identity
• Self-Sovereign Identity: Using tokens, users can maintain control over their digital
identities. Projects like Civic are developing solutions that leverage blockchain
technology for secure, decentralized identity management.
https://www.c-sharpcorner.com/ebooks/ 42
9
Creating Tokens Using CLI
Overview
In this chapter, you will learn how to create and manage a custom
token on the Solana blockchain using the command-line interface
(CLI). This includes setting up a Solana wallet, installing the necessary
tools, creating and minting tokens, and managing various token
functions such as transfers, limiting supply, and setting permissions.
https://www.c-sharpcorner.com/ebooks/ 43
Introduction
One of the essential features of any blockchain ecosystem is the ability to create and manage
tokens, which can represent various assets, currencies, or utilities within the network.
In this chapter, we will learn how to create a token on the Solana blockchain using the
command-line interface (CLI).
Prerequisites
Before moving ahead, make sure you have the following tools installed on your system.
• Solana CLI
• Rust
• Solana Wallet
If you already have a wallet and want to create another, you can forcefully do this by following
the command.
Solana-keygen new --force
This will create a new key pair forcefully.
You can check the balance of your wallet by following command.
Solana balance
https://www.c-sharpcorner.com/ebooks/ 44
This will airdrop 2 tokens in your devnet account having the above public key. Sometimes the
airdrop may fail due to the limit, you can try again, and it will work.
If you want to get information about your account, use this command.
solana account ************XDyb6MBdBLGr********
This will give you the information associated with the above account.
https://www.c-sharpcorner.com/ebooks/ 45
spl-token supply <CREATED_TOKEN> --url devnet
This command will show you the tokens that are currently present in the supply.
Transferring Tokens
We can transfer our created token to others by following the command.
spl-token transfer <TOKEN_ADDRESS> <AMOUNT> <RECIPIENT_WALLET_ADDRESS>
--url devnet
If you are having issues like unfunded recipient, you can use the following command.
spl-token transfer <TOKEN_ADDRESS> <AMOUNT> <RECIPIENT_WALLET_ADDRESS>
--url devnet --allow-unfunded-recipient --fund-recipient
This will solve the unfunded recipient issue.
Make sure to verify the transaction to ensure tokens are transferred correctly.
https://www.c-sharpcorner.com/ebooks/ 46
spl-token authorize <TOKEN_ADDRESS> mint <NEW_AUTHORITY>
In the above command, replace <NEW_AUTHORITY> with the new authority's public key.
Burning Tokens: Burning is useful for managing token supply and maintaining value. To burn
tokens and reduce the supply, you can use the following command.
spl-token burn <TOKEN_ACCOUNT> <AMOUNT> --url devnet
This will burn the given number of tokens from the above token account. Note that, the tokens
will be burned from the remaining tokens of your token account. If you previously sent some
tokens to others, their token will remain unaffected by this action.
https://www.c-sharpcorner.com/ebooks/ 47
10
Languages Supported by
Solana
Overview
This chapter explores how developers use languages like C, C++, and
Rust to build efficient and secure applications on Solana. It also covers
the Anchor framework, which simplifies creating decentralized apps
(dApps) on the platform.
https://www.c-sharpcorner.com/ebooks/ 48
Introduction
Solana supports C, C++, and Rust for blockchain development. These languages offer different
advantages and are popular choices for building efficient and secure applications on the Solana
blockchain. Additionally, Solana provides the Anchor framework to simplify smart contract
development, making it easier for developers to create decentralized applications (dApps) with
Solana.
Rust Performance: Zero-cost abstractions for Learning Curve: Some complexity, especially
high-performance for newcomers
Safety: The ownership model enhances Tooling: Specialized tools may be less
security mature
Concurrency: Built-in support for efficient
code
https://www.c-sharpcorner.com/ebooks/ 49
Anchor Setup
The Anchor framework for Solana is a powerful tool designed to simplify and accelerate the
development of decentralized applications (dApps) on the Solana blockchain. Built with
developers in mind, Anchor provides a robust and developer-friendly environment for building,
deploying, and managing smart contracts on Solana. At its core, Anchor leverages Rust
programming language, a language known for its performance, safety, and concurrency
features. By using Rust, Anchor offers developers a familiar and powerful ecosystem to build
secure and efficient smart contracts for the Solana blockchain.
Install Rust
Before installing Anchor, ensure that Rust is installed on your system. Rust can be installed
using the Rustup tool, which is available for Windows, macOS, and Linux. For WSL, macOS,
Linux, and Unix-like OS, run the following command to install Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Output
Now restart your current shell to reload the PATH environment variable to include Cargo's bin
directory or run the following command to achieve the same.
. "$HOME/.cargo/env"
https://www.c-sharpcorner.com/ebooks/ 50
anchor --version
https://www.c-sharpcorner.com/ebooks/ 51
• [programs.localnet]: The addresses of your programs within the localnet.
• [registry]: A registry where your program will be pushed.
• [provider]: A provider to be used in your tests.
• [scripts]: Anchor automatically runs scripts for you, including the test script, during
"anchor test" execution. You can execute your scripts using "anchor run <script_name>".
Anchor Commands
• account: Fetch and deserialize an account using the IDL provided
• build: Builds the workspace
• cluster: Cluster commands
• deploy: Deploys each program in the workspace
• expand: Expands the macros of a program or the workspace
• help: Prints this message or the help of the given subcommand(s)
• idl: Commands for interacting with interface definitions
• init: Initializes a workspace
• migrate: Runs the deploy migration script
• new: Creates a new program
• shell: Starts a node shell with an Anchor client setup according to the local config
• test: Runs integration tests against a local network
• upgrade: Upgrades a single program. The configured wallet must be the upgrade
authority
• verify: Verifies the on-chain bytecode matches the locally compiled artifact.
We have done with the setup of the anchor framework, in the next article we will learn to write a
program(smart contract) and test using the anchor framework.
https://www.c-sharpcorner.com/ebooks/ 52
11
Developing and Deploying
with Solana Playground
Overview
In this chapter, you will learn how to leverage the Solana Playground to
develop, deploy, and test blockchain programs without needing
traditional Integrated Development Environments (IDEs). It provides a
step-by-step guide on creating and managing Solana programs,
emphasizing the ease and flexibility of the playground tool for
blockchain development.
https://www.c-sharpcorner.com/ebooks/ 53
Introduction
Solana Playground is a web-based integrated development environment (IDE) designed to
simplify the process of building, testing, and deploying smart contracts on the Solana
blockchain. It has an easy-to-use interface and a variety of tools for both new and experienced
developers, making it a versatile platform for blockchain development.
https://www.c-sharpcorner.com/ebooks/ 54
Creating a New Project
Start a new project by selecting from available templates that are Native (Rust), Anchor (Rust),
or Seahorse (Python), name your project, and click Create. Here, I am selecting Anchor(Rust),
you can choose according to your needs.
Here, we have three main folders 'src', 'client', and 'tests'. In the 'src' folder, we have a file
named 'lib.rs'. In the 'client' folder, we have a file named 'client.ts' and in the 'tests' folder, we
have a file named 'anchor.test.ts'. Initially, we have a default program written in these files. We
can modify these files according to our requirements. In this article, we will not be creating our
program but rather using the default program to explore how the playground works.
https://www.c-sharpcorner.com/ebooks/ 55
In lib.rs-
use anchor_lang::prelude::*;
// This is your program's public key and it will update
// automatically when you build the project.
declare_id!("11111111111111111111111111111111");
#[program]
mod hello_anchor {
use super::*;
pub fn initialize(ctx: Context<Initialize>, data: u64) ->
Result<()> {
ctx.accounts.new_account.data = data;
msg!("Changed data to: {}!", data); // Message will show up in
the tx logs
Ok(())
}
}
#[derive(Accounts)]
pub struct Initialize<'info> {
// We must specify the space in order to initialize an account.
// First 8 bytes are default account discriminator,
// next 8 bytes come from NewAccount.data being type u64.
// (u64 = 64 bits unsigned integer = 8 bytes)
#[account(init, payer = signer, space = 8 + 8)]
pub new_account: Account<'info, NewAccount>,
#[account(mut)]
pub signer: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[account]
pub struct NewAccount {
data: u64
}
This program demonstrates how to use the Anchor framework to create a new account and
initialize it with a value on the Solana blockchain. It shows the basic structure of an Anchor
program, including how to define instructions, specify account constraints, and log messages for
transaction tracing. This example is a good starting point for understanding how to build more
complex Solana programs using Anchor.
In Client.ts,
console.log("My address:", pg.wallet.publicKey.toString());
const balance = await pg.connection.getBalance(pg.wallet.publicKey);
console.log(`My balance: ${balance / web3.LAMPORTS_PER_SOL} SOL`);
In the above file, we have a typescript file that logs my address and my balance.
In anchor.tests.rs
// No imports needed: web3, anchor, pg and more are globally available
describe("Test", () => {
it("initialize", async () => {
https://www.c-sharpcorner.com/ebooks/ 56
// Generate keypair for the new account
const newAccountKp = new web3.Keypair();
// Send transaction
const data = new BN(42);
const txHash = await pg.program.methods
.initialize(data)
.accounts({
newAccount: newAccountKp.publicKey,
signer: pg.wallet.publicKey,
systemProgram: web3.SystemProgram.programId,
})
.signers([newAccountKp])
.rpc();
console.log(`Use 'solana confirm -v ${txHash}' to see the logs`);
// Confirm transaction
await pg.connection.confirmTransaction(txHash);
// Fetch the created account
const newAccount = await pg.program.account.newAccount.fetch(
newAccountKp.publicKey
);
console.log("On-chain data is:", newAccount.data.toString());
// Check whether the data on-chain is equal to local 'data'
assert(data.eq(newAccount.data));
});
});
In the above code, we have a test case for a Solana program using the Anchor framework. It
initializes a new account with a value of `42`, sends the transaction, and confirms it. After
fetching the account data from the blockchain, it checks if the on-chain data matches the
expected value. Finally, it asserts that the stored data is correct, ensuring the smart contract
functions as intended.
Building the program in the playground
To build this program, click the second option from the left navbar. Here, we have the Build
button in the Explorer. Click on build to build your program, if there are no errors in your
program, your program will build successfully.
https://www.c-sharpcorner.com/ebooks/ 57
Here, we have successfully built our program. Here, if you notice, our program public key is
updated as we build the program.
Once our program is successfully built, we can deploy it to the Solana devnet, testnet, or
mainnet.
To deploy the program, click on the Deploy button. After a while, you'll notice that your program
has been deployed, and a few SOLs have deducted your balance. This deduction is the cost of
program deployment.
Once the program is deployed on the chain, you will have a button to upgrade. This is used
when you want to update or upgrade the program after the deployment. You can make changes
and click on Upgrade to update the on-chain program.
https://www.c-sharpcorner.com/ebooks/ 58
Now, click the Test button, and test cases written in the anchor.test.ts file will be executed. If the
test cases pass successfully, the playground terminal will look like the below.
If any test case fails during this, the playground terminal will show the error related to the failed
test case.
If you click on Accounts and then click the Fetch All button, you will have the account generated
with the same data value we provided in our test.
Now, we have successfully developed, deployed, and tested the program using the Solana
playground. Similarly, you can use the playground to create programs according to your
requirements without using the IDEs.
https://www.c-sharpcorner.com/ebooks/ 59
OUR MISSION
Free Education is Our Basic Need! Our mission is to empower millions of developers worldwide by
providing the latest unbiased news, advice, and tools for learning, sharing, and career growth. We’re
passionate about nurturing the next young generation and help them not only to become great
programmers, but also exceptional human beings.
ABOUT US
CSharp Inc, headquartered in Philadelphia, PA, is an online global community of software
developers. C# Corner served 29.4 million visitors in year 2022. We publish the latest news and articles
on cutting-edge software development topics. Developers share their knowledge and connect via
content, forums, and chapters. Thousands of members benefit from our monthly events, webinars,
and conferences. All conferences are managed under Global Tech Conferences, a CSharp
Inc sister company. We also provide tools for career growth such as career advice, resume writing,
training, certifications, books and white-papers, and videos. We also connect developers with their poten-
tial employers via our Job board. Visit C# Corner
MORE BOOKS