This skill helps you implement MagicBlock Ephemeral Rollups on Solana, enabling low-latency delegation, cranks, and VRF for real-time gaming and apps.
npx playbooks add skill magicblock-labs/magicblock-dev-skill --skill skill
solana-dev skillUse this skill for MagicBlock-specific concerns: ER/PER, delegation, oracles, Session Keys, cranks, VRF,
Magic Actions, eSPL, and private payments. For general Solana or Anchor work such as scaffolding, PDAs,
account layouts, SPL tokens, clients, wallets, or LiteSVM/Mollusk testing, also load solana-dev.
Ephemeral Rollups enable high-performance, low-latency transactions by locking a delegated
account on the base layer while an ER clone continues to execute under the account's original program
owner. They are useful for gaming, real-time apps, and fast transaction throughput.
Ephemeral Accounts are born, used, and closed only inside an ER. They are useful for temporary
high-frequency state, but they never commit to Solana and therefore cannot be the only copy of durable
ownership, balances, rewards, or settlement results.
Delegation temporarily assigns the base-layer account to the Delegation Program and clones it into
the ER with its original program owner. Normal program ownership, signer, authority, and account
constraints still apply on the ER; delegation status is a routing and lifecycle concern, not a new
application authorization rule.
Post-delegation actions attach instructions to a base-layer delegation withdelegate_account_with_actions. The Delegation Program stores them in the delegation record; the
validator runs them on the ER after cloning. Base-layer delegation success does not prove that the
action ran. For public or encrypted payloads, signer handling, and recovery, read
[delegation-actions.md](references/delegation-actions.md). These are distinct from post-commit
Magic Actions, which run on the base layer.
Delegation debugging invariant: a properly delegated account looks owned by
the delegation program on base, owned by the original program on the ER endpoint
returned by router getDelegationStatus, and reported isDelegated: true bygetDelegationStatus sent to that ER endpoint itself.
With the SDK 0.18.x pin (and 0.17.x), use MagicIntentBundleBuilder to
schedule commit and commit-and-undelegate intents. Do not use the deprecated
free functions commit_accounts and commit_and_undelegate_accounts.
Private Ephemeral Rollups (PER) gate a delegated account inside a TEE-backed validator with an ER-local EphemeralPermission. Delegate only the data account on the base layer, then create, update, and close its permission on the ER with CreateEphemeralPermissionCpi, UpdateEphemeralPermissionCpi, and CloseEphemeralPermissionCpi. For new code, do not create or delegate a separate base-layer permission account. That is application guidance, not a protocol rule: the legacy v1 base-layer permission path still works (see [delegation.md](references/delegation.md#private-ephemeral-rollups-per-er-local-permissions)).
Magic Actions are base-layer instructions scheduled inside an ER transaction viaMagicIntentBundleBuilder.add_post_commit_actions(...). Each attempted base-layer transaction applies
its commit and actions atomically. If any BaseAction fails, the committor removes every BaseAction in
that affected TransactionStrategy before retrying its remaining commit strategy; actions in other
transaction/finalize strategies are outside that removal scope. Observe and reconcile every originally
scheduled action: scheduling or eventual commit success alone does not prove that any of them ran.
Commit fees and limits span the Delegation Program and validator. Without the fee-vault path,
a plain commit fails with 0xA0000000 once the account's commit nonce reaches 10, so commit 11
fails when commits land one at a time. On 1.x the check reads the last landed nonce, so commits
queued before earlier ones land are not counted yet; 2.0 counts queued commits. That is a hard cap
until the account is undelegated; commit-and-undelegate stays allowed so it can exit. Re-delegating resets the count but
does not make commits free: the delegation deposit pays a 3M session fee plus 1M per commit after the
first at undelegation. For short seeds without actions the deposit is about 2.8M–3.3M lamports, so
nothing is refunded once a session has committed twice; longer seeds or actions raise the deposit
and can leave a refund. With a delegated
payer and validator-scoped magic_fee_vault, commit 26 onward debits 1_000_000 lamports per
committed account on the live validators (8886db2; the v1.1.1 tag charged 100_000). The live
validators refuse to commit an account larger than 10,240 bytes, so do not delegate accounts you will
need to commit above that size. Read
[fees-and-commit-economics.md](references/fees-and-commit-economics.md) first for fee, refund,
sponsorship, cost-estimation, or fee-payer funding questions.
Lamports top-up: when a delegated account (e.g. a delegated fee payer) needs more lamports on the ER side, use lamportsDelegatedTransferIx from the SDK. The transaction is submitted on base layer — the Ephemeral SPL Token program creates a single-use lamports PDA, funds it, and delegates it so the ER credits the destination.
Ephemeral SPL Token has two surfaces. In the SDK lifecycle model, clients usedelegateSpl/transferSpl/undelegateIx/withdrawSpl, and the ER balance appears as a normal SPL token
account at the owner's canonical ATA address, so Anchor programs can use plain SPL Token CPI. In the
direct-program model, contracts use ephemeral-spl-api and explicitly work with the eATA/global-vault
PDAs; do not apply the canonical-ATA model to that raw surface. Private base→ephemeral transfers now
credit an ER-only Magic ATA (TS SDK ≥ 0.17.1). Before you promise that an eSPL feature works on
a cluster, check the devnet/mainnet deployment table in
[ephemeral-spl-token.md](references/ephemeral-spl-token.md#deployment-status).
Pricing Oracle republishes Pyth Lazer feeds into accounts updated on the ER. Read them on the
ER only: the base-layer copies are delegated and stale (mainnet SOL/USD was 462 days old on
2026-11-19). The stored exponent is +8 on every feed, so take the exponent from the feed list.
Feeds are PriceUpdateV3 accounts owned by PriCems…; Account<PriceUpdateV2> rejects them. A safe
integration verifies the feed account and owner, upstream publish-time freshness, value domain,
checked arithmetic, and user price bounds; successful deserialization alone is not price validation.
See [pricing-oracle.md](references/pricing-oracle.md).
Session Keys authorize a temporary signer for constrained application actions. Session validity is
separate from SPL token authority: token spending also requires an explicit, bounded token delegate
allowance.
Architecture:
┌─────────────────┐ delegate ┌─────────────────────┐
│ Base Layer │ ───────────────► │ Ephemeral Rollup │
│ (Solana) │ │ (MagicBlock) │
│ │ ◄─────────────── │ │
└─────────────────┘ undelegate └─────────────────────┘
~400ms ~10-50ms
Use Anchor with ephemeral-rollups-sdk; native and Pinocchio are also supported.
ephemeral-rollups-sdk / Anchor versions unless the task is an explicit upgradeanchor for Anchor 1.x programs, or anchor-compat for Anchor >=0.28,<1.0 programs (SDK 0.18.x and earlier). SDK 0.20.0 removed anchor-compat (#317), so new code should target Anchor 1.xaccess-control (PER), spl (eSPL), vrf, and crankRequired macros:
#[ephemeral] on the program module, before #[program] — injects the process_undelegation callback (the delegation program CPIs into it to return the account) and the commit/undelegate intent builders. Commit and undelegation require it; delegation itself does not. Include it on any program that delegates so its accounts can later be undelegated.#[delegate] and #[commit] on the respective delegation/commit account contexts.#[vrf] on a VRF request context and #[vrf_callback] on the VRF callback context — thecallback macro authenticates fulfillment. Enable the vrf feature on ephemeral-rollups-sdk.
SDK 0.17+ re-exports VRF behind that feature, so new Anchor code does not need a directephemeral-vrf-sdk dependency. In 0.17, create_request_randomness_ix is the scoped request
(0.16 called it create_request_scoped_randomness_ix); 0.18 deprecates it in favour ofcreate_request_randomness_ix_const. On 0.20.0, #[vrf] does not compile. See
[vrf.md](references/vrf.md).
Non-Anchor programs: use theephemeral-rollups-pinocchio crate (delegation, commit, and VRF have Pinocchio equivalents). The
engine examples repo ships Anchor and Pinocchio variants of roll-dice; use Pinocchio when
the target program is native rather than Anchor.
Versions in this skill are known-good snapshots or compatibility markers. Before changing dependencies,
inspect the target repository's manifests, toolchain files, lockfiles, and relevant upstream sources.
See [resources.md](references/resources.md) for the dated snapshot and source links.
Validators (checked 2026-11-19). Validator 2.0 is released: v2.0.2 is the GitHub Latest
release and npm latest is 2.0.1. Only devnet-us runs it (getVersion reports core 2.0.0,
commit 9456c18), and the devnet router can place delegations there. The other public and TEE ERs
report magicblock-core 1.1.1 but run V1 branch head 8886db2, not the v1.1.1 tag. 8886db2
differs from the tag in the fee-vault commit fee and in the no-vault limit on commit_finalize; see
[fees-and-commit-economics.md](references/fees-and-commit-economics.md). 2.0 moves scheduled tasks to
Hydra and changes the commit receipt log ([cranks.md](references/cranks.md),
[delegation.md](references/delegation.md)). Check getVersion on the target ER before relying on
either behavior: 2.0 reports core, 1.x reports magicblock-core.
SDK lines. Pin ephemeral-rollups-sdk (Rust) and @magicblock-labs/ephemeral-rollups-sdk (npm,
dist-tag legacy) to 0.18.x for the public ERs; it supports validator 1.x and 2.0. 0.20.x is the
2.0 line (anchor-lang ≥ 1.2.2, no anchor-compat, kit ^8); use it only against 2.0 endpoints. Its
Rust #[vrf] fails to compile (E0433 slot_hashes), and its TS GetCommitmentSignature throws on
v1 logs. 0.17.x's GetCommitmentSignature throws on v2 logs. cargo add without a version and npm@latest resolve to 0.20. See [resources.md](references/resources.md#sdk-lines).
https://rpc.magicblock.app/devnet or https://rpc.magicblock.app/mainnet
https://devnet-router.magicblock.app/ or https://router.magicblock.app/
use the fqdn returned by router getDelegationStatus
For a new application, integration design, migration, or implementation plan, read
[architecture-planning.md](references/architecture-planning.md) before writing code. Decide whether MagicBlock
is needed, select the smallest product set, map accounts and transaction routing, define settlement
and recovery, and choose validation environments. Ask at most three material questions per round;
otherwise proceed with explicit assumptions.
https://rpc.magicblock.app/devnet or https://rpc.magicblock.app/mainnethttps://devnet-router.magicblock.app/ or https://router.magicblock.app/fqdn returned by router getDelegationStatus for the accountFor each implementation, record:
getDelegationStatus checks before operationsthe transaction executes and is recorded either way, and skipPreflight: true only makessendTransaction return before execution, so it hides the execution error. If you skip it,
check the ER transaction status and logs
default shuttle withdrawal, or explicitly run undelegateIx, wait for its base commit, and call the
legacy withdrawSpl(..., { idempotent: false }); use ephemeral-spl-api exports (not copied bytes
or guessed seeds) for direct CPI
enforced spending limits, and any separate SPL delegate allowance
idempotency, timeout, retry, refund, and reconciliation
For security-sensitive designs, reviews, and implementations, read [security.md](references/security.md). Separate
protocol guarantees from required integration validation, application policy, and ordinary Solana
security. Do not present an application recommendation as a MagicBlock protocol guarantee. In a
review, report each finding with its runtime, product state, label, source, consequence, and test,
using the template in [security.md#review-output](references/security.md#review-output).
For InvalidWritableAccount, missing private balances, validator mismatch, or
"account is delegated but ER rejects it" reports:
getDelegationStatus and use its fqdn for ER reads/transactions.maxSupportedTransactionVersion: 1.
For unexpected RPC, routing, oracle, or transaction errors that could be service-side:
https://status.magicblock.app/api/services as the source of truth.mainnet and devnet.asia, europe, usa, and tee; mainnet also has asia-tyo and southamerica..meta.services; currently er (Ephemeral Rollup), rpc_router, pricing_oracle, and vrf_oracle..environments[network].regions[region].servers; for mainnet Asia this includes as.magicblock.app..live_status[service]: true = Operational, false = Down, missing/undefined = N/A..metrics[service] as downtime minutes per day aligned with .meta.days in UTC.getHealth or getVersion, but do not let a single RPC probe replace the status API.crank feature; see [cranks.md](references/cranks.md) for Hydra and validator 2.0 changes)When combining products, read [composition-patterns.md](references/composition-patterns.md) and keep authority,
token control, oracle validity, ER execution, base settlement, and asynchronous completion as separate
guarantees.
When you implement changes, provide:
Before the final response, review the entire run against this skill's intended workflow.
Check:
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.