{"slug": "day-24-in-solana-everything-is-an-account", "title": "# Day 24: In Solana, Everything is an Account", "summary": "In Solana, all data is stored as \"accounts\" in a flat key-value store, where each account has five standard fields including lamports (SOL balance), data (a byte array), and an owner program. A key design principle is that Solana programs are stateless, meaning executable code and the data it uses live in separate accounts, with only the owner program allowed to modify an account's data or debit its lamports. Additionally, every account must maintain a minimum lamport balance proportional to its data size to prevent state bloat, or it will be purged from the network.", "body_md": "On Solana there is just... accounts. One model. Everything is an account — your wallet, a deployed program, a token mint, a user's token balance. All of them live in the same flat key-value store where the key is a 32-byte address and the value is the account data.\n\nIt sounds simple. It's actually a pretty elegant design decision with a lot of implications.\n\n## The Filesystem Analogy\n\nHere's the mental model that clicked for me: think of Solana like a filesystem.\n\nEvery account is a file. Each account (file) has:\n\n- metadata:\n- owner\n- permissions\n- size\n\n- contents:\n- the actual data\n\nProgram accounts are executable files. Data accounts are the documents those programs read from and write to. And the [System Program](https://explorer.solana.com/address/11111111111111111111111111111111)? That's the OS kernel — it handles creating new files and transferring ownership.\n\n## The Five Fields Every Account Has\n\nNo matter what an account represents, it always has the same five fields:\n\n-\n— the SOL balance. 1 SOL = 1,000,000,000 lamports.`lamports`\n\n-\n— a raw byte array. This is where all state lives.`data`\n\n-\n— the program that controls this account and can modify its data.`owner`\n\n-\n— a boolean. If`executable`\n\n`true`\n\n, this account contains a deployed program. -\n— deprecated. You'll see it set to`rent_epoch`\n\n`u64::MAX`\n\non all modern accounts.\n\nThe ownership rule is the key security primitive: **only the owner program can modify an account's data or debit its lamports**. Anyone can credit lamports to any writable account. Simple, but powerful.\n\n## Programs Don't Store Their Own State\n\nThis is the one that surprises every Web2 developer: **Solana programs are stateless**.\n\nA program's executable bytecode lives in one account. Any data that program needs lives in entirely separate accounts. The program just reads and writes those accounts at runtime. It's the difference between a web server (the program) and a database (the data accounts) — they're separate things.\n\n## Reading a Real Account On-Chain\n\nTo make this concrete, I fetched the **Wrapped SOL mint account** — one of the most fundamental accounts on Solana mainnet. Here's how I pulled the raw data using `@solana/kit`\n\n:\n\n``` js\nimport { createSolanaRpc, address, getBase64Encoder, getBase16Decoder } from \"@solana/kit\";\nimport { getMintDecoder } from \"@solana-program/token\";\n\nconst rpc = createSolanaRpc(\"https://api.mainnet-beta.solana.com\");\nconst mintAddress = address(\"So11111111111111111111111111111111111111112\");\n\nconst { value: accountInfo } = await rpc\n  .getAccountInfo(mintAddress, { encoding: \"base64\" })\n  .send();\n\nconst dataBytes = getBase64Encoder().encode(accountInfo.data[0]);\n```\n\nThe account data comes back as base64. Once decoded into raw bytes, I ran it through two decode paths — the Token Program codec, and a manual byte-level read using `DataView`\n\n:\n\n``` js\n// Codec approach\nconst mint = getMintDecoder().decode(dataBytes);\n\n// Manual byte-level approach\nconst view = new DataView(dataBytes.buffer, dataBytes.byteOffset, dataBytes.byteLength);\nconst supply = view.getBigUint64(36, true);  // bytes 36–43, little-endian\nconst decimals = view.getUint8(44);          // byte 44\n```\n\nBoth approaches confirmed the same thing — here's what the terminal showed:\n\nSupply is 0 (wSOL is minted on demand), decimals is 9, and both mint and freeze authorities are `null`\n\n— meaning no one can mint more or freeze transfers. The account is fully decentralized.\n\n## Rent Exemption\n\nOne last thing: every account must hold a minimum lamport balance proportional to its data size. This keeps the validator state from bloating with abandoned accounts. For a zero-data account it's roughly 0.00089 SOL. Using the [Solana CLI](https://solana.com/docs/intro/installation/solana-cli-basics) You can calculate exact amounts with:\n\n```\nsolana rent <data-size-in-bytes>\n```\n\nIf an account drops below this threshold, it gets purged. So whenever you create an account in a program, you're responsible for funding it past the rent-exempt minimum.\n\n## Key Takeaway\n\nSolana's account model is the foundation for everything else — PDAs, token accounts, program-derived state. Once you internalize that *all state lives in accounts*, *programs are stateless*, and *ownership = write permission*, the rest of the ecosystem starts to make a lot more sense.\n\n*This post is part of my 100 Days of Solana series. Follow along as I go from zero to deployed program. Github Repo*", "url": "https://wpnews.pro/news/day-24-in-solana-everything-is-an-account", "canonical_source": "https://dev.to/gorilaprada/-day-24-in-solana-everything-is-an-account-48hm", "published_at": "2026-05-23 01:09:54+00:00", "updated_at": "2026-05-23 02:02:01.388137+00:00", "lang": "en", "topics": ["web3"], "entities": ["Solana", "System Program"], "alternates": {"html": "https://wpnews.pro/news/day-24-in-solana-everything-is-an-account", "markdown": "https://wpnews.pro/news/day-24-in-solana-everything-is-an-account.md", "text": "https://wpnews.pro/news/day-24-in-solana-everything-is-an-account.txt", "jsonld": "https://wpnews.pro/news/day-24-in-solana-everything-is-an-account.jsonld"}}