Step-By-Step Guide
The lifecycle of integrating Ephemeral Rollups in your program is as follows:1
Write program and add delegation instructions
Write your Solana program as you normally would.
2
Add CPI hooks to delegate, commit and undelegate state accounts through
Ephemeral Rollup sessions.
3
Deploy your program directly on Solana using Solana CLI.
4
Send transactions without modifications on-chain and off-chain that also
comply with the SVM RPC specification.
Counter Example
The following software packages may be required, other versions may also be compatible:| Software | Version | Installation Guide |
|---|---|---|
| Solana | 2.1.21 | Install Solana |
| Rust | 1.82.0 | Install Rust |
| Node | 22.17.0 | Install Node |
Quick Access
If you prefer to dive straight into the code:Native Rust Counter Program
Program Source Code
Program Tests
Test Scripts with Typescript
Local Development
Configure Custom Environment
Code Snippets
- Overview
- Delegate
- Commit
- Undelegate
The program implements two main instructions:⬆️ Back to Top
InitializeCounter: Initialize and sets the counter to 0 (called on Base Layer)IncreaseCounter: Increments the initialized counter by X amount (called on Base Layer or ER)
Delegate: Delegates counter from Base Layer to ER (called on Base Layer)CommitAndUndelegate: Schedules sync of counter from ER to Base Layer, and undelegates counter on ER (called on ER)Commit: Schedules sync of counter from ER to Base Layer (called on ER)Undelegate: Undelegates counter on the Base Layer (called on Base Layer through validator CPI)
Your “Undelegate” instruction must have the exact discriminator. It is never
called by you, instead the validator on the Base Layer will callback with a
CPI into your program after undelegating your account on ER.
Solana Explorer
Get insights about your transactions and accounts on Solana:Solana RPC Providers
Send transactions and requests through existing RPC providers:Solana Validator Dashboard
Find real-time updates on Solana’s validator infrastructure:Server Status
Subscribe to Solana’s and MagicBlock’s server status:Solana Status
Subscribe to Solana Server Updates
MagicBlock Status
Subscribe to MagicBlock Server Status

