DEV Community

Prasiddh Naik
Prasiddh Naik

Posted on

solana notes - week 2

100DaysOfSolana

i've used normal databases for years, so i kept trying to force solana into that shape. tables, rows, queries. some of that helps, a lot of it breaks.

what surprised me

reading a balance is stupidly simple:

const { value: balanceInLamports } = await rpc
  .getBalance(targetAddress)
  .send();
Enter fullscreen mode Exit fullscreen mode

the code is easy. the mental model is what's hard.

the click moment

ran solana account $(solana address) and saw my wallet data. then realized: anyone can do this. no api keys, no auth. just the public key and you're reading someone's balance.

that's uncomfortable in a good way. in web2 data is hidden unless i expose it. here it's visible unless i design around it.

the sdk

@solana/kit feels normal. not crusty like i expected. async/await, clean imports. the devnet() and mainnet() wrappers aren't just for show—they actually tag the network for type safety. someone thought about DX.

where the database comparison breaks

normal thinking solana reality
sql joins lol no. fetch signatures, then fetch details
private by default public by default
i control who reads everyone reads
alter table, migrations nope. design upfront, serialize to bytes

i keep wanting SELECT * FROM transactions WHERE user_id = 123. instead:

const signatures = await rpc
  .getSignaturesForAddress(address, { limit: 5 })
  .send();
// then fetch each one i guess
Enter fullscreen mode Exit fullscreen mode

more manual. that's the tradeoff.

devnet vs mainnet hit different

--- Devnet ---
Balance : 0.001159846 SOL

--- Mainnet ---
Balance : 0.069875097 SOL
Enter fullscreen mode Exit fullscreen mode

same address, same code, different world. staging vs production except anyone can view production.

still fuzzy on

  • PDAs - when do i actually use them vs regular accounts?
  • rent - deposit not fee, but the exact economics? need to build something that creates/closes accounts
  • cross-program calls - just words to me right now
  • writing transactions - reading is safe. writing feels serious. nervous about it.

next

  • send a simple transaction
  • one PDA example end to end
  • build something that actually writes, not just reads

where i'm at

day 12. not an expert. but less intimidated.

the code looks familiar while the assumptions underneath are totally different. public data by default. accounts instead of tables. pay for storage not queries. still rewiring my brain.

if you're also confused by accounts, PDAs, or why everything is public: same. i think that's just part of it.

Top comments (0)