Ephemeral Rollups (ERs) are a scaling solution for Solana that enable low-latency, composable applications and games. They work by temporarily delegating account ownership to a specialized validator that can process transactions with minimal latency while maintaining composability with the base layer.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/magicblock-labs/magicblock-engine-examples/llms.txt
Use this file to discover all available pages before exploring further.
What are Ephemeral Rollups?
Ephemeral Rollups provide a temporary execution environment where delegated accounts can be modified with extremely low latency (typically under 100ms). Unlike traditional rollups, Ephemeral Rollups are:- Low-latency: Transactions execute in milliseconds rather than seconds
- Composable: Accounts remain accessible and can interact with base layer programs
- Temporary: Accounts are delegated for a specific period and then returned to the base layer
- Automatic: State commits to the base layer at configurable intervals
Read more about Ephemeral Rollups in the official documentation.
How Ephemeral Rollups work
The Ephemeral Rollups flow consists of three main phases:Accounts are delegated from the base layer (Solana) to the Ephemeral Rollup validator. During delegation, you specify:
// Example from anchor-counter
pub fn delegate(ctx: Context<DelegateInput>) -> Result<()> {
ctx.accounts.delegate_pda(
&ctx.accounts.payer,
&[COUNTER_SEED],
DelegateConfig {
validator: ctx.remaining_accounts.first().map(|acc| acc.key()),
..Default::default()
},
)?;
Ok(())
}
Once delegated, transactions can execute on the Ephemeral Rollup with minimal latency. Any program instruction that works on Solana will work in the ER:
// Connect to the Ephemeral Rollup endpoint
const providerER = new anchor.AnchorProvider(
new anchor.web3.Connection("https://devnet-as.magicblock.app/", {
wsEndpoint: "wss://devnet-as.magicblock.app/",
}),
wallet
);
// Execute transactions on ER (typically 50-100ms)
let tx = await program.methods.increment()
.accounts({ counter: counterPDA })
.transaction();
tx.feePayer = providerER.wallet.publicKey;
tx.recentBlockhash = (await providerER.connection.getLatestBlockhash()).blockhash;
const txHash = await providerER.sendAndConfirm(tx);
commit_frequency_msArchitecture diagram
The flow of an Ephemeral Rollup session:Key benefits
- Sub-100ms latency: Transactions execute in milliseconds instead of seconds
- Same developer experience: Use existing Solana programs and tools
- Composability: Interact with base layer accounts and programs
- Cost efficient: Reduce transaction costs for high-frequency operations
- Automatic state sync: Configure commit intervals to balance latency and finality
Examples that use Ephemeral Rollups
All examples in this repository demonstrate Ephemeral Rollups:- Anchor Counter - Simple counter with Anchor framework
- Rust Counter - Native Rust implementation
- Bolt Counter - Using the Bolt ECS framework
- Crank Counter - Scheduled automatic execution
- Session Keys - Temporary signing keys with ERs
- Token Transfer - Token operations on ERs
Next steps
Account delegation
Learn how to delegate accounts to Ephemeral Rollups
Transaction execution
Understand how to execute transactions in ERs