Run Rhea Example
How to run the Rhea transaction example, including helper methods and expected output.
Rhea transaction encapsulates a single EVM L2 transaction within a Solana transaction.
This functionality enables fair sequencing of rollup transactions.
Fund Necessary Wallets
Ensure the from address (0xae600d1f94680ef43ab12f8d618f8aafc208fe25) has sufficient funds on Rome Devnet Esquiline (Chain ID 121212).
Otherwise, use the instructions linked here to fund this wallet.
Run Rhea Example
RUST_LOG=info cargo run --example rheaExample Output
INFO rhea: https://explorer.solana.com/tx/5xpKQjx3f9Qv25h3Sx88fekSCiH1hRywKbDm8EMTqvY8AVPv5xUg9TXBrkUc4P3uvJohbvSCiERCP5J4edUwgzKY?cluster=devnetThe results show an EVM L2 transaction encapsulated within a single Solana transaction.
Solana Transaction
The Solana Devnet block explorer shows the Rhea Solana transaction below.
Instruction #3 logs show balance transfer from wallet ae600d1f94680ef43ab12f8d618f8aafc208fe25 to wallet b94f5374fce5edbc8e2a8697c15331677e6ebf0b.

L2 Transaction
Rome Esquiline block explorer shows the corresponding L2 transaction below between the same wallets from ae600d1f94680ef43ab12f8d618f8aafc208fe25 to b94f5374fce5edbc8e2a8697c15331677e6ebf0b.

Explanation of Methods Used
We explain the methods used in rome-sdk/examples/rhea.rs below.
Main Methods
The Rome struct will be used to compose transactions. Initialize it with your configuration:
let config = RomeConfig::load_json(common::CONFIG_PATH.parse()?).await?;
let rome = Rome::new_with_config(config).await?;Create a RheaTx transaction and then compose it using the Rome transaction structure:
let rhea_tx = RheaTx::new(tx);
let mut rome_tx = rome.compose_rollup_tx(rhea_tx).await?;Send the transaction to the Solana network:
let signature = rome.send_and_confirm(&mut *rome_tx).await?;Helper Methods
To enable tracing and logging for easier debugging, initialize a tracing subscriber using:
tracing_subscriber::fmt::init();Log relevant information using:
tracing::info!("Signature: {:?}", signature);
tracing::info!(
"https://explorer.solana.com/tx/{}?cluster={}",
signature,
rpc_url
);Create Ethereum wallet using:
let wallet = common::create_wallet();Construct a transfer transaction using:
let tx: EthSignedTxTuple = common::construct_transfer_tx(&rome, &wallet, CHAIN_ID).await?;The steps involved in transaction construction are:
Retrieve to and from addresses
Obtain the nonce
Create a transaction request (using ethers library)
Estimate gas fees
Sign the transaction
Last updated
Was this helpful?