← Articles
MagicBlock: ephemeral rollups for app sessions logo
solana

MagicBlock: ephemeral rollups for app sessions

· AUG 29, 2026 ·
Read
Share

Delegate accounts, run the session on Magic Router, commit when you need Solana to see the bytes, undelegate when the session ends.

devrels.xyz/a/272

MagicBlock Ephemeral Rollups are a short-lived SVM that your existing Solana program can run. You lock one or more accounts onto an ER validator, fire the same instructions at about 10ms slots, then write the bytes back to Solana and unlock.

That lock is the session. Use it for a match, an auction burst, or any loop that writes too often for a 400ms slot. The architecture overview and the counter examples already cover the pitch and the repo. This page is the app-team path: delegate, execute, commit, settle.

The session

Ownership moves to the Delegation Program DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh while the account is locked. Base-layer reads still work. Writes for that account have to go to the ER until you undelegate. Pick a region validator (Asia, EU, US, or TEE) and pass it in the delegate instruction.

App session on an Ephemeral Rollup
StepWhereWhat happens
DelegateSolanaCPI from your program. Owner becomes the Delegation Program. Lifetime and sync frequency are config. The payer funds a refundable deposit.
ExecuteERFirst ER transaction clones the account. Later transactions update it. Same program ID. Slot time is about 10ms (not a guarantee). Serialized tx size on the ER is 64 KB.
CommitER, then SolanaMagicIntentBundleBuilder.commit pushes state and keeps the lock. Periodic or on demand. Fraud proofs finalize later.
UndelegateER, then Solanacommit_and_undelegate writes the last state, then restores the original owner. Deposit charges land here.

Magic Router

Point the client at one RPC. Magic Router inspects writable accounts and sends delegated work to the ER and everything else to Solana. Wallets sign as usual. You do not split endpoints per instruction.

Devnet: https://devnet-router.magicblock.app. Mainnet: https://router.magicblock.app. Kit uses @magicblock-labs/ephemeral-rollups-kit. web3.js uses ConnectionMagicRouter from @magicblock-labs/ephemeral-rollups-sdk.

typescript
import { ConnectionMagicRouter } from "@magicblock-labs/ephemeral-rollups-sdk"
import { sendAndConfirmTransaction } from "@solana/web3.js"

const connection = new ConnectionMagicRouter(
  "https://devnet-router.magicblock.app/",
  { wsEndpoint: "wss://devnet-router.magicblock.app/" },
)
const sig = await sendAndConfirmTransaction(connection, tx, [payer], {
  skipPreflight: true,
  commitment: "confirmed",
})

Program hooks

Write the program as you would on Solana. Add cargo add ephemeral-rollups-sdk --features anchor. The #[ephemeral] macro injects the undelegation callback discriminator that the Delegation Program CPIs on unlock. commit_accounts is deprecated. Use MagicIntentBundleBuilder.

rust
use ephemeral_rollups_sdk::ephem::MagicIntentBundleBuilder;

pub fn commit(ctx: Context<IncrementAndCommit>) -> Result<()> {
    MagicIntentBundleBuilder::new(
        ctx.accounts.payer.to_account_info(),
        ctx.accounts.magic_context.to_account_info(),
        ctx.accounts.magic_program.to_account_info(),
    )
    .commit(&[ctx.accounts.counter.to_account_info()])
    .build_and_invoke()?;
    Ok(())
}

pub fn undelegate(ctx: Context<IncrementAndCommit>) -> Result<()> {
    MagicIntentBundleBuilder::new(
        ctx.accounts.payer.to_account_info(),
        ctx.accounts.magic_context.to_account_info(),
        ctx.accounts.magic_program.to_account_info(),
    )
    .commit_and_undelegate(&[ctx.accounts.counter.to_account_info()])
    .build_and_invoke()?;
    Ok(())
}

Commit a list of accounts together when they depend on each other. The bundle is atomic on the way back to Solana. After a commit you can keep writing on the ER. After undelegate, the next write on that PDA is a normal Solana transaction.

What the session costs

Normal ER transactions are 0 in the current release (20 Aug 2026 docs). Solana fees still apply to delegate, undelegate, and any base-layer transaction.

The deposit you fund at delegate is the real bill. Undelegate takes 300,000 lamports for the session plus 100,000 lamports for each commit after the first, capped at the deposit, and refunds the rest to the rent_payer. Without a delegated fee payer you get 10 commits, then custom error 0xA0000000. A final commit-and-undelegate still runs so the account is not stuck. For a longer session, add a delegated fee payer and the validator magic_fee_vault. Live commit fees start at commit 26 (100,000 lamports per account).

Magic Actions are Solana instructions that run right after a commit, using the freshly written state. That is how you pay out, update a leaderboard, or hit another program without waiting for undelegate. Session keys are a separate wallet trick: an ephemeral keypair signs during the session so the user is not prompted every tick.

People and links

Keep reading

Get new articles in your inbox

Technical deep-dives on Solana tooling, infrastructure, and ecosystem. No noise.

MagicBlock: ephemeral rollups for app sessions | devrels.xyz