This is a minimal counter program built on Solana using Anchor and MagicBlock's Ephemeral Rollups (ER) runtime.
It demonstrates how to delegate program control to ER, perform high-frequency updates off-chain, and commit or undelegate the state back to Solana's L1.
- Anchor-based Solana smart contract
- Counter logic using a deterministic PDA
- Delegation to MagicBlock's ER
- Commit & undelegate support
- ER macros like
#[ephemeral],#[delegate],#[commit]in action
Read the full walkthrough here:
Build the Fastest Counter Program on Solana Using MagicBlock
It covers:
- Anchor + ER concepts
- PDA design and patterns
- Delegate/commit/undelegate flow
- How to extend this logic in your own ER-based apps
git clone https://github.com/kirtiraj22/magicblock-counter
cd magicblock-counternpm installanchor buildanchor deployanchor test --skip-deploy --skip-build --skip-local-validator