Skip to main content

Dynamic Transaction Routing

Magicblock’s Magic Router is an dynamic transaction routing engine that accelerates transactions by intelligently deciding where they should be executed — either on Ephemeral Rollups or Solana — based on transaction metadata. This eliminates the need for manual routing logic from the developer, providing significant benefits in transaction speed and development experience.
  • Simple Integration with Single Endpoint: Just connect to a single RPC endpoint.
  • Seamless Wallet Experience: Connect, sign, and submit — no need to know what’s happening behind the scenes.
  • Faster Confirmations: Magic Router routes to the fastest available endpoint.

Quick Access


Code Snippets

Initialize connection with Magic Router before you send transaction dynamically.
These public RPC endpoints are currently free and supported for development:
Magic Router Devnet: https://devnet-router.magicblock.app
Utilize MagicBlock’s SDK to initialize, send and confirm transaction:
  • ephemeral-rollups-kit powered with @solana/kit
  • ephemeral-rollups-sdk powered with @solana/web.js
import { 
  Connection, 
} from "@magicblock-labs/ephemeral-rollups-kit";

// Initialize connection
const connection = await Connection.create(
"https://devnet-router.magicblock.app",
"wss://devnet-router.magicblock.app"
)

// ... create transaction

// Send and confirm transaction
const txHash = await connection.sendAndConfirmTransaction(
transactionMessage,
[userKeypair],
{ commitment: "confirmed", skipPreflight: true }
)

The Magic Router analyzes each transaction’s metadata (e.g. writable accounts, owner, and signer) and automatically routes it to the closest dedicated endpoint:
  1. Client - Transaction Submission The dApp or user sends a transaction to the Magic Router RPC endpoint.
  2. RPC - Metadata Inspection The Magic Router inspects the transaction metadata and checks the owner of writable accounts.
  3. Validator - Smart Routing and Execution Based on the metadata, the router determines whether to send it to:
    • Ephemeral Rollup for fast, low-latency, zero-cost execution
    • Solana for persistent, high-throughput execution