Key Takeaways
Structure first: Use Anchor’s standardized workspace layout to separate programs, tests, and client SDKs for maintainability.
Test locally, then devnet: Validate logic with
solana-test-validatorand Bankrun before spending SOL on devnet fees.Pre-audit hygiene: Run static analysis (cargo-audit, clippy) and formal verification tools (Prusti, Kani) before engaging external auditors.
Token sale readiness: Lock mint authority, verify metadata standards (Token-2022), and simulate vesting schedules in integration tests.
Automate CI/CD: Enforce formatting, linting, and test coverage gates on every pull request to prevent drift.
1. Initialize a Clean Workspace with Anchor
A reproducible Solana smart contract boilerplate starts with Anchor v0.29+. Run anchor init <project-name> to generate the canonical structure:
/programs/<project-name>/src/lib.rs // On-chain logic /tests/<project-name>.ts // TypeScript integration tests /app/ // Optional: React/Next.js client SDK /Anchor.toml // Cluster config & program IDs /migrations/ // Deploy scripts (optional) Why it matters: This layout separates consensus-critical code from off-chain tooling, making it easier for auditors to scope the review. Keep lib.rs lean—delegate instruction handlers to modules under src/instructions/ and state definitions to src/state/.
2. Enforce Code Quality Gates Locally
Before pushing to CI, run the Rust toolchain’s built-in checks and Solana-specific linters:
cargo fmt --all -- --check cargo clippy --workspace -- -D warnings cargo audit cargo test-sbf -- --nocapture Add a .pre-commit-config.yaml or GitHub Actions workflow to block merges that fail these steps. This satisfies the baseline hygiene expected in any Web3 developer starter kit and reduces audit finding noise.
3. Layer Testing: Unit → Integration → Fuzzing
| Layer | Tool | Scope |
|-------|------|-------|
| Unit | #[test] in Rust | Pure logic (math, PDA derivation, state transitions) without runtime. |
| Integration | solana-test-validator + TypeScript (Mocha/Jest) | Full transaction lifecycle: rent, CPI, account resizing, clock sysvar. |
| Fuzzing/Property | trident-fuzz or proptest | Invariant checking (e.g., "total supply never exceeds minted"). |
Practical tip: Use Bankrun (solana-bankrun) for deterministic, parallelizable integration tests that don’t require a local validator process. It cuts CI runtime by 60–80% compared to solana-test-validator.
4. Pre-Audit Checklist: Close the Low-Hanging Fruit
Auditors charge premium rates for findings you can catch in 30 minutes. Complete these before signing an engagement letter:
Integer Safety: Replace all
+/-/*withchecked_*orsaturating_*; useanchor_lang::prelude::*safe math traits.Account Validation: Every
#[account]struct implementsAccountDeserialize+AccountSerialize; enforcehas_one/constraintchecks on cross-program invocations.Signer & Authority Checks: Verify
Signerconstraints on all mutating instructions; ensuremint_authorityandfreeze_authorityare set toNoneor a multisig before mainnet deploy.Token-2022 Compliance: If using extensions (confidential transfers, transfer hooks), run
spl-token-2022CLI simulations against your program ID.Event & Log Hygiene: Emit typed events (
#[event]) for all state changes; avoidmsg!for critical data—indexers rely on events.
5. Token Sale & Launch Readiness (The "Go/No-Go" Gate)
If your program handles a token sale, vesting, or liquidity bootstrapping, treat this as a distinct workstream. A Solana token sale checklist should cover:
[ ] Mint Configuration: Decimals (usually 9), supply cap, freeze authority revoked.
[ ] Metadata: Metaplex Token Metadata standard verified on-chain; URI points to immutable Arweave/IPFS JSON.
[ ] Vesting/Escrow Logic: Cliff + linear release tested against
Clock::get()?manipulation (warp slot in tests).[ ] Whitelist/Merkle Root: Root hash committed in program state; proof verification gas-cost profiled.
[ ] Emergency Pause:
set_authorityor dedicatedpauseinstruction controlled by multisig (Squads/Tribeca).[ ] Load Test: Simulate 5k+ concurrent buyers on devnet using
drift-clior custom k6 script; confirm CU usage < 200k per tx.
Practical 5-Step Starter Checklist
Scaffold:
anchor init→ modularizesrc/intoinstructions/,state/,errors/,events/.Hardening: Enable
cargo clippy -D warnings,cargo audit, `cargo fmt
Free Browser-Local Tool: Solana & Web3 Starter Kits (zero signup, runs 100% in your browser)
Originally published at https://b2appsdev-del.github.io/blog/solana-smart-contract-starter-checklist.html. Educational and planning guide only; not financial, tax, or legal advice.

