Initialize your L2

Create the environment needed to setup the L2 and use it to initialize L2 state. Generate secrets, keypairs, set environment variables, update configuration files, and then create initial balance.

Generate JWT secret

Generate a JWT secret that will be used by Geth. Store this secret securely.

openssl rand -hex 32

Example value below.

78f54d165d7996252e4664a4d3049b56b9b0b0e5d4c9e50c0f6887205766aafb

Generate Solana keypairs

Generate two new Solana keypairs in rome-apps/docker/keys, called Rhea keypair and Proxy keypair. These keypairs will be used by the Rhea and Light Client services (explained on the next page) to sign and pay for Solana transactions.

cd rome-setup/docker

solana-keygen new -o keys/rhea-sender.json --no-bip39-passphrase --force

solana-keygen new -o keys/proxy-sender.json --no-bip39-passphrase --force

Set environment variables

Set Chain ID, Genesis address, and Genesis balance below.

export CHAIN_ID=1002
export GENESIS_ADDRESS=0xf0e0CA2704D047A7Af27AafAc6D70e995520C2B2
export GENESIS_PRIVATE_KEY=241bfd22ba3307c78618a5a4c04f9adbd5c87d633df8d81cfb7c442004157aba
export GENESIS_BALANCE=1000000000000000000000000
export JWT_SECRET=78f54d165d7996252e4664a4d3049b56b9b0b0e5d4c9e50c0f6887205766aafb
export GASOMETER_HOST=http://proxy:9090
export SOLANA_RPC=https://apieu.devnet.romeprotocol.xyz
export PROGRAM_ID=RD2Gg7Lcnv62XmRHAzxh6fQQfMRzHtN5LeKPVBhYU5S

# If you are running on a remote server, set GETH_HOST to your domain name
# e.g. https://rollup.testnet.romeprotocol.xyz instead of http://localhost:3000
export GETH_HOST=http://localhost:3000
export AIRDROP_TITLE="Testnet Token Airdrop"

export ROME_EVM_TAG=v0.3.0
export RHEA_TAG=v0.3.0
export PROXY_TAG=v0.3.0
export GETH_TAG=v0.3.0
export CLI_TAG=v0.3.0

solana config set -u https://apieu.devnet.romeprotocol.xyz
  • GENESIS_PRIVATE_KEY corresponds to the GENESIS_ADDRESS.

  • GETH_HOST defines the URL at which the airdrop server will be started.

If you are running on a remote server, set GETH_HOST to your domain name e.g. rollup.testnet.romeprotocol.xyz instead of localhost:3000.

Update Configuration Files

Note: We use the terms "Proxy" and "Light Client" interchangeably.

Check Solana Slot

Check the Solana slot, and update start_slot in proxy-config.yml and rhea-config.yml (located in rome-setup/docker/cfg) with current slot.

solana slot

This slot will be used by Rhea and Light Client (i.e. Proxy) to determine the rollup's current state based on Solana transaction history beginning from the start slot.

Update Rhea Config

Update rhea-config.yml to set chain_id, start_slot, solana_url, geth_engine_secret, and payers.

solana rpc_url is for submitting transactions to Solana. solana_indexer rpc_url is for indexing transactions from Solana.

chain_id: 1002

start_slot: 339187220
solana:
  rpc_url: "https://apieu.devnet.romeprotocol.xyz"
solana_indexer:
  rpc_url: "https://apieu.devnet.romeprotocol.xyz"

program_id: "RD2Gg7Lcnv62XmRHAzxh6fQQfMRzHtN5LeKPVBhYU5S"

payers:
  - payer_keypair: "/opt/rhea-sender.json"
    fee_recipients:
      - 0xB136AB5B69A8059f5cB30A8B5418F5e43d8f40e8

geth_engine:
  geth_engine_addr: "http://geth:8551"
  geth_engine_secret: "78f54d165d7996252e4664a4d3049b56b9b0b0e5d4c9e50c0f6887205766aafb"
geth_indexer:
  geth_http_addr: "http://geth:8545"
  geth_poll_interval_ms: 100

Update Proxy Config

Update proxy-config.yml to set chain_id, start_slot, solana_url, and payers.

chain_id: 1002

start_slot: 339187220
solana:
  rpc_url: "https://apieu.devnet.romeprotocol.xyz"
  commitment: "confirmed"

program_id: "RD2Gg7Lcnv62XmRHAzxh6fQQfMRzHtN5LeKPVBhYU5S"

proxy_host: "0.0.0.0:9090"

payers:
  - payer_keypair: "/opt/proxy-sender.json"
    fee_recipients:
      - 0xB136AB5B69A8059f5cB30A8B5418F5e43d8f40e8

Specifying payers

Specify multiple payers to increase throughput as more transactions can be executed in parallel by having more payers.

Specifying fee_recipients

Specify fee_recipients as Ethereum addresses that will receive L2 native tokens as compensation for executing Solana transactions.

If fee_recipient is not specified, then no L2 native tokens are transferred for compensation.

Specify multiple fee_recipients to increase throughput as more transactions can be executed in parallel by having more fee recipients.

Create Initial Balance

This step synchronizes initial balances of EVM contract with initial balances of OP Geth. Only the rollup owner is able to invoke this step.

Airdrop SOLs to rollup owner using https://faucet.solana.com so it can execute this transaction. If you are having problems with airdrop, contact us on our Discord or Telegram.

Then, run the following command:

docker-compose up create_balance

If you see an error saying "Error: RomeEvmError: Signer not found, or more than one signer was found", then make sure the airdrop worked and rollup owner keypair has sufficient balance.

Last updated