Quick Access
Check out example:GitHub
Private Counter Anchor Implementation
Live Example App
Try the Private Counter
MagicBlock’s Private Ephemeral Rollup enforces compliance based on node-level
IP geofencing, OFAC-sanction list and restricted jurisdictions at ingress,
before any transaction is accepted or executed. Find out
more
Step-By-Step Guide
Build your program, delegate state to the TEE validator, and create anEphemeralPermission account directly on the ER via MagicBlock’s Permission Program ACLseoPoyC3cBqoUtkbjZ4aDrkurZW86v19pXz2XQnp1 and Delegation Program DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh:
1
Write your Solana program as you normally.
2
Delegate and create permission
delegate delegates the counter to the TEE validator on the base layer.
init_permission then runs on the ER — the delegated PDA signs as PDA and
pays its own ephemeral permission rent (pre-funded at initialize time).
set_privacy flips the public/private flag on demand. No base-layer
permission account to create, delegate, or commit-and-undelegate. See
access control details.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
- 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
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
3
Deploy your Solana program using Anchor CLI.
4
Implement authorization in your client
Sign user message to retrieve authorization token from TEE endpoint.
5
Execute transactions and test privacy
Request for authorization token and send confidential transactions.
Private Counter Example
The following software packages may be required, other versions may also be compatible:The EphemeralPermission flow shown below requires
ephemeral-rollups-sdk
v0.14.2 or later (introduces CreateEphemeralPermissionCpi /
UpdateEphemeralPermissionCpi / CloseEphemeralPermissionCpi) with the
access-control feature enabled. Without the feature,
ephemeral_rollups_sdk::access_control does not exist and the program does
not compile. Pin the 0.18.x line for the public TEE endpoints, which run
validator 1.1.1. An unpinned cargo add resolves to 0.20, the validator 2.0
line. For older SDK and Anchor versions, see
legacy examples.Code Snippets
- 1. Write program
- 2. Delegate and create permission
- 3. Deploy
- 5. Test
A simple counter program with ⬆️ Back to Top
initialize and increment instructions, identical in shape to the public counter — privacy is added in the next steps:Advanced Code Snippets
These ER building blocks work the same way inside a Private Ephemeral Rollup.- Resize PDA
- Magic Router
- Magic Action
- Top-up delegated account
- On-Curve Delegation
- Delegation Actions
When resizing a delegated PDA:⬆️ Back to Top
- PDA must have enough lamports to remain rent-exempt for the new account size.
- If additional lamports are needed, the payer account must be delegated to provide the difference.
- PDA must be owned by the program, and the transaction must include any signer(s) required for transferring lamports.
- Use
system_instruction::allocate
Access Control
Fine-grained Access Control
On-chain Privacy
Privacy Mechanisms and Concepts
Authorization
Authorization Framework
Compliance Framework
Compliance Standards and Guidelines
Solana Explorer
Get insights about your transactions and accounts on Solana:Solana Explorer
Official Solana Explorer
Solscan
Explore Solana Blockchain
Solana RPC Providers
Send transactions and requests through existing RPC providers:Solana
Free Public Nodes
Helius
Free Shared Nodes
Triton
Dedicated High-Performance Nodes
Solana Validator Dashboard
Find real-time updates on Solana’s validator infrastructure:Solana Beach
Get Validator Insights
Validators App
Discover Validator Metrics
Server Status
Subscribe to Solana’s and MagicBlock’s server status:Solana Status
Subscribe to Solana Server Updates
MagicBlock Status
Subscribe to MagicBlock Server Status
MagicBlock Products
Ephemeral Rollup (ER)
Execute real-time, zero-fee transactions securely on Solana.
Private Ephemeral Rollup (PER)
Protect sensitive data with compliance — built on top of Ephemeral Rollups.
Ephemeral SPL Token
Move SPL tokens at rollup speed — public or private transfers, swaps, and private payments for trading and DeFi apps.
Prediction Markets & Trading
Combine real-time execution, session keys, token custody, price feeds, automation, and settlement.
Solana VRF
Add provably fair onchain randomness to games, raffles, and real-time apps.
Pricing Oracle
Access low-latency onchain price feeds for trading and DeFi.

