5/5
## Understanding Solana Programs: The Executable Stateless Account To master development on Solana, one must first understand the unique architecture of its programs. Unlike smart contracts on EVM-based chains, Solana programs are architected with a strict separation of logic and data. Fundamentally, a Program on Solana is defined as an **Executable Stateless Account**. * **Executable:** Like everything else on Solana, a program is stored in an account. The distinguishing feature is that its metadata field `executable` is set to `true`. This tells the runtime that this account contains code to be processed. * **Stateless:** This is the most critical concept. Programs do not store user data, variables, or state within their own accounts. If a program needs to store data (state), it must utilize a separate, external account. ## Instructions vs. Transactions: Actions and Bundles When interacting with the blockchain, it is vital to distinguish between the specific action you want to perform and the vehicle used to deliver that action. ### The Instruction (`ix`) An instruction is a **function call to a program**. It represents a specific directive, telling a targeted program exactly what logic to execute. ### The Transaction (`tx`) A transaction is a **bundle of instructions**. It is the atomic unit sent to the network. * A single transaction can contain one or multiple instructions. * These instructions can invoke the same program multiple times or interact with entirely different programs sequentially. * If any instruction within the transaction fails, the entire transaction fails, ensuring atomicity. ## The Structure of a Transaction and Account Declaration To understand how Solana processes requests, let’s look at the structure of a transaction object. In this scenario, a user named Alice wants to initialize a counter program to the state of `0`. The transaction object (`tx`) is constructed as follows: ```javascript tx = { instructions: [ // The specific logic to execute "call counter program", "initialize counter state" ], accounts: [ // The explicit list of ALL accounts involved Alice, // The signer/payer Counter Account, // The address where state will be stored System Program // Required to create the new account ] } ``` ### The Logic Behind Account Declaration (Parallel Execution) You will notice the `accounts` array requires every account involved in the transaction to be declared upfront. This is not an arbitrary requirement; it is the mechanism that powers Solana's high throughput via **Parallel Execution**. By inspecting the `accounts` list before execution, the Solana runtime (Sealevel) can determine transaction dependencies without running the code. * **Transaction A** lists `[Alice, Counter Account]`. * **Transaction B** lists `[Carol, Bob]`. Because there is no overlap in the accounts utilized, the runtime knows these transactions do not affect the same state. Consequently, it executes them **simultaneously** rather than sequentially. This architecture is what allows Solana to handle thousands of transactions per second. ## Step-by-Step Execution: Initializing a Counter Program Let’s trace the execution flow of Alice initializing her counter to understand how programs, state, and the System Program interact. ### 1. Submission Alice constructs the transaction containing the instruction to "initialize counter state." She signs the transaction (authorizing the use of her funds for fees/rent) and broadcasts it to the Solana cluster. ### 2. Program Invocation The Solana runtime receives the transaction. It identifies the target as the **Counter Program** and invokes it with the instruction data: `ix = init counter state`. ### 3. Creating the State Account The Counter Program executes its logic. It needs to store the integer `0`. However, because the program is **stateless**, it cannot save this variable inside itself. It must create a new "Counter Account" to hold this data. There is a constraint here: generic programs cannot simply generate new accounts. On Solana, only the **System Program** has the privilege to create new accounts. ### 4. Cross-Program Call to the System Program The Counter Program performs a Cross-Program Invocation (CPI). It sends a nested instruction to the **System Program** requesting `create account`. During this step, the System Program requires a payment for "Rent." Rent is the amount of SOL that must be locked in an account to pay for the storage space it consumes on validators. Alice, who was declared in the transaction's account list as the signer, pays this rent. ### 5. Ownership Assignment The System Program creates the new "Counter Account." Crucially, the System Program assigns the **Owner** of this new account to be the **Counter Program**. This adheres to Solana's strict security model: **Only the owner of an account is permitted to modify its data.** By assigning ownership to the Counter Program, the System Program grants the Counter Program the authority to write to this account in the future. ### 6. Writing State Now that the "Counter Account" has been created and ownership has been correctly assigned, the Counter Program can proceed. It writes the data `count = 0` into the newly created Counter Account. The transaction creates a successful result, and the state is now persisted on the blockchain. ## Key Takeaways * **Stateless Architecture:** Logic (the Program) and Data (the State Account) are completely decoupled. This differs significantly from EVM chains where contracts hold their own state. * **Rent:** Creating state requires storage bytes on the blockchain. This cost is paid in SOL (Rent) by the user initiating the transaction (Alice). * **Efficiency via Declaration:** Declaring all accounts upfront allows the runtime to identify non-overlapping transactions and execute them in parallel. * **Ownership Rules:** Data security is enforced via ownership. A program can only write data to accounts that it officially owns.
To master development on Solana, one must first understand the unique architecture of its programs. Unlike smart contracts on EVM-based chains, Solana programs are architected with a strict separation of logic and data.
Fundamentally, a Program on Solana is defined as an Executable Stateless Account.
Executable: Like everything else on Solana, a program is stored in an account. The distinguishing feature is that its metadata field executable is set to true. This tells the runtime that this account contains code to be processed.
Stateless: This is the most critical concept. Programs do not store user data, variables, or state within their own accounts. If a program needs to store data (state), it must utilize a separate, external account.
When interacting with the blockchain, it is vital to distinguish between the specific action you want to perform and the vehicle used to deliver that action.
ix)An instruction is a function call to a program. It represents a specific directive, telling a targeted program exactly what logic to execute.
tx)A transaction is a bundle of instructions. It is the atomic unit sent to the network.
A single transaction can contain one or multiple instructions.
These instructions can invoke the same program multiple times or interact with entirely different programs sequentially.
If any instruction within the transaction fails, the entire transaction fails, ensuring atomicity.
To understand how Solana processes requests, let’s look at the structure of a transaction object. In this scenario, a user named Alice wants to initialize a counter program to the state of 0.
The transaction object (tx) is constructed as follows:
You will notice the accounts array requires every account involved in the transaction to be declared upfront. This is not an arbitrary requirement; it is the mechanism that powers Solana's high throughput via Parallel Execution.
By inspecting the accounts list before execution, the Solana runtime (Sealevel) can determine transaction dependencies without running the code.
Transaction A lists [Alice, Counter Account].
Transaction B lists [Carol, Bob].
Because there is no overlap in the accounts utilized, the runtime knows these transactions do not affect the same state. Consequently, it executes them simultaneously rather than sequentially. This architecture is what allows Solana to handle thousands of transactions per second.
Let’s trace the execution flow of Alice initializing her counter to understand how programs, state, and the System Program interact.
Alice constructs the transaction containing the instruction to "initialize counter state." She signs the transaction (authorizing the use of her funds for fees/rent) and broadcasts it to the Solana cluster.
The Solana runtime receives the transaction. It identifies the target as the Counter Program and invokes it with the instruction data: ix = init counter state.
The Counter Program executes its logic. It needs to store the integer 0. However, because the program is stateless, it cannot save this variable inside itself. It must create a new "Counter Account" to hold this data.
There is a constraint here: generic programs cannot simply generate new accounts. On Solana, only the System Program has the privilege to create new accounts.
The Counter Program performs a Cross-Program Invocation (CPI). It sends a nested instruction to the System Program requesting create account.
During this step, the System Program requires a payment for "Rent." Rent is the amount of SOL that must be locked in an account to pay for the storage space it consumes on validators. Alice, who was declared in the transaction's account list as the signer, pays this rent.
The System Program creates the new "Counter Account."
Crucially, the System Program assigns the Owner of this new account to be the Counter Program. This adheres to Solana's strict security model: Only the owner of an account is permitted to modify its data.
By assigning ownership to the Counter Program, the System Program grants the Counter Program the authority to write to this account in the future.
Now that the "Counter Account" has been created and ownership has been correctly assigned, the Counter Program can proceed. It writes the data count = 0 into the newly created Counter Account. The transaction creates a successful result, and the state is now persisted on the blockchain.
Stateless Architecture: Logic (the Program) and Data (the State Account) are completely decoupled. This differs significantly from EVM chains where contracts hold their own state.
Rent: Creating state requires storage bytes on the blockchain. This cost is paid in SOL (Rent) by the user initiating the transaction (Alice).
Efficiency via Declaration: Declaring all accounts upfront allows the runtime to identify non-overlapping transactions and execute them in parallel.
Ownership Rules: Data security is enforced via ownership. A program can only write data to accounts that it officially owns.
A conceptual deep dive to Understanding Solana Programs - Explore the architecture of executable stateless accounts and the critical separation of logic from data. Master the mechanics of parallel execution through upfront account declarations and follow the step-by-step lifecycle of state creation involving the System Program and rent protocols.
Previous lesson
Previous
Next lesson
Next
Course Overview
About the course
Native Rust & Anchor framework
PDAs, CPIs, and SPL Tokens
DeFi builds: oracles, auctions, AMMs
Last updated on January 12, 2026
Rust Developer
SolanaDuration: 8min
Duration: 23min
Duration: 4min
Duration: 2min
Duration: 4min
Duration: 11min
Duration: 4min
Duration: 0min
Duration: 0min
Course Overview
About the course
Native Rust & Anchor framework
PDAs, CPIs, and SPL Tokens
DeFi builds: oracles, auctions, AMMs
Last updated on January 12, 2026