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-validator and 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:

  1. Integer Safety: Replace all +/-/* with checked_* or saturating_*; use anchor_lang::prelude::* safe math traits.

  2. Account Validation: Every #[account] struct implements AccountDeserialize + AccountSerialize; enforce has_one / constraint checks on cross-program invocations.

  3. Signer & Authority Checks: Verify Signer constraints on all mutating instructions; ensure mint_authority and freeze_authority are set to None or a multisig before mainnet deploy.

  4. Token-2022 Compliance: If using extensions (confidential transfers, transfer hooks), run spl-token-2022 CLI simulations against your program ID.

  5. Event & Log Hygiene: Emit typed events (#[event]) for all state changes; avoid msg! 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_authority or dedicated pause instruction controlled by multisig (Squads/Tribeca).

  • [ ] Load Test: Simulate 5k+ concurrent buyers on devnet using drift-cli or custom k6 script; confirm CU usage < 200k per tx.

Practical 5-Step Starter Checklist

  1. Scaffold: anchor init → modularize src/ into instructions/, state/, errors/, events/.

  2. 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.