Rome Docs
  • Getting Started
  • Overview of Rome
    • Rome Scales Bitcoin
      • How Rome Scales Bitcoin
    • Rome Scales Ethereum
      • How Rome Scales Ethereum
    • Rome Scales Rollups
      • How Rome Scales Rollups
    • Rome Provides Interop with Cosmos
      • How Rome Provides Interop with Cosmos
  • Nexus: Rome's Based Sequencer
    • How Nexus Works
    • Transaction Flow
  • Rome Interop
    • Rome SDK
    • Rome SDK Setup
      • Prepare Environment
      • Set Configuration
      • Run Rhea Example
      • Run Remus Example
      • Run Romulus Example
    • Remus: Cross-Rollup Atomicity
    • Romulus: Cross-Chain Atomicity
  • L2 EVM Setup
    • Prepare Config
    • Download Repos
    • Register your L2
    • Initialize your L2
    • Setup OP Geth Node
    • Run Block Explorer
    • Airdrop & Metamask
    • Check L2 State
    • Simple Transfers
    • Uniswap
    • Run on Remote Server
      • Setup AWS Server
      • Setup Certificate
  • Rome EVM
    • How to use Rome EVM
    • RPC Information
    • Tutorial to deploy a smart contract on Rome EVM
  • Shared Sequencer
    • Atomicity
    • Rome Transactions
    • Rhea
    • Hercules
    • Data Availability
    • Settlement
Powered by GitBook
On this page
  • Methods Used
  • Main Methods
  • Helper Methods
  • Example Results
  • Solana Transaction
  • Rollup Transaction

Was this helpful?

  1. Rome Interop
  2. Rome SDK Setup

Run Rhea Example

Rhea enables fair sequencing of rollup transactions. Rhea transaction encapsulates a single Ethereum-like rollup transaction within a Solana transaction.

Run Rhea example using:

cargo run --example rhea

Ensure the from address (0xae600d1f94680ef43ab12f8d618f8aafc208fe25) has sufficient funds, otherwise airdrop to from address.

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

Example Results

cargo run --example rhea

INFO rhea: https://explorer.solana.com/tx/4uRtgGK7DkZcyrdjJZHdstneg5JTSUC9ZV1Pm11HVmcvXC756grP2g8PxrFUE1ZLvXNyV6T869SHqBbFtn6o39NV?cluster=devnet

Solana Transaction

Rollup Transaction

The Rollup block explorer shows this rollup transaction for chain 200004 from wallet ae600d1f94680ef43ab12f8d618f8aafc208fe25 to b94f5374fce5edbc8e2a8697c15331677e6ebf0b.

PreviousSet ConfigurationNextRun Remus Example

Last updated 1 month ago

Was this helpful?

The Solana block explorer shows the Solana transaction below (). Instruction 3 logs show balance transfer from wallet ae600d1f94680ef43ab12f8d618f8aafc208fe25 to wallet b94f5374fce5edbc8e2a8697c15331677e6ebf0b for chain 200004.

link here