Community Trust ScoreVerified
Noah Expressed: All of the things, I wish I knew when I started developing on Solana. 1. A wallet isn’t an actual data struct. It’s just a public key. All tokens are stored in “associated” token accounts stored at addresses deterministically found by hashing the wallet and mint addresses.
Mint vs Token. At a “Mint” address is the definition of a token. All tokens from that mint reference that mint address. Sometimes people will refer to a “Token” generally, like the MNGO token. In this case, they mean the mint. Sometimes token means an individual token you own.
Owners. Owners everywhere. An account in a Solana program has an owner. This owner refers to the program that owns and can make changes to the data in this account. A Token Account also has an owner, present on the actual data. This refers to the wallet that owns the tokens.
Solana is really just a giant Key/Value store. While PDAs seem complex at first, most of the time they’re just used for getting one Key using another Key or set of Keys. Example: spl-token-metadata uses a PDA to associate a token’s name and symbol with the Mint address.
Pass. Every. Account. If you (or any smart contract you’re calling out to) need to use an account in your smart contract, it needs to be passed to that smart contract. You cannot simply pass the key as an argument.
Wrappers are your friend. Calling out to a smart contract is a low level api, like hitting assembly instructions. You can, and should, create wrapper methods that fetch all of the accounts you need to execute an instruction.
Use anchorlang. Unless you’re an expert Rust developer, I promise you won’t make code cleaner than using Anchor. It’ll save your sanity, so you don’t feel like balancing a checkbook when your accounts lists misalign. It also saves you from gotchas like ownership checks.
Confirmation settings matter on mainnet. You can get away with chaining transactions/fetches on devnet because it’s basically one server. When you go to mainnet, if you execute a transaction on “single” and go fetch an account at “confirmed”, you’re going to have a bad time.
Avoid getProgramAccounts. getProgramAccounts is a last resort. Using it is often a code-smell that your on-chain data is not using PDAs in such a way that you can get at the data that you want. Consider how you can use PDAs to index your data properly.
Program vs Smart Contract. This might seem obvious if you’ve been here a while. On Solana, smart contracts are called programs. As developers, we’re wildly inconsistent with what we call them. I’ve probably referred to it as both in this thread alone.





