https://github.com/bluntbrain/solana-counter-program
https://github.com/bluntbrain/solana-counter-program
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bluntbrain/solana-counter-program
- Owner: bluntbrain
- Created: 2025-08-09T17:37:02.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-08-09T17:42:16.000Z (12 months ago)
- Last Synced: 2025-08-09T19:27:40.804Z (12 months ago)
- Language: TypeScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Solana Counter Program
A basic Solana program that maintains a counter value on-chain. Supports increment and decrement operations.
## Setup
```bash
# Install dependencies
bun install
# Start local validator
solana-test-validator
# Build and deploy program
cargo build-sbf
solana program deploy target/deploy/counter_program.so
# Run tests
bun test
```
## What You'll Learn
- Solana's account model and stateless programs
- Cross-language serialization with Borsh
- Account creation and rent exemption
- Transaction construction and instruction processing
- Client-side integration with Web3.js
- Local development with test validators
## Architecture
- `src/lib.rs` - Rust program with Counter struct and increment/decrement logic
- `tests/index.test.ts` - TypeScript tests demonstrating client interaction
- Counter data stored in separate accounts owned by the program
- Instructions serialized with Borsh for cross-language compatibility