<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: atharv shukla</title>
    <description>The latest articles on DEV Community by atharv shukla (@atharv_shukla_f7a20a5893f).</description>
    <link>https://dev.to/atharv_shukla_f7a20a5893f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3885599%2Fcf9414ab-2a4e-424c-9fe7-37ed1cf2556c.png</url>
      <title>DEV Community: atharv shukla</title>
      <link>https://dev.to/atharv_shukla_f7a20a5893f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/atharv_shukla_f7a20a5893f"/>
    <language>en</language>
    <item>
      <title>Day 27: Writing About the Solana Account Model</title>
      <dc:creator>atharv shukla</dc:creator>
      <pubDate>Tue, 30 Jun 2026 10:45:29 +0000</pubDate>
      <link>https://dev.to/atharv_shukla_f7a20a5893f/day-27-writing-about-the-solana-account-model-2597</link>
      <guid>https://dev.to/atharv_shukla_f7a20a5893f/day-27-writing-about-the-solana-account-model-2597</guid>
      <description>&lt;p&gt;Today, I took a step back from writing code to write about the core architectural foundation of Solana: &lt;strong&gt;The Account Model&lt;/strong&gt;. To solidify my understanding, I wrote a comprehensive article aimed at Web2 developers who are new to blockchain, explaining how Solana manages state.&lt;/p&gt;

&lt;p&gt;Below is the draft of the article, formatted for publishing on &lt;a href="https://dev.to"&gt;DEV.to&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;DEV.to Article Draft&lt;/p&gt;

&lt;p&gt;Title: Demystifying the Solana Account Model: A Guide for Web2 Developers&lt;br&gt;
Tags: &lt;code&gt;solana&lt;/code&gt;, &lt;code&gt;blockchain&lt;/code&gt;, &lt;code&gt;web3&lt;/code&gt;, &lt;code&gt;beginners&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you are a Web2 developer dipping your toes into the Web3 waters, blockchain architecture can feel incredibly alien. You hear terms like "smart contracts," "state," and "ledgers," and you try to map them to things you know. &lt;/p&gt;

&lt;p&gt;If you look at Ethereum, it might make sense at first: it uses an Account-based model where you have Externally Owned Accounts (EOAs, like your MetaMask wallet) and Contract Accounts (which contain both the code and the state/variables of a smart contract). This feels a bit like Object-Oriented Programming, where an object contains both its methods (code) and its properties (state).&lt;/p&gt;

&lt;p&gt;But then you look at Solana, and everything you thought you understood gets flipped on its head. &lt;/p&gt;

&lt;p&gt;On Solana, programs are completely stateless, and everything is an account. &lt;/p&gt;

&lt;p&gt;Let's break down Solana’s Account Model using Web2 concepts you already use daily.&lt;/p&gt;

&lt;p&gt;The Ultimate Analogy: Solana as a Filesystem&lt;/p&gt;

&lt;p&gt;The easiest way to understand Solana's account model is to think of the entire blockchain as a global, decentralized filesystem.&lt;/p&gt;

&lt;p&gt;The Ledger is the Hard Drive: A massive, shared storage space.&lt;br&gt;
Accounts are Files: Every piece of information on Solana lives inside an "account," which acts just like a file.&lt;br&gt;
Public Keys are File Paths: Every account has a unique 32-byte address (like &lt;code&gt;BPFLoaderUpgradeab1e11111111111111111111111&lt;/code&gt; or a wallet address). Think of this public key as the absolute path to the file (e.g., &lt;code&gt;/users/alice/data.json&lt;/code&gt;).&lt;br&gt;
The System Program is the OS Kernel: The underlying operating system kernel that manages file creation, allocating size, and assigning permissions.&lt;/p&gt;

&lt;p&gt;Just like a file on your computer has metadata (file size, owner, read/write permissions) and file contents, a Solana account contains metadata and a raw byte array for data.&lt;/p&gt;

&lt;p&gt;The Anatomy of an Account: The 5 Fields&lt;/p&gt;

&lt;p&gt;Every single account on Solana shares the exact same basic structure. When you query an account using the Solana command-line interface (&lt;code&gt;solana account &amp;lt;ADDRESS&amp;gt;&lt;/code&gt;), the JSON response reveals five main fields:&lt;/p&gt;

&lt;p&gt;json&lt;br&gt;
{&lt;br&gt;
  "pubkey": "3zcpeKkCFg1z3sR1u1qQcm6h4n5t282a5cQ5bX2gYp3Z",&lt;br&gt;
  "account": {&lt;br&gt;
    "lamports": 124806720,&lt;br&gt;
    "data": ["...", "base64"],&lt;br&gt;
    "owner": "BPFLoaderUpgradeab1e11111111111111111111111",&lt;br&gt;
    "executable": true,&lt;br&gt;
    "rentEpoch": 18446744073709551615&lt;br&gt;
  }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Let's unpack what these fields represent:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;lamports (The SOL Balance): A lamport is the smallest fractional unit of SOL, named after Leslie Lamport (think of it like a Satoshi for Bitcoin or a Wei for Ethereum). &lt;code&gt;1 SOL = 1,000,000,000 lamports&lt;/code&gt;. This balance is used to pay for storage and transaction fees.&lt;/li&gt;
&lt;li&gt;data (The File Contents): A raw byte array (&lt;code&gt;Vec&amp;lt;u8&amp;gt;&lt;/code&gt;) containing the actual state stored by this account. For a wallet account, this might be empty. For a database account, it contains serialized variables.&lt;/li&gt;
&lt;li&gt;owner (The File Owner/Permissions): This is the public key of the program that controls this account. Crucially, only the owner program is allowed to modify the account's data or deduct its lamport balance.&lt;/li&gt;
&lt;li&gt;executable (Is it an App or a Document?): A boolean flag. If &lt;code&gt;true&lt;/code&gt;, this account contains compiled WebAssembly/SBF bytecode that the Solana runtime can run. It is a program (smart contract). If &lt;code&gt;false&lt;/code&gt;, it's just a data storage account.&lt;/li&gt;
&lt;li&gt;rent_epoch (Storage Rent): Historically used to track rent collections. Today, rent is deprecated because all accounts are required to be "rent-exempt" (more on this below). It is now set to a placeholder max value (&lt;code&gt;18446744073709551615&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Programs Don't Store State (Stateless Architecture)&lt;/p&gt;

&lt;p&gt;In Web2, if you write a Node.js express server, the code is loaded into memory, and it might read/write from a local Postgres database. The server code itself doesn't dynamically change its own binary files on disk to save user data; it talks to an external database.&lt;/p&gt;

&lt;p&gt;Solana works the exact same way. Solana programs are stateless.&lt;/p&gt;

&lt;p&gt;On Ethereum, a smart contract's code and its variables are packed together in the same contract account. On Solana, they are strictly separated:&lt;/p&gt;

&lt;p&gt;mermaid&lt;br&gt;
graph TD&lt;br&gt;
    subgraph Program Account&lt;br&gt;
        A[Program ID / Proxy Address] --&amp;gt;|Executable: true| B[Program Data Account: Bytecode]&lt;br&gt;
    end&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subgraph Data Accounts
    C[User Wallet Account A]
    D[User Wallet Account B]
    E[Protocol Configuration Account]
end

B --&amp;gt;|Reads/Writes Data| C
B --&amp;gt;|Reads/Writes Data| D
B --&amp;gt;|Reads/Writes Data| E
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For example, the Token-2022 Program (&lt;code&gt;TokenzQdBNbXt8TuTRCEjrpb5764uWo1tz5SQH376BB&lt;/code&gt;) contains the executable logic for minting and transferring tokens. But it doesn't store your token balance. Instead, your balance is stored in a separate Token Account owned by the Token-2022 program, which holds data indicating: "This wallet address owns X amount of this token."&lt;/p&gt;

&lt;p&gt;The Rules of Ownership: Solana's Security Model&lt;/p&gt;

&lt;p&gt;How does Solana ensure someone doesn't just write a malicious script to change another user's balance? Through strict runtime ownership rules:&lt;/p&gt;

&lt;p&gt;Only the Owner Program can write to the account data.&lt;br&gt;
Only the Owner Program can deduct lamports (debit) from the account.&lt;br&gt;
Anyone can credit lamports to any writable account (just like anyone can transfer money to your bank account).&lt;br&gt;
Anyone can read any account's data. All accounts are public by default.&lt;/p&gt;

&lt;p&gt;If Program A tries to modify an account owned by Program B, the Solana runtime rejects the transaction immediately. This simple rule eliminates a massive class of security vulnerabilities.&lt;/p&gt;

&lt;p&gt;Rent Exemption: Keeping the Ledger Lean&lt;/p&gt;

&lt;p&gt;In Web2, if you rent an AWS EC2 instance or store files in an S3 bucket, you pay a recurring subscription. If you stop paying, AWS deletes your files.&lt;/p&gt;

&lt;p&gt;Solana handles blockchain storage in a similar way. Because validators must keep all active accounts in memory (RAM) for fast transaction processing, storage isn't free. &lt;/p&gt;

&lt;p&gt;To prevent the blockchain from being filled with abandoned accounts, Solana requires accounts to maintain a minimum lamports balance. This is called being Rent-Exempt.&lt;/p&gt;

&lt;p&gt;The rent-exempt balance is directly proportional to the size of the account's &lt;code&gt;data&lt;/code&gt; array.&lt;br&gt;
 For a basic wallet account with zero data bytes, the rent-exempt minimum is roughly &lt;code&gt;0.00089 SOL&lt;/code&gt;.&lt;br&gt;
 When you close a Solana account, you can reclaim all the rent lamports back into your main wallet! It's like getting a deposit refund on a rental apartment.&lt;/p&gt;

&lt;p&gt;Summary&lt;/p&gt;

&lt;p&gt;As a Web2 developer, you can master the Solana Account Model by keeping these four rules in mind:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Everything is a file (account) in a flat key-value store.&lt;/li&gt;
&lt;li&gt;Metadata is standardized across all files (Lamports, Data, Owner, Executable).&lt;/li&gt;
&lt;li&gt;Programs are stateless executables; they read and write to separate database files (data accounts).&lt;/li&gt;
&lt;li&gt;Ownership is absolute; only the program marked as the &lt;code&gt;owner&lt;/code&gt; can modify a file's contents or spend its funds.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Understanding this separation of code and state is the "aha!" moment for every Solana developer. Once you grasp this, building decentralized applications, understanding PDA (Program Derived Addresses) generation, and writing efficient Anchor programs starts to make perfect sense!&lt;/p&gt;

&lt;p&gt;Have questions about how accounts work on Solana? Drop a comment below, and let's discuss!&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>beginners</category>
      <category>blockchain</category>
      <category>web3</category>
    </item>
    <item>
      <title>Solana Transactions Explained for Backend Developers</title>
      <dc:creator>atharv shukla</dc:creator>
      <pubDate>Tue, 30 Jun 2026 08:41:51 +0000</pubDate>
      <link>https://dev.to/atharv_shukla_f7a20a5893f/solana-transactions-explained-for-backend-developers-23hb</link>
      <guid>https://dev.to/atharv_shukla_f7a20a5893f/solana-transactions-explained-for-backend-developers-23hb</guid>
      <description>&lt;p&gt;If you're coming from a Web2 backend background, your mental model of APIs is probably built on the standard HTTP client-server pattern: client makes a request, the database runs a transaction, and you return a status code.&lt;/p&gt;

&lt;p&gt;When diving into Solana, you quickly run into a lot of the same terms—like "transactions"—but the actual execution under the hood is very different. Here's a quick guide on how Solana transactions actually work, what's inside them, and a few things that caught me off guard. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Anatomy of a Solana Transaction : 
An HTTP request is usually headers and a JSON body. A Solana transaction is a packed binary payload that cannot exceed 1,232 bytes (this limit exists so transactions can fit cleanly into a single IPv6 packet). &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Inside that byte limit, a transaction contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Signatures: Cryptographic proof from the accounts authorizing the action.&lt;/li&gt;
&lt;li&gt;Message: The instructions and context, which includes:

&lt;ul&gt;
&lt;li&gt;Account Keys: Every single account the transaction will read from or write to. Solana needs this declared upfront so it can parallelize execution.&lt;/li&gt;
&lt;li&gt;Recent Blockhash: A hash from a recent block. This acts as a timestamp and prevents replay attacks. If the blockhash is too old (usually over 150 blocks, or about a minute), the transaction expires.&lt;/li&gt;
&lt;li&gt;Instructions: The actual operations to execute. Each instruction specifies an on-chain program (like calling a controller method) and passes along the necessary accounts and raw data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;The Transaction Lifecycle
In Web2, a database transaction is either committed or it isn't. On a blockchain, consensus is reached in stages:&lt;/li&gt;
&lt;li&gt;Processed: A single validator has included the transaction in a block. &lt;/li&gt;
&lt;li&gt;Confirmed: A supermajority (66%+) of validators have voted on the block. At this point, the transaction is functionally irreversible.&lt;/li&gt;
&lt;li&gt;Finalized: 31 or more blocks have been built on top of your block. The write is permanently locked into ledger history.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can think of this as moving from a local write, to multi-region replication, to an immutable backup.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Failed Transactions Still Cost Fees
This is the biggest shift. In Web2, if a request fails validation (say, a 400 Bad Request), you don't get billed for the server CPU cycles it took to reject the request. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On Solana, failed transactions still charge fees.&lt;/p&gt;

&lt;p&gt;If your signatures are valid and the blockhash is recent, validators will execute your transaction. Even if the program logic fails halfway through (e.g. you tried to transfer more SOL than you actually have), you still pay for the compute. &lt;/p&gt;

&lt;p&gt;Here is what it looks like when a transaction fails on-chain:&lt;/p&gt;

&lt;p&gt;text&lt;br&gt;
Transaction executed:&lt;br&gt;
  Signature: 5LseX35v...K4KgG7&lt;br&gt;
  Status: Error processing Instruction 0: custom program error: 0x1&lt;br&gt;
  Fee: 0.000005 SOL&lt;br&gt;
  Account 0 balance: 0.428975 SOL -&amp;gt; 0.42897 SOL&lt;br&gt;
  Compute Units Consumed: 150&lt;br&gt;
  Log Messages:&lt;br&gt;
    Program 11111111111111111111111111111111 invoke [1]&lt;br&gt;
    Transfer: insufficient lamports 428970000, need 500000000000&lt;br&gt;
    Program 11111111111111111111111111111111 failed: custom program error: 0x1&lt;/p&gt;

&lt;p&gt;Notice that the fee-payer's balance still decreased by &lt;code&gt;0.000005 SOL&lt;/code&gt; even though the transfer failed. &lt;/p&gt;

&lt;p&gt;To avoid wasting real money on failed execution, Web3 developers use Transaction Simulation (preflight checks) on the client side to test the transaction's success on a local state before broadcasting it to the network.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Key Takeaways&lt;/li&gt;
&lt;li&gt;No ad-hoc lookups: You cannot query arbitrary accounts mid-transaction; every address you interact with must be declared in your instructions.&lt;/li&gt;
&lt;li&gt;Keep it fast: Because of the recent blockhash requirement, signed transactions expire in about a minute.&lt;/li&gt;
&lt;li&gt;Preflight is your friend: Run simulations on the RPC node first to save your users from paying fees on failed transactions.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>solana</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>100daysofsolana</category>
    </item>
  </channel>
</rss>
