Skip to main content
Building with an AI coding agent? Install the MagicBlock Dev Skill to give your agent MagicBlock-specific patterns — delegation flows, Magic Actions, cranks, VRF, and more.Hit an error? Ask your coding agent with the skill installed, not the docs assistant. The assistant only sees the docs, so it cannot debug your code.Install it for Claude Code, Cursor, Codex, and other agents:
See the AI Dev Skill page for manual and project-scoped installs.

Permission Program

On-chain Permission Management (Coming soon)

Ephemeral Rollups SDK

SDK for Private Ephemeral Rollups

Overview

Private Ephemeral Rollups are Ephemeral Rollups that enable fine-grained permission over permissioned accounts in a Trusted Execution Environment with compliance at its heart. Each permission account maintains a list of members with specific flags that determine what actions they can perform.

Key Concepts

  • Permission Account: A PDA that stores access control rules for a specific account
  • Members: Addresses granted specific permissions via flags
  • Flags: Bitmasks that define what a member can do (authority, view logs, view balances, etc.)
  • Privacy Flag: is_private decides visibility. With is_private: false the permissioned account is public, whatever the member list holds. With is_private: true only members can read it

Member Flags

Member flags define fine-grained permissions for each member. Flags can be combined using bitwise OR to grant multiple permissions. Flag Descriptions:
  • AUTHORITY: Allows a member to update permission settings, add/remove other members, and update member flags.
  • TX_LOGS: Allows a member to view transaction execution logs.
  • TX_BALANCES: Allows a member to view account balance changes.
  • TX_MESSAGE: Allows a member to view transaction message data.
  • ACCOUNT_SIGNATURES: Allows a member to view account signatures

Ephemeral Permission

The access-control CPIs are behind the access-control feature of ephemeral-rollups-sdk. Without it, ephemeral_rollups_sdk::access_control does not exist and the snippets below fail to compile. Pin the 0.18.x line for the public TEE endpoints:
EphemeralPermission accounts live entirely on the Ephemeral Rollup and are paid for by the delegated PDA — no base-layer permission account to create, delegate, or commit-and-undelegate. Three CPI ops cover the full lifecycle: Create, Update, Close — all PDA-signed by the data account on the ER, via MagicBlock’s Permission Program ACLseoPoyC3cBqoUtkbjZ4aDrkurZW86v19pXz2XQnp1.
Prerequisite — delegate the data PDA. Only the data account is delegated to the TEE validator (on the base layer, via MagicBlock’s Delegation Program DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh). Once delegated, the PDA signs all three permission ops on the ER using its program seeds and pays the ephemeral permission rent — so it must be pre-funded at initialize time. See Quickstart for the end-to-end flow.

These public validators are supported for development. Make sure to add the specific ER validator in your delegation instruction:

Mainnet
  • Asia (as.magicblock.app): MAS1Dt9qreoRMQ14YQuhg8UTZMMzDdKhmkZMECCzk57
  • EU (eu.magicblock.app): MEUGGrYPxKk17hCr7wpT6s8dtNokZj5U2L57vjYMS8e
  • US (us.magicblock.app): MUS3hc9TCw4cGC12vHNoYcCGzJG1txjgQLZWVoeNHNd
  • TEE (mainnet-tee.magicblock.app): MTEWGuqxUpYZGFJQcp8tLN7x5v9BSeoFHYWQQ3n3xzo
  • Asia Tokyo (as-tyo.magicblock.app): MSHuBweMkNp4yPLDkPLA8bLRHbDmURWjYzsxrcBjix8
  • South America (sa.magicblock.app): MSARyz2yVTkqiYQWWgaEtUKug7oCF7PphE9GjEYHtDh
Devnet
  • Asia (devnet-as.magicblock.app): MAS1Dt9qreoRMQ14YQuhg8UTZMMzDdKhmkZMECCzk57
  • EU (devnet-eu.magicblock.app): MEUGGrYPxKk17hCr7wpT6s8dtNokZj5U2L57vjYMS8e
  • US (devnet-us.magicblock.app, validator 2.0): MUS3hc9TCw4cGC12vHNoYcCGzJG1txjgQLZWVoeNHNd
  • TEE (devnet-tee.magicblock.app): MTEWGuqxUpYZGFJQcp8tLN7x5v9BSeoFHYWQQ3n3xzo
devnet-us runs validator 2.0. Every other validator above runs 1.1.1. SDK 0.18.x reads the commit logs of both; SDK 0.20.x reads only 2.0 commit logs, so use it only with devnet-us.Localnet
  • Local ER (localhost:7799): mAGicPQYBMvcYveUZA5F5UNNwyHvfYh5xkLS2Fr1mev
1

Create Ephemeral Permission

Initialize a new EphemeralPermission account on the ER with initial members and the privacy flag. Idempotent — skip if it already exists.
2

Update Ephemeral Permission

Toggle the privacy flag, or add / remove / re-flag members. Updates take effect immediately on the ER.
3

Close Ephemeral Permission

Close the EphemeralPermission account on the ER and refund the rent to the data PDA when the permission is no longer needed.

Ephemeral Permission Operations

Initialize a new EphemeralPermission account on the ER via CreateEphemeralPermissionCpi. Payer = the delegated data PDA, which signs with its program seeds and covers the rent from the lamports pre-funded at initialize time.
Use Cases:
  • Bootstrap access control for a newly delegated PDA on the ER
  • Start public (is_private: false) and make it private later via Update with is_private: true
⬆️ Back to Top
Reference implementations: private-counter/anchor (Anchor) and private-counter/pinocchio.

Best Practices

  1. Authority Management: Always assign AUTHORITY_FLAG to at least one trusted member
  2. Least Privilege: Grant only necessary flags to each member
  3. Real-time Updates: Permissions can be updated in real-time on Private Ephemeral Rollup without undelegating, allowing dynamic access control adjustments
  4. Cleanup: Close unused ephemeral permission accounts to refund their rent to the data PDA

Security Considerations

  • Signer Validation: Only a member with AUTHORITY_FLAG, or the permissioned account itself (a PDA signing through its program), can authorize changes
  • Privacy Flag: is_private: false makes the account publicly visible, even when the member list is not empty. Listing members does not restrict anything until is_private is true
  • Owner Entry: The program records the permissioned account’s owner program as the first member, with no flags. It is not an AUTHORITY member
  • Private With No Members: is_private: true with an empty member list hides the account from every wallet. The data PDA can still update the permission by signing with its seeds
  • Full List on Update: Each update replaces the member list. A member left out of the next update loses access
  • Access Auditing: Use member flags to audit and control access

Access Control

Fine-grained Access Control

On-chain Privacy

Privacy Mechanisms and Concepts

Authorization

Authorization Framework

Compliance Framework

Compliance Standards and Guidelines