MagicBlock: ephemeral rollups for app sessions logoMagicBlock: ephemeral rollups for app sessions
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/272MagicBlock 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.
| Step | Where | What happens |
|---|---|---|
| Delegate | Solana | CPI from your program. Owner becomes the Delegation Program. Lifetime and sync frequency are config. The payer funds a refundable deposit. |
| Execute | ER | First 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. |
| Commit | ER, then Solana | MagicIntentBundleBuilder.commit pushes state and keeps the lock. Periodic or on demand. Fraud proofs finalize later. |
| Undelegate | ER, then Solana | commit_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.
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.
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
| Who / what | Where |
|---|---|
| Docs | docs.magicblock.gg · fees |
| Quickstart | ER quickstart |
| X | @magicblock · @PiccoGabriele · @jonasXchen |
| GitHub | magicblock-engine-examples · delegation-program |
| BUILD | build.magicblock.app · Builders path |
| Related | ER overview · examples loop |
Keep reading
MagicBlock did not stop at Ephemeral Rollups. They built the people stack: a public builder directory, monthly Blitz hackathons, Forge for teams that keep shipping, Hacker House for GTM and raise, and Champions paid monthly to grow the ecosystem.
Fake World Assets (FWA.fun) is a reference design for fair NFT allocation — deposit, inverse weights, VRF draw, keep or bid — and how to rebuild it on Solana.
Ephemeral Rollups sound exotic until you see the loop: it's one Anchor program, two RPC endpoints. You delegate a PDA to an ER validator, fire cheap 10ms transactions against it, then commit state back to Solana and undelegate. MagicBlock's examples repo is the cleanest way to learn it — here's the lifecycle in real code and a map of where to start.
Get new articles in your inbox
Technical deep-dives on Solana tooling, infrastructure, and ecosystem. No noise.
