Skip to content

monsterxz9/counter

Repository files navigation

🧮 Solana Anchor Counter

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

📦 Tech Stack

  • Solana (devnet)
  • Rust + Anchor
  • TypeScript + Mocha for testing
  • Local test validator with solana-test-validator

🚀 Features

  • initialize: Initializes a counter account with count = 0
  • increment: Increases the counter by 1
  • decrement: Decreases the counter by 1 (error if already 0)

🔧 How to Run

anchor build
anchor test

Make sure to install dependencies first:

npm install

📂 Directory Structure

├── programs/
│   └── my_solana_dapp/       # Rust + Anchor smart contract
├── tests/
│   └── my_solana_dapp.ts     # Full unit tests
├── target/types/             # IDL generated by Anchor

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published