โ† Writing

๐Ÿงฎ Simple Solana Counter Program

2025-03-04 rust ยท solana ยท project


A lightweight, native Solana smart contract for incrementing and decrementing a counter. Developed with native Rust for performance and simplicity.


๐Ÿ“š GitHub Repository This project demonstrates a minimalistic Solana on-chain program (smart contract) written in native Rust. The core functionality revolves around managing a simple counter:

The program is ideal for developers who want to:


๐Ÿ› ๏ธ How to Get Started

1. ๐Ÿงช Start a Local Solana Validator

Run the following command to simulate the Solana blockchain locally:

solana-test-validator

2. ๐Ÿงฑ Build and Deploy the Program

Use Anchor CLI to build and deploy the smart contract to the local validator:

anchor build && anchor deploy

Note: Although the on-chain code is native Rust, Anchor is used for deployment and local testing convenience.

3. ๐Ÿ‘› Set Up Your Wallet

Export your Solana CLI wallet path so it can be used for deployments and interactions:

export ANCHOR_WALLET=~/.config/solana/id.json

4. ๐Ÿ” Interact with the Program

Once deployed, you can send transactions to:

These actions can be scripted in TypeScript/JavaScript using Anchor client or done manually with solana CLI.


๐Ÿ“„ License

This project is open-source and available under the terms of the MIT License. Feel free to fork, modify, and use it for both personal and commercial purposes.