This is a simple on-chain counter program built using Anchor, a framework for developing smart contracts on Solana. The program allows initializing a counter, incrementing, and decrementing its value on the Solana blockchain.
-
Initialize a counter account
-
Increment the counter
-
Decrement the counter
initialize
-: Initializes a new counter account and sets the count to 0.increment
-: Increments the counter value by 1.decrement
-: Decrements the counter value by 1.
-
Initialize
-: Accounts required:counter_account
: New account to store counter state (space: 8 + 8 bytes)signer
: The account paying for initializationsystem_program
: Solana system program
-
Change
-: Accounts required:counter_account
-: The mutable counter state accountuser
-: The signer authorized to update the counter