Skip to main content

Quick Access

Check out basic counter example in other implementations:

GitHub

Native Rust Implementation

Guide

Local Development


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

Delegate PDA on Base Layer

Add CPI hooks to delegate, commit and undelegate state accounts through Ephemeral Rollup sessions.
3

Commit PDA on ER

Deploy your program directly on Solana using Solana CLI.
4

Undelegate PDA on ER

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:

Code Snippets

The program implements two main instructions:
  1. InitializeCounter: Initialize and sets the counter to 0 (called on Base Layer)
  2. IncreaseCounter: Increments the initialized counter by X amount (called on Base Layer or ER)
The program implements specific instructions for delegating and undelegating the counter:
  1. Delegate: Delegates counter from Base Layer to ER (called on Base Layer)
  2. CommitAndUndelegate: Schedules sync of counter from ER to Base Layer, and undelegates counter on ER (called on ER)
  3. Commit: Schedules sync of counter from ER to Base Layer (called on ER)
  4. Undelegate: Undelegates counter on the Base Layer (called on Base Layer through validator CPI)
Here’s the core structure of our program:
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.
⬆️ Back to Top

Advanced Code Snippets

When resizing a delegated PDA:
  • PDA must have enough lamports to remain rent-exempt for the new account size.
  • If additional lamports are needed, the payer account must be delegated to provide the difference.
  • PDA must be owned by the program, and the transaction must include any signer(s) required for transferring lamports.
  • Use system_instruction::allocate
⬆️ Back to Top

Solana Explorer

Get insights about your transactions and accounts on Solana:

Solana Explorer

Official Solana Explorer

Solscan

Explore Solana Blockchain

Solana RPC Providers

Send transactions and requests through existing RPC providers:

Solana

Free Public Nodes

Helius

Free Shared Nodes

Triton

Dedicated High-Performance Nodes

Solana Validator Dashboard

Find real-time updates on Solana’s validator infrastructure:

Solana Beach

Get Validator Insights

Validators App

Discover Validator Metrics

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