Skip to main content

Quick Access

binary-prediction

eATA custody end to end

rewards-delegated-vrf

Base-layer post-commit payouts

spl-tokens

Non-custody transfers
This guide is for on-chain programs — a DEX, AMM, prediction market, escrow, or game — that hold user funds and move them at Ephemeral Rollup speed. The core pattern: a program-owned account, delegated to the ER, with your program signing token transfers as a PDA.
Moving tokens from a client instead of on-chain? See the Quickstart.

Two custody models

The walkthrough below covers eATA custody, with the post-commit variant in the advanced snippets.

Step-By-Step Guide

Give your program authority over an eATA, delegate it, move funds PDA-signed on the ER, then settle back to Solana:
1

Make your program ER-aware

Add the #[ephemeral] attribute and import the SDK helpers.
2

Create the custody PDA and eATA

Own an eATA under the Ephemeral SPL Token program from your custody PDA.
3

Delegate the eATA

CPI into the Ephemeral SPL Token program to delegate it to the ER.
4

Move tokens PDA-signed

Sign the transfer as the custody PDA inside the rollup.
5

Commit & undelegate

Return the account to the base layer.

Custody Example

The following software packages may be required, other versions may also be compatible:

Code Snippets

1. ER-aware program

Wrap #[program] with #[ephemeral] and import the SDK helpers you need.
⬆️ Back to Top

2. Create eATA

Your program owns a state PDA (for example, a Pool) that is the authority over the funds. Custody on the ER uses an ephemeral ATA (eATA) owned by that PDA, derived from [owner, mint] under the Ephemeral SPL Token program (SPLxh1LVZzEkX99H6rqYizhytLWPZVV296zyYDPagv2).
⬆️ Back to Top

3. Delegate eATA

Delegate the eATA with a CPI to the Ephemeral SPL Token program (DelegateEphemeralAta, discriminator 4).
Delegating a plain PDA-owned ATA directly to the ER is not supported — token custody on the ER goes through an eATA. To delegate program state (not a token account), use the SDK’s #[delegate] macro instead.
⬆️ Back to Top

4. PDA-signed transfer

With the eATA delegated, move tokens inside the rollup with an SPL Token CPI signed by the custody PDA via CpiContext::new_with_signer. The signer seeds are [POOL_SEED, bump] — the program authorizes the payout itself, with no user signature.
⬆️ Back to Top

5. Commit & undelegate

Commit the ER state and return the account to the base layer with MagicIntentBundleBuilder.
⬆️ Back to Top

Advanced Code Snippets

If your program doesn’t custody funds — it moves tokens between two already-delegated accounts on a user’s behalf — no PDA signer is needed. The authority is the user’s Signer, with a plain CpiContext::new.
⬆️ Back to Top

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