Interact with Your Program
Your counter program is live on Solana Devnet. Now let's call its instructions and watch the on-chain state change in real time.
What You'll Do
- Initialize a counter account — creates a new account owned by your program
- Increment the counter — modifies the on-chain state
- Decrement the counter — see your custom error handling in action
Understanding the Data
The Program Explorer below shows two views of your counter account:
Parsed Data
The human-readable version: count: 3
Raw Data (Hex)
What's actually stored on-chain:
[a8 fc 0b 1f 05 77 32 45 | 03 00 00 00 00 00 00 00]
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
discriminator (8 bytes) count: 3 (u64 LE)
The discriminator is Anchor's way of identifying account types. It's the first 8 bytes of sha256("account:Counter"). Every Anchor account starts with this — it's how the runtime knows it's looking at a Counter struct and not random data.
The count is stored as a u64 in little-endian byte order. The value 3 is 03 00 00 00 00 00 00 00 because the least significant byte comes first.
Try This
- Click Initialize — watch the discriminator bytes appear
- Click Increment 3 times — watch
countchange from00to03 - Click Decrement down to 0, then try decrementing again
- See your
#[error_code] Underflowin action!
Teaching moment: When you decrement below zero, your custom error
Cannot decrement below zerois enforced by the Solana runtime. This is your code running on a real blockchain, enforcing rules you defined.