For the complete documentation index, see llms.txt. This page is also available as Markdown.

7. Open your EVM app to Solana wallets

Make your contract usable from a Solana wallet with no EVM key, covering the synthetic address, ERC-20 value, the two signatures and the atomic budget.

Your contract already works with MetaMask. Now you let a Solana wallet call it with the key it already has, so the user never creates an EVM account. They call the same contract, at the same address, against the same state.

What you'll learn

  • How a Solana wallet becomes a normal msg.sender on Rome.

  • Why this course takes value as an ERC-20 deposit, and what msg.value needs from a Solana user.

  • What a Solana user signs for each call, and where the transaction goes.

  • What fits in one Solana transaction, and what happens to a call that does not.

  • Which deps the SDK needs and where each one comes from.

Before you start

  • Finish 6. Tokens on both sides. This lesson assumes you know what a wrapper is and why a user grants it once.

  • Have HelloRome deployed on Hadrian from 3. Your first contract on Hadrian.

  • Install the TypeScript SDK, as in Rome SDK.

  • Have a Solana wallet that signs Solana v1 transactions, with a little devnet SOL and devnet USDC. Faucets are listed in Faucets. Support for v1 transactions differs between wallets, so test yours first. Build a dual-lane app names the wallets checked so far.

The lesson

Step 1. Meet the synthetic address

A Solana wallet has no EVM address, so Rome derives one from its public key. The result is the wallet's synthetic address. It is the msg.sender your contract sees, and it carries its own nonce and storage like any other account. The same wallet always maps to the same address.

In this course's flow the synthetic holds no tokens at rest. They start in the user's Solana wallet. The fund leg moves them into the synthetic's token account before a deposit, and only then does the wrapper's balanceOf(synthetic) show them. The sweep leg moves them back to the wallet after a withdraw. Read the full model in Call EVM from Solana.

Step 2. Make the contract Solana-ready

Most contracts need no change. Three rules decide whether yours is one of them:

  • Take value as an ERC-20. Pull with transferFrom after an approve, and return with transfer.

  • Point at the canonical wrapper for each token. Do not deploy your own.

  • Keep each Solana-lane call inside one Solana transaction.

The first rule is the one that bites. This entry point works for MetaMask users. It fails for Solana users in the fund-and-sweep model, because their synthetic holds no native balance unless you fund it with fundSyntheticGas:

This one works for both, because both lanes can fund a transferFrom:

Wrapper addresses are on Contract Addresses. The checks for a Solana-ready contract are in Open your Solidity contract to Solana users.

Step 3. Know what the wallet signs

The SDK call is submitRomeTxV1. For each call, the proxy composes one Solana v1 transaction. The wallet signs twice with the same key. First it signs a readable authorization message that names the EVM transaction hash. Then it signs the transaction itself.

The app sends the signed transaction to the Solana RPC, not to the Rome proxy. The chain checks the authorization through the Ed25519 program and runs your call as the synthetic address. The user never holds an EVM key.

Before the wallet signs the transaction, the SDK checks that it carries exactly the call the user authorized. Anything else is refused. The details are in Open your Solidity contract to Solana users.

Step 4. Wire the lane

The SDK needs five values: a proxy URL, a chain ID, the Rome program ID, a Solana RPC connection and a signer. Four describe the chain. One comes from the wallet.

For Hadrian, read the four chain values from the registry. The mapping is in the deps table of the guide linked in step 3, and the values are on Hadrian. Lesson 11 covers the same wiring for Rubicon.

Two one-time steps come before a new user's first value-moving call. Provision the synthetic with buildCreatePdaCall, and grant the wrapper if isEnabled is false. submitRomeTxV1 does not provision for you. Lesson 9 runs both in order.

Step 5. Stay inside one transaction

A Solana-lane call has to fit one Solana transaction: about 1.4M compute units, 64 accounts and 4 KB. Measure with computeUnitsConsumed from the Solana receipt, not EVM gasUsed. Request the transaction with maxSupportedTransactionVersion: 1; without it the RPC refuses the request.

When a call does not fit, the composer refuses it and the SDK hands it to the proxy to relay with the same authorization signature. The user still sees one prompt. The result carries route: "relay". A relayed call spends the synthetic's native gas, so top it up first with fundSyntheticGas. A relayed call that reverts does not throw. Check receipt.status. The rules are in Relayed calls and long calls. Limits in one table: Constraints.

Check yourself

Answer these, then open the answers.

  1. Why does a payable deposit fail for a Solana user?

  2. How many signatures does the wallet produce per call, and what does each cover?

  3. Where does the signed transaction go?

  4. A call needs more than one transaction. What does the user see, and who pays?

Answers
  1. The user's money is an SPL token in their wallet, shown on Rome as the wrapper. The synthetic holds no native balance in the fund-and-sweep model unless you fund it, so there is no msg.value to send.

  2. Two. The first covers a readable authorization message with the EVM transaction hash. The second covers the Solana transaction.

  3. To the Solana RPC, sent by the app. The proxy composes the transaction and does not receive it, except for a relayed call.

  4. One authorization prompt. The proxy relays the call and the synthetic's native gas balance pays for it.

Next

8. Open your Solana program to EVM users

Last updated

Was this helpful?