Solana Native SDK: Solana-Native UX in an EVM dApp (Part 1)
Welcome to Week 6 of the Neon Dev Bootcamp! We're in the second half of our journey—and things are about to get even more exciting.
Previously, we explored how Solidity contracts can call Solana programs via Neon’s composability libraries. This week, we’re flipping the script: we’ll interact with dApps using a Solana wallet like Phantom—no MetaMask required, no bridging assets.
This is made possible thanks to the Solana Native SDK, a powerful Neon EVM tool that brings a native Solana experience to EVM-based dApps.
What You’ll Learn
- How Neon EVM maps Solana wallet interactions into Ethereum transactions
- What it means to schedule a Neon transaction from a Solana wallet
- How to grant USDC token approvals and make transfers with Solana keys
User Flow
.png)
Ethereum User Flow (via Neon Proxy & Composability):
- User signs a tx with an EVM wallet (e.g., MetaMask).
- Sent to Neon Proxy → translated into a Solana-compatible tx.
- Executed on Solana by the Neon EVM Program. Uses composability to interact with SPL tokens and Solana programs.
Solana User Flow (via Solana Native SDK):
- User signs a Solana transaction using Phantom.
- The transaction already includes EVM logic.
- It’s submitted directly to the Neon EVM Program, bypassing the proxy, - with the help of Solana native SDK.
For Solana users, Neon is abstracted away. They simply connect Phantom and go.
Example 1: USDC Approval from Solana
You’ll learn to:
- Use a Solana wallet to approve USDC tokens in an EVM contract
Prerequisites
- Configure
.env
withPRIVATE_KEY_SOLANA
- Funded Solana wallet (on Devnet)
- Use the
/sol
RPC endpoint:https://devnet.neonevm.org/sol
Step 1: Load Wallet & Initialize Neon EVM
- Decode your Solana private key
- Use
proxyApi.init()
to derive:solanaUser.publicKey
: your Solana addresssolanaUser.neonWallet
: mapped Neon EVM addresssolanaUser.balanceAddress
: Neon balance account on Solana
💡 Make sure your Solana wallet has some DEVNET SOL — otherwise the script exits.
Step 2: Check Current USDC Allowance
- Query
USDC.allowance(neonWallet, neonWallet)
- (yes, the spender and owner are the same in this example)
Step 3: Build & Schedule Approval Transaction
- Prepare
approve()
calldata for USDC, approving tokens to your own EVM address - Estimate gas for the scheduled tx using
proxyApi.estimateScheduledTransactionGas()
- Use the current nonce from
getTransactionCount()
Step 4: Ensure Balance Account Exists
- Check if the Neon balance account exists on Solana
- If not, prepend
createBalanceAccountInstruction()
to the Solana tx
Step 5: Sign & Send Scheduled Transaction
- Attach blockhash and sign the Solana tx with your keypair
- Submit to Solana with
sendRawTransaction()
- Wait ~60 seconds for Neon EVM execution
Example 2: USDC Transfer via Solana
Now let’s use Solana to transfer USDC to another Neon wallet.
Step 1: Initialize Wallets & Contracts
- Use
proxyApi.init()
to derive:solanaUser.publicKey
: Solana addresssolanaUser.neonWallet
: linked EVM address
- Use the
ERC20ForSPL
contract for USDC:- Query
tokenMint()
to find the SPL mint - Derive PDA (Program Derived Address) for USDC contract
- Query
Step 2: Check Balance & Build Transfer
- Get your USDC ATA for the mint + Solana user
- Check if your ATA has enough balance
- Pick a random EVM wallet as the recipient
- Build
transfer(to, amount)
calldata for 1 USDC
Step 3: Insert Approval if Needed
- If your ATA has:
- No delegate OR
- Zero delegatedAmount
- Then insert an
approve()
instruction to delegate the ATA to the contract PDA
The approval uses max uint64 to avoid doing it again later
Step 4: Ensure Balance Account Exists
- If your Neon balance account doesn’t exist, insert a
createBalanceAccountInstruction()
before sending
Step 5: Send Scheduled Transaction
- Sign the transaction using your Solana keypair
- Submit the transaction to Solana
- Wait ~60 sec for Neon EVM execution
Summary
You’ve just:
- Scheduled and signed EVM txs with Solana keys
- Approved and transferred tokens from Solana to Neon EVM
- Skipped MetaMask entirely!
Practice Exercise
- Copy the scripts (Approve & Transfer) and create a new repo with them to run and test how they work.
- Observe:
- Gas estimation
- Balance changes
- tx hash resolution from Neon RPC
You don’t need to write your own script to submit the task—but playing with the code is highly recommended!
Once done, push your scripts to GitHub and submit the repo link including a README with your observations about how approval and transfer work with Solana Native SDK.
Next time, we’ll apply this to a real dApp UI integration. Get ready!
Resources
Script 1: Approve USDC tokens
Script 2: Transfer USDC tokens
Solana native SDK documentation