A simple on-chain counter dApp built using Solana + Rust + Anchor framework. Demonstrates key principles of Solana smart contract development including:
- 🛠 Account initialization via Anchor's context macros
- 🔁 Counter manipulation (increment, decrement)
- 🧪 Full test suite using Mocha/Chai in TypeScript
- Solana (devnet)
- Rust + Anchor
- TypeScript + Mocha for testing
- Local test validator with
solana-test-validator
initialize: Initializes a counter account with count = 0increment: Increases the counter by 1decrement: Decreases the counter by 1 (error if already 0)
anchor build
anchor testMake sure to install dependencies first:
npm install├── programs/
│ └── my_solana_dapp/ # Rust + Anchor smart contract
├── tests/
│ └── my_solana_dapp.ts # Full unit tests
├── target/types/ # IDL generated by Anchor