Why Use a Local Setup?
When testing delegations and real-time behavior of your Solana programs, fast feedback loops are critical. Running a Local Ephemeral Rollup Validator allows you to:- Test delegations and behaviors quickly without network latency or rate limits.
- Simulate Solana runtime transactions locally.
- Customize your validator setup for your own needs.
Quickstart: Local Ephemeral Validator
Explore delegation and test scripts for both Anchor and Native Rust:Anchor
Integrate with an Anchor program
Native Rust
Integrate with a Native Rust program
Local Setup Options
You can run Ephemeral Rollups locally in three ways:- A fully local stack with
mb-test-validatoras the base layer and a localephemeral-validator. - A local Surfpool instance as the base layer alternative, while still running the rollup locally.
- A local
ephemeral-validatorconnected directly to a public base layer such as Devnet.
Important: upgrade your program with the correct validator identity
When using a local ER validator, connect it to the base layer where the accounts are delegated. If you delegate your PDA to a specific ER validator identity, update the delegation config in your program so commits and undelegations can complete correctly on the base layer.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 (devnet-as.magicblock.app):
MAS1Dt9qreoRMQ14YQuhg8UTZMMzDdKhmkZMECCzk57 - EU (devnet-eu.magicblock.app):
MEUGGrYPxKk17hCr7wpT6s8dtNokZj5U2L57vjYMS8e - US (devnet-us.magicblock.app):
MUS3hc9TCw4cGC12vHNoYcCGzJG1txjgQLZWVoeNHNd - TEE (tee.magicblock.app):
FnE6VJT5QNZdedZPnCoLsARgBwoE6DeJNjBs2H1gySXA
- Local ER (localhost:7799):
mAGicPQYBMvcYveUZA5F5UNNwyHvfYh5xkLS2Fr1mev
- Fully local
- Surfpool
- Devnet
1
Install the Ephemeral Validator CLI
2
Start the local Solana base layer
mb-test-validator starts a local Solana validator you can use as the base layer for a fully local setup.http://localhost:8899 for RPC and ws://localhost:8900 for WebSocket connections.3
Deploy or upgrade your program on localhost
- Rust Native
- Anchor
4
Start the local ephemeral validator
Connect the local Ephemeral Rollup to the local Solana validator:
5
Run tests against the local rollup
The local rollup is exposed on
http://localhost:7799 for RPC and ws://localhost:7800 for WebSocket connections.- Rust Native
- Anchor
Run the VRF Oracle Locally
If you also need to test VRF end to end, run a localvrf-oracle against a local test queue.
1
Install the latest Ephemeral Validator CLI
2
Start the local Solana validator
3
Start the ephemeral validator
4
Start the local VRF oracle
This oracle adds requests to the local test queue:If your local validator exposes a different WebSocket port, update
WEBSOCKET_URL accordingly.
